| | |
| | | import com.sun.net.httpserver.HttpExchange; |
| | | import de.uhilger.neon.FileServer; |
| | | import de.uhilger.neon.HttpResponder; |
| | | import de.uhilger.fm.Const; |
| | | import de.uhilger.fm.Duplicator; |
| | | import de.uhilger.fm.Mover; |
| | | import de.uhilger.fm.Renamer; |
| | |
| | | switch (params[0]) { |
| | | case P_RENAME: |
| | | h.inspectFileName(params[1]); |
| | | String neuerDateiName = new Renamer().umbenennen(exchange, fileName, params[1], file); |
| | | String neuerDateiName = new Renamer().rename(/*fileName, */params[1], file); |
| | | antwort(exchange, HttpResponder.SC_OK, neuerDateiName); |
| | | break; |
| | | case P_COPY: |
| | | h.inspectFileName(params[1]); |
| | | copyOrMove(exchange, params[1], fileName, Const.OP_COPY); |
| | | copyOrMove(exchange, params[1], fileName, Mover.OP_COPY); |
| | | break; |
| | | case P_MOVE: |
| | | h.inspectFileName(params[1]); |
| | | copyOrMove(exchange, params[1], fileName, Const.OP_MOVE); |
| | | copyOrMove(exchange, params[1], fileName, Mover.OP_MOVE); |
| | | break; |
| | | case P_DUPLICATE: |
| | | if (Boolean.parseBoolean(params[1])) { |
| | |
| | | } |
| | | break; |
| | | case P_ZIP: |
| | | String path = exchange.getRequestURI().toString(); |
| | | zipAntwort(exchange, new Deflator().packFolder(fileName, path, base)); |
| | | //String path = exchange.getRequestURI().toString(); |
| | | zipAntwort(exchange, new Deflator().packFolder(fileName, /*path, */base)); |
| | | break; |
| | | case P_UNZIP: |
| | | path = exchange.getRequestURI().toString(); |
| | | zipAntwort(exchange, new Inflator().extractZipfile(fileName, path, base)); |
| | | //String path = exchange.getRequestURI().toString(); |
| | | zipAntwort(exchange, new Inflator().extractZipfile(fileName, /*path,*/ base)); |
| | | break; |
| | | default: |
| | | antwort(exchange, HttpResponder.SC_NOT_FOUND, "ungueltige Anfrage"); |
| | |
| | | |
| | | private void copyOrMove(HttpExchange exchange, String quelle, String ziel, int op) throws IOException { |
| | | String[] dateiNamen = dateiliste(exchange); |
| | | new Mover().copyOrMoveFiles(quelle, ziel, dateiNamen, op, base); |
| | | if(op == Mover.OP_COPY) { |
| | | new Mover().copy(quelle, ziel, dateiNamen, base); |
| | | } else { |
| | | new Mover().move(quelle, ziel, dateiNamen, base); |
| | | } |
| | | //new Mover().copyOrMoveFiles(quelle, ziel, dateiNamen, op, base); |
| | | antwort(exchange, HttpResponder.SC_OK, "Dateien verarbeitet."); |
| | | } |
| | | |