| | |
| | | private int port; |
| | | |
| | | private String ctx; |
| | | |
| | | private HttpServer server; |
| | | |
| | | /** |
| | | * Ein neues Objekt der Kalsse Server erzeugen |
| | |
| | | String wwwData = App.getInitParameter(App.getRs(App.RB_AP_WWW_DATA)); |
| | | File wwwDir = new File(wwwData); |
| | | |
| | | HttpServer server = HttpServer.create(new InetSocketAddress(port), 0); |
| | | server = HttpServer.create(new InetSocketAddress(port), 0); |
| | | server.createContext(ctx + App.getRs(RB_WEBROOT), new FileHandler(wwwDir.getAbsolutePath())); |
| | | ablageorteEinklinken(server); |
| | | server.createContext(ctx + App.getRs(RB_STORE), new StorageHandler()); |
| | |
| | | server.setExecutor(Executors.newFixedThreadPool(20)); |
| | | server.start(); |
| | | } |
| | | |
| | | public void ablageortEntfernen(String url) { |
| | | server.removeContext(ctx + url); |
| | | } |
| | | |
| | | public void ablageortHinzufuegen(Ablageort ort) { |
| | | server.createContext(ctx + ort.getUrl(), |
| | | new ListFileHandler(new File(ort.getOrt()).getAbsolutePath())); |
| | | } |
| | | |
| | | private void ablageorteEinklinken(HttpServer server) |
| | | throws ClassNotFoundException, IOException { |
| | | String typ = Ablageort.class.getSimpleName(); |