/** * Retrieves the content-type from prop or set it to {@link #DEFAULT_CONTENT_TYPE}. If isDirectory * always set the content-type to {@link #HTTPD_UNIX_DIRECTORY_CONTENT_TYPE}. * * @param response The response complex type of the multistatus * @return the content type. */ private String getContentType(Response response) { Propstat list = response.getPropstat(); if (list.equals("") || null == list) { return null; } return list.getProp().getGetcontenttype(); /*// Make sure that directories have the correct content type. List<Propstat> list = response.getPropstat(); if (list.isEmpty()) { return null; } for(Propstat propstat: list) { Resourcetype resourcetype = propstat.getProp().getResourcetype(); if ((resourcetype != null) && (resourcetype.getCollection() != null)) { // Need to correct the contentType to identify as a directory. return HTTPD_UNIX_DIRECTORY_CONTENT_TYPE; } else { Getcontenttype gtt = propstat.getProp().getGetcontenttype(); if ((gtt != null) && (gtt.getContent().size() == 1)) { return gtt.getContent().get(0); } } } return DEFAULT_CONTENT_TYPE;*/ }
/** * Retrieves modifieddate from props. If it is not available return null. * * @param response The response complex type of the multistatus * @return Null if not found in props */ private String getModifiedDate(Response response) { Propstat list = response.getPropstat(); if (list.equals("") || null == list) { return null; } return list.getProp().getGetlastmodified(); /*if (list.isEmpty()) { return null; } for(Propstat propstat: list) { Getlastmodified glm = propstat.getProp().getGetlastmodified(); if ((glm != null) && (glm.getContent().size() == 1)) { return glm.getContent().get(0); } } return null; */ }
/** * Retrieves content-length from props. If it is not available return {@link * #DEFAULT_CONTENT_LENGTH}. * * @param response The response complex type of the multistatus * @return contentlength */ private String getEtag(Response response) { Propstat list = response.getPropstat(); if (list.equals("") || null == list) { return null; } return list.getProp().getGetetag(); /*List<Propstat> list = response.getPropstat(); if (list.isEmpty()) { return null; } for(Propstat propstat: list) { Getetag etag = propstat.getProp().getGetetag(); if ((etag != null) && (etag.getContent().size() == 1)) { return etag.getContent().get(0); } } return null;*/ }
/** * Retrieves creationdate from props. If it is not available return null. * * @param response The response complex type of the multistatus * @return Null if not found in props */ private String getCreationDate(Response response) { Propstat list = response.getPropstat(); if (list.equals("") || null == list) { return null; } return list.getProp().getCreationdate(); /*List<Propstat> list = response.getPropstat(); if (list.isEmpty()) { return null; } for(Propstat propstat: list) { Creationdate gcd = propstat.getProp().getCreationdate(); if ((gcd != null) && (gcd.getContent().size() == 1)) { return gcd.getContent().get(0); } } return null;*/ }