{"action":"created","issue":{"url":"https://api.github.com/repos/tananaev/traccar/issues/1395","labels_url":"https://api.github.com/repos/tananaev/traccar/issues/1395/labels{/name}","comments_url":"https://api.github.com/repos/tananaev/traccar/issues/1395/comments","events_url":"https://api.github.com/repos/tananaev/traccar/issues/1395/events","html_url":"https://github.com/tananaev/traccar/issues/1395","id":104852976,"number":1395,"title":"Expose new UI API for the 'old' web UI","user":{"login":"vitalidze","id":2294325,"avatar_url":"https://avatars.githubusercontent.com/u/2294325?v=3","gravatar_id":"","url":"https://api.github.com/users/vitalidze","html_url":"https://github.com/vitalidze","followers_url":"https://api.github.com/users/vitalidze/followers","following_url":"https://api.github.com/users/vitalidze/following{/other_user}","gists_url":"https://api.github.com/users/vitalidze/gists{/gist_id}","starred_url":"https://api.github.com/users/vitalidze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitalidze/subscriptions","organizations_url":"https://api.github.com/users/vitalidze/orgs","repos_url":"https://api.github.com/users/vitalidze/repos","events_url":"https://api.github.com/users/vitalidze/events{/privacy}","received_events_url":"https://api.github.com/users/vitalidze/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-04T08:57:19Z","updated_at":"2015-09-04T11:18:51Z","closed_at":null,"body":"Right now there are two options for the web UI:\r\n\r\n1) New UI (default), which will expose several servlets and also serves contents under folder from the `web.path` configuration property. ExtJS UI located in that folder by default is communicating with the backend through the API calls.\r\n\r\n2) Old UI, which will deploy a `traccar-web.war` file (or actually any other .war file) and then leaves everything to that web application.\r\n\r\nI want to have a possibility to mix this. In particular I would like to have an API from the new UI and to not serve the contents of folder under `web.path`. I believe this is possible and quite simple to do. In theory I will need only these:\r\n\r\n````\r\n        ServletContextHandler servletHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);\r\n        servletHandler.setContextPath(\"/api\");\r\n        servletHandler.addServlet(new ServletHolder(new AsyncServlet()), \"/async/*\");\r\n        servletHandler.addServlet(new ServletHolder(new ServerServlet()), \"/server/*\");\r\n        servletHandler.addServlet(new ServletHolder(new UserServlet()), \"/user/*\");\r\n        servletHandler.addServlet(new ServletHolder(new DeviceServlet()), \"/device/*\");\r\n        servletHandler.addServlet(new ServletHolder(new PositionServlet()), \"/position/*\");\r\n        servletHandler.addServlet(new ServletHolder(new CommandServlet()), \"/command/*\");\r\n        servletHandler.addServlet(new ServletHolder(new MainServlet()), \"/*\");\r\n````\r\n\r\nTo be more particular I need the Device, Position and Command servlets. But I guess from the maintenance point of view it will be more simple to move this servlet initialisation to a separate method. Then just call it from two constructors in `WebServer` class. Maybe I am missing something.\r\n\r\nPlease let me know what do you think? If you confirm then I will implement it and do a pull request."},"comment":{"url":"https://api.github.com/repos/tananaev/traccar/issues/comments/137709406","html_url":"https://github.com/tananaev/traccar/issues/1395#issuecomment-137709406","issue_url":"https://api.github.com/repos/tananaev/traccar/issues/1395","id":137709406,"user":{"login":"tananaev","id":1161863,"avatar_url":"https://avatars.githubusercontent.com/u/1161863?v=3","gravatar_id":"","url":"https://api.github.com/users/tananaev","html_url":"https://github.com/tananaev","followers_url":"https://api.github.com/users/tananaev/followers","following_url":"https://api.github.com/users/tananaev/following{/other_user}","gists_url":"https://api.github.com/users/tananaev/gists{/gist_id}","starred_url":"https://api.github.com/users/tananaev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tananaev/subscriptions","organizations_url":"https://api.github.com/users/tananaev/orgs","repos_url":"https://api.github.com/users/tananaev/repos","events_url":"https://api.github.com/users/tananaev/events{/privacy}","received_events_url":"https://api.github.com/users/tananaev/received_events","type":"User","site_admin":false},"created_at":"2015-09-04T11:18:51Z","updated_at":"2015-09-04T11:18:51Z","body":"I think it's a good idea to be able to expose APIs without any web interface or with old/custom version of the UI. If you expect a lot of changes, please describe the plan in more details, so I can review it before you start implementing."}}