diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-12-30 16:55:46 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-12-30 16:55:46 +1300 |
commit | a7100fa9749a343a77c747a2cca8ae9e2faf91cb (patch) | |
tree | 7dda63cda265afadc33c3b5d65e8bb3de2651081 | |
parent | 9a6cc11cdc5069314f9c64aa1e017f556baf8070 (diff) | |
download | trackermap-server-a7100fa9749a343a77c747a2cca8ae9e2faf91cb.tar.gz trackermap-server-a7100fa9749a343a77c747a2cca8ae9e2faf91cb.tar.bz2 trackermap-server-a7100fa9749a343a77c747a2cca8ae9e2faf91cb.zip |
Code to test new web interface
-rw-r--r-- | default.cfg | 4 | ||||
-rw-r--r-- | src/org/traccar/http/WebServer.java | 21 |
2 files changed, 24 insertions, 1 deletions
diff --git a/default.cfg b/default.cfg index 0feb9338b..6409637bb 100644 --- a/default.cfg +++ b/default.cfg @@ -6,6 +6,7 @@ <!-- Global confiduration --> <entry key="database.driver">org.h2.Driver</entry> + <entry key="database.dataSource">org.h2.jdbcx.JdbcDataSource</entry> <entry key="database.url">jdbc:h2:/home/user/Documents/traccar/target/database</entry> <entry key="database.user">sa</entry> <entry key="database.password"></entry> @@ -80,10 +81,11 @@ VALUES (:device_id, :time, :valid, :latitude, :longitude, :speed, :course, :power); </entry> - <!-- Web interface port --> + <!-- Web interface --> <entry key="http.enable">true</entry> <!--<entry key="http.address"></entry>--> <entry key="http.port">8082</entry> + <entry key="http.application">/home/user/Documents/traccar-web/target/traccar-web-1.0-SNAPSHOT.war</entry> <!-- Geocoder options --> <entry key="geocoder.enable">false</entry> 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) { |