From a7100fa9749a343a77c747a2cca8ae9e2faf91cb Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 30 Dec 2012 16:55:46 +1300 Subject: Code to test new web interface --- src/org/traccar/http/WebServer.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src') diff --git a/src/org/traccar/http/WebServer.java b/src/org/traccar/http/WebServer.java index 5dfeabed2..aac334cc6 100644 --- a/src/org/traccar/http/WebServer.java +++ b/src/org/traccar/http/WebServer.java @@ -174,6 +174,7 @@ public class WebServer { response.sendRedirect(response.encodeRedirectURL("/")); } + @Override public void handle(String target,Request baseRequest,HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException { @@ -192,6 +193,26 @@ public class WebServer { public WebServer(Integer port, DataManager dataManager) { server = new Server(port); server.setHandler(new WebHandler(dataManager)); + + /*WebAppContext webapp = new WebAppContext(); + webapp.setContextPath("/"); + webapp.setWar("/home/user/Documents/traccar-web/target/traccar-web-1.0-SNAPSHOT.war"); + try { + + Context context = new InitialContext(); + + Class clazz = Class.forName("org.h2.jdbcx.JdbcDataSource"); + + DataSource ds = (DataSource) clazz.newInstance(); + clazz.getMethod("setURL", String.class).invoke(ds, "jdbc:h2:/home/user/Documents/traccar/target/database2"); + clazz.getMethod("setUser", String.class).invoke(ds, "sa"); + //clazz.getMethod("setPassword", String.class).invoke(ds, ""); + + context.bind("java:/DefaultDS", ds); + + } catch (Exception error) { + } + server.setHandler(webapp);*/ } public WebServer(String address, Integer port, DataManager dataManager) { -- cgit v1.2.3