Skip to content

Commit

Permalink
support contextPath configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
chenerfei committed Apr 16, 2017
1 parent 124fc63 commit b555263
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,23 @@ public static void main(String[] args) {
port = "8081";
}

String contextPath = conf.getProperty("contextPath");
if (contextPath == null || contextPath.trim().equals("")) {
contextPath = "/";
}

Server server = new Server(Integer.parseInt(port));
WebAppContext webapp = new WebAppContext();
webapp.setWar(confPath + "/war/lts-admin.war");
webapp.setContextPath(contextPath);
Map<String, String> initParams = new HashMap<String, String>();
initParams.put("lts.admin.config.path", confPath + "/conf");
webapp.setInitParams(initParams);
server.setHandler(webapp);
server.setStopAtShutdown(true);
server.start();

System.out.println("LTS-Admin started. http://" + NetUtils.getLocalHost() + ":" + port + "/index.htm");
System.out.println("LTS-Admin started. http://" + NetUtils.getLocalHost() + ":" + port + (contextPath == "/" ? "" : contextPath) + "/index.htm");

} catch (Exception e) {
e.printStackTrace();
Expand Down

0 comments on commit b555263

Please sign in to comment.