diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-14 15:07:15 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-14 15:07:15 +1200 |
commit | b512fa18b7ff40cacce09aa5db02f9c29b3e9250 (patch) | |
tree | e4ba762f1fd350698b641bc1f0f24be7a19e6724 /src/org/traccar/http | |
parent | f01ebc2af707bccfd29049afad7d081c58e7f771 (diff) | |
download | traccar-server-b512fa18b7ff40cacce09aa5db02f9c29b3e9250.tar.gz traccar-server-b512fa18b7ff40cacce09aa5db02f9c29b3e9250.tar.bz2 traccar-server-b512fa18b7ff40cacce09aa5db02f9c29b3e9250.zip |
Add mobile web interface
Diffstat (limited to 'src/org/traccar/http')
-rw-r--r-- | src/org/traccar/http/WebServer.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/org/traccar/http/WebServer.java b/src/org/traccar/http/WebServer.java index 15c8527e8..268b53856 100644 --- a/src/org/traccar/http/WebServer.java +++ b/src/org/traccar/http/WebServer.java @@ -21,6 +21,7 @@ import javax.naming.InitialContext; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.server.handler.ResourceHandler; import org.eclipse.jetty.servlet.ServletContextHandler; @@ -55,12 +56,18 @@ public class WebServer { servletHandler.addServlet(new ServletHolder(new DeviceServlet()), "/device/*"); servletHandler.addServlet(new ServletHolder(new MainServlet()), "/*"); + ResourceHandler mobileResourceHandler = new ResourceHandler(); + mobileResourceHandler.setResourceBase(properties.getProperty("http.mobile")); + mobileResourceHandler.setWelcomeFiles(new String[] {"index.html"}); + ContextHandler mobileContext = new ContextHandler("/m"); + mobileContext.setHandler(mobileResourceHandler); + ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setResourceBase(properties.getProperty("http.path")); - resourceHandler.setWelcomeFiles(new String[] {"index.html"}); + resourceHandler.setWelcomeFiles(new String[]{"index.html"}); HandlerList handlerList = new HandlerList(); - handlerList.setHandlers(new Handler[] {servletHandler, resourceHandler}); + handlerList.setHandlers(new Handler[] {servletHandler, mobileContext, resourceHandler}); server.setHandler(handlerList); |