| | |
| | | String path = e.getRequestURI().toString(); |
| | | String[] elems = path.split(App.getRs(Server.RB_SLASH)); |
| | | String plname = elems[elems.length - 1]; |
| | | logger.finer("GET plname: " + plname); |
| | | FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); |
| | | String json = fs.readJson(FileStorage.ST_ABSPIELLISTE, plname); |
| | | logger.finer("PL json: " + json); |
| | | return json; |
| | | } |
| | | |
| | |
| | | String path = e.getRequestURI().toString(); |
| | | String[] elems = path.split(App.getRs(Server.RB_SLASH)); |
| | | String response = "ListHandler.put: ungueltiger URL"; |
| | | logger.finer("elems.length: " + elems.length); |
| | | for(String elem : elems) { |
| | | logger.finer("elem: " + elem); |
| | | } |
| | | switch(elems.length) { |
| | | case 5: |
| | | case 5: // ohne nr am Ende |
| | | response = addTitel(e, elems[4]); |
| | | break; |
| | | |
| | |
| | | } |
| | | |
| | | private String addTitel(HttpExchange e, String plname) throws IOException { |
| | | //String plname = elems[elems.length - 1]; |
| | | logger.finer("plname: " + plname); |
| | | FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); |
| | | Entity entity = fs.read(FileStorage.ST_ABSPIELLISTE, plname); |
| | | String response = "Titel konnte nicht hinzugefuegt werden."; |
| | | if(entity instanceof Abspielliste) { |
| | | Abspielliste aliste = (Abspielliste) entity; |
| | | logger.finer("aliste: " + aliste.getName()); |
| | | String titelJson = bodyLesen(e); |
| | | logger.finer("titelJson: " + titelJson); |
| | | Gson gson = new Gson(); |
| | | Object o = gson.fromJson(titelJson, fs.typeFromName(Titel.class.getSimpleName()).getType()); |
| | | if(o instanceof Titel) { |