| | |
| | | } |
| | | } |
| | | |
| | | public class DirList { |
| | | private String pfad; |
| | | private List<Datei> dateien; |
| | | |
| | | public String getPfad() { |
| | | return pfad; |
| | | } |
| | | |
| | | public void setPfad(String pfad) { |
| | | this.pfad = pfad; |
| | | } |
| | | |
| | | public List<Datei> getDateien() { |
| | | return dateien; |
| | | } |
| | | |
| | | public void setDateien(List<Datei> dateien) { |
| | | this.dateien = dateien; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | private void liste(HttpExchange e, HttpHelper helper) throws IOException { |
| | | String path = e.getRequestURI().toString(); |
| | | logger.fine(path); |
| | | String fName = helper.getFileName(e); |
| | | String dirListPath = e.getHttpContext().getPath() + fName; |
| | | if (path.endsWith(STR_SLASH)) { |
| | | logger.fine("fName: " + fName); |
| | | File dir = new File(e.getHttpContext().getAttributes().get(FileHandler.ATTR_FILE_BASE).toString(), fName); |
| | |
| | | } else { |
| | | datei.setTyp(Datei.TYP_DATEI); |
| | | } |
| | | datei.setPfad(e.getHttpContext().getPath() + fName); |
| | | //datei.setPfad(e.getHttpContext().getPath() + fName); |
| | | String lowerName = dateiName.toLowerCase(); |
| | | if (lowerName.endsWith(ImageActor.JPEG) |
| | | || lowerName.endsWith(ImageActor.JPG) |
| | |
| | | } |
| | | } |
| | | if(liste.size() > 0) { |
| | | DirList list = new DirList(); |
| | | list.setPfad(dirListPath); |
| | | list.setDateien(liste); |
| | | Gson gson = new Gson(); |
| | | String json = gson.toJson(liste); |
| | | //String json = gson.toJson(liste); |
| | | String json = gson.toJson(list); |
| | | //byte[] bytes = json.getBytes(); |
| | | //logger.fine("json: '" + json + "'"); |
| | | HttpResponder r = new HttpResponder(); |