diff options
Diffstat (limited to 'src/org/traccar/web/WebServer.java')
-rw-r--r-- | src/org/traccar/web/WebServer.java | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/src/org/traccar/web/WebServer.java b/src/org/traccar/web/WebServer.java index e022a9285..8201f8d16 100644 --- a/src/org/traccar/web/WebServer.java +++ b/src/org/traccar/web/WebServer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2016 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 2016 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,23 +34,7 @@ import org.traccar.api.CorsResponseFilter; import org.traccar.api.ObjectMapperProvider; import org.traccar.api.ResourceErrorHandler; import org.traccar.api.SecurityRequestFilter; -import org.traccar.api.resource.CommandResource; -import org.traccar.api.resource.GroupPermissionResource; import org.traccar.api.resource.ServerResource; -import org.traccar.api.resource.SessionResource; -import org.traccar.api.resource.DevicePermissionResource; -import org.traccar.api.resource.UserResource; -import org.traccar.api.resource.GroupResource; -import org.traccar.api.resource.NotificationResource; -import org.traccar.api.resource.DeviceResource; -import org.traccar.api.resource.PositionResource; -import org.traccar.api.resource.ReportResource; -import org.traccar.api.resource.CommandTypeResource; -import org.traccar.api.resource.DeviceGeofenceResource; -import org.traccar.api.resource.EventResource; -import org.traccar.api.resource.GeofencePermissionResource; -import org.traccar.api.resource.GeofenceResource; -import org.traccar.api.resource.GroupGeofenceResource; import org.traccar.helper.Log; import javax.naming.InitialContext; @@ -119,9 +103,7 @@ public class WebServer { resourceHandler.setResourceBase(config.getString("web.path")); if (config.getBoolean("web.debug")) { resourceHandler.setWelcomeFiles(new String[] {"debug.html"}); - //Troubleshooting Locked UI Files on Windows while app is running (like html, js, css, etc...), - //you can make changes to the UI Files and refresh the page in the browser without stopping the app first - resourceHandler.setMinMemoryMappedContentLength(-1); + resourceHandler.setMinMemoryMappedContentLength(-1); // avoid locking files on Windows } else { resourceHandler.setWelcomeFiles(new String[] {"release.html", "index.html"}); } @@ -151,17 +133,10 @@ public class WebServer { servletHandler.addServlet(new ServletHolder(new AsyncSocketServlet()), "/socket"); ResourceConfig resourceConfig = new ResourceConfig(); - resourceConfig.register(ObjectMapperProvider.class); - resourceConfig.register(JacksonFeature.class); - resourceConfig.register(ResourceErrorHandler.class); - resourceConfig.register(SecurityRequestFilter.class); - resourceConfig.register(CorsResponseFilter.class); - resourceConfig.registerClasses(ServerResource.class, SessionResource.class, CommandResource.class, - GroupPermissionResource.class, DevicePermissionResource.class, UserResource.class, - GroupResource.class, DeviceResource.class, PositionResource.class, - CommandTypeResource.class, EventResource.class, GeofenceResource.class, - DeviceGeofenceResource.class, GeofencePermissionResource.class, GroupGeofenceResource.class, - NotificationResource.class, ReportResource.class); + resourceConfig.registerClasses(JacksonFeature.class, ObjectMapperProvider.class, ResourceErrorHandler.class); + resourceConfig.registerClasses(SecurityRequestFilter.class, CorsResponseFilter.class); + resourceConfig.packages(ServerResource.class.getPackage().getName()); + servletHandler.addServlet(new ServletHolder(new ServletContainer(resourceConfig)), "/*"); handlers.addHandler(servletHandler); |