From b512fa18b7ff40cacce09aa5db02f9c29b3e9250 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 14 May 2015 15:07:15 +1200 Subject: Add mobile web interface --- src/org/traccar/http/WebServer.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') 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); -- cgit v1.2.3