| | |
| | | |
| | | String wwwData = App.getInitParameter(App.getRs(App.RB_AP_WWW_DATA)); |
| | | File wwwDir = new File(wwwData); |
| | | //String ui = App.getInitParameter(App.getRs(App.RB_AP_UI)); |
| | | //File uiDir = new File(ui); |
| | | |
| | | HttpServer server = HttpServer.create(new InetSocketAddress(port), 0); |
| | | server.createContext(ctx + App.getRs(RB_WEBROOT), |
| | | new FileHandler(wwwDir.getAbsolutePath())); |
| | | server.createContext(ctx + App.getRs(RB_WEBROOT), new FileHandler(wwwDir.getAbsolutePath())); |
| | | ablageorteEinklinken(server); |
| | | server.createContext(ctx + App.getRs(RB_STORE), new StorageHandler()); |
| | | //server.createContext(ctx + App.getRs(RB_UI_ROOT), new FileHandler(uiDir.getAbsolutePath())); |
| | | server.createContext(ctx + App.getRs(RB_STOP_SERVER), new StopServerHandler()); |
| | | //server.createContext(ctx + App.getRs(RB_ABLAGE_TEST), new AblageTestHandler()); |
| | | //server.createContext(ctx + App.getRs(RB_STORE_TEST), new StoreTestHandler()); |
| | | server.setExecutor(Executors.newFixedThreadPool(20)); |
| | | server.start(); |
| | | } |
| | | |
| | | private void ablageorteEinklinken(HttpServer server) throws ClassNotFoundException, IOException { |
| | | private void ablageorteEinklinken(HttpServer server) |
| | | throws ClassNotFoundException, IOException { |
| | | String typ = Ablageort.class.getSimpleName(); |
| | | FileStorage store = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); |
| | | List<String> orte = store.list(typ); |
| | |
| | | String ortName = i.next(); |
| | | Entity e = store.read(typ, ortName); |
| | | if(e instanceof Ablageort) { |
| | | Ablageort ort = (Ablageort) e; |
| | | Ablageort ablageort = (Ablageort) e; |
| | | logger.fine(ctx + ablageort.getUrl()); |
| | | logger.fine(ablageort.getOrt()); |
| | | server.createContext(ctx + ablageort.getUrl(), |
| | | new ListFileHandler(new File(ablageort.getOrt()).getAbsolutePath())); |
| | | Ablageort ablageort = (Ablageort) e; |
| | | logger.log(Level.FINE, "{0}{1}", new Object[]{ctx, ablageort.getUrl()}); |
| | | logger.fine(ablageort.getOrt()); |
| | | server.createContext(ctx + ablageort.getUrl(), |
| | | new ListFileHandler(new File(ablageort.getOrt()).getAbsolutePath())); |
| | | } |
| | | } |
| | | } |