Skip to content

Commit

Permalink
Remove port number from code.
Browse files Browse the repository at this point in the history
  • Loading branch information
k-tamura committed Feb 13, 2017
1 parent bc88d6f commit dc8f839
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import javax.servlet.http.HttpServletResponse;

import org.pmw.tinylog.Logger;
import org.t246osslab.easybuggy.utils.ApplicationUtils;
import org.t246osslab.easybuggy.utils.Closer;
import org.t246osslab.easybuggy.utils.HTTPResponseCreator;
import org.t246osslab.easybuggy.utils.MessageUtils;
Expand All @@ -30,7 +29,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser
InputStreamReader isr = null;
BufferedReader reader = null;
try {
URL url = new URL("http://localhost:" + ApplicationUtils.getEasyBuggyPort() + "/ping");
URL url = new URL(req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + "/ping");
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");

Expand Down
17 changes: 0 additions & 17 deletions src/main/java/org/t246osslab/easybuggy/utils/ApplicationUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
*/
public class ApplicationUtils {

// default port: 8989
private static int easyBuggyPort = 8989;

// default database url: derby in-memory
private static String databaseURL = "jdbc:derby:memory:demo;create=true";

Expand All @@ -26,11 +23,6 @@ public class ApplicationUtils {
} catch (MissingResourceException e) {
Logger.error(e);
}
try {
easyBuggyPort = Integer.parseInt(bundle.getString("easybuggy.port"));
} catch (Exception e) {
Logger.error(e);
}
try {
databaseURL = bundle.getString("database.url");
} catch (Exception e) {
Expand All @@ -43,15 +35,6 @@ public class ApplicationUtils {
}
}

/**
* Return a Port number of EasyBuggy.
*
* @return Port number of EasyBuggy
*/
public static int getEasyBuggyPort() {
return easyBuggyPort;
}

/**
* Return a Database URL of EasyBuggy.
*
Expand Down

0 comments on commit dc8f839

Please sign in to comment.