| | |
| | | import de.uhilger.mediaz.App; |
| | | import static de.uhilger.mediaz.App.RB_EP_LISTE; |
| | | import de.uhilger.mediaz.Server; |
| | | import static de.uhilger.mediaz.Server.RB_SLASH; |
| | | import de.uhilger.mediaz.store.FileStorage; |
| | | import de.uhilger.mediaz.entity.Entity; |
| | | import static de.uhilger.mediaz.store.FileStorage.ST_ABLAGEORT; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.logging.Level; |
| | |
| | | @Override |
| | | protected String put(HttpExchange e) throws IOException { |
| | | String path = e.getRequestURI().toString(); |
| | | String[] elems = path.split(App.getRs(Server.RB_SLASH)); |
| | | String[] elems = path.split(Server.SLASH); |
| | | String type = elems[elems.length - 2]; |
| | | String elemName = elems[elems.length - 1]; // alter Name, wenn Aenderung |
| | | if(!elemName.equalsIgnoreCase(App.getRs(RB_EP_LISTE))) { |
| | |
| | | } else { |
| | | fs.write(entity, false); |
| | | } |
| | | return type + App.getRs(Server.RB_SLASH) + entity.getName(); |
| | | return type + Server.SLASH + entity.getName(); |
| | | } else { |
| | | return "Ungueltiges Objekt im Body."; |
| | | } |
| | |
| | | |
| | | private boolean loeschen(HttpExchange e) { |
| | | String path = e.getRequestURI().toString(); |
| | | String[] elems = path.split(App.getRs(Server.RB_SLASH)); |
| | | String[] elems = path.split(Server.SLASH); |
| | | String type = elems[elems.length - 2]; |
| | | String elemName = elems[elems.length - 1]; |
| | | FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); |
| | |
| | | |
| | | private String lesen(HttpExchange e) { |
| | | String path = e.getRequestURI().toString(); |
| | | String[] elems = path.split(App.getRs(Server.RB_SLASH)); |
| | | String[] elems = path.split(Server.SLASH); |
| | | FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); |
| | | if(path.endsWith(App.getRs(RB_SLASH))) { |
| | | if(path.endsWith(Server.SLASH)) { |
| | | List list = null; |
| | | if(elems[elems.length - 1].equalsIgnoreCase(App.getRs(RB_EP_LISTE))) { |
| | | String type = elems[elems.length - 2]; |
| | | logger.fine(type); |
| | | list = fs.list(type); |
| | | if(type.equalsIgnoreCase(ST_ABLAGEORT)) { |
| | | list.add("Livestreams"); |
| | | } |
| | | } else { |
| | | String type = elems[elems.length - 1]; |
| | | logger.fine(type); |