long created = resource.getCreated();
long created = metadata.getCreated();
	private void writeResourceProperties(User user, DAVProperties searchedProperties, 			int type, Collection collection, DocumentImpl resource, SAXSerializer serializer, String servletPath) throws SAXException {		if(!resource.getPermissions().validate(user, Permission.READ))			return;		AttributesImpl attrs = new AttributesImpl();		searchedProperties.reset();		serializer.startElement(WebDAV.DAV_NS, "response", "D:response", attrs);		// write D:href		serializer.startElement(WebDAV.DAV_NS, "href", "D:href", attrs);        ///TODO : use dedicated function in XmldbURI		serializer.characters(servletPath + collection.getName() + "/" + resource.getFileName());		serializer.endElement(WebDAV.DAV_NS, "href", "D:href");				serializer.startElement(WebDAV.DAV_NS, "propstat", "D:propstat", attrs);		serializer.startElement(WebDAV.DAV_NS, "prop", "D:prop", attrs);				if(shouldIncludeProperty(type, searchedProperties, DISPLAY_NAME_PROP)) {			// write D:displayname			writeSimpleElement(DISPLAY_NAME_PROP, resource.getFileName(), serializer);		}				if(shouldIncludeProperty(type, searchedProperties, RESOURCE_TYPE_PROP)) {			writeEmptyElement(RESOURCE_TYPE_PROP, serializer);		}				if(shouldIncludeProperty(type, searchedProperties, CREATION_DATE_PROP)) {			long created = resource.getCreated();			writeSimpleElement(CREATION_DATE_PROP, creationDateFormat.format(new Date(created)), serializer);		}				if(shouldIncludeProperty(type, searchedProperties, LAST_MODIFIED_PROP)) {			long modified = resource.getLastModified();			writeSimpleElement(LAST_MODIFIED_PROP, modificationDateFormat.format(new Date(modified)), serializer);		}				if(shouldIncludeProperty(type, searchedProperties, CONTENT_LENGTH_PROP)) {		    writeSimpleElement(CONTENT_LENGTH_PROP, Long.toString(resource.getContentLength()), serializer);		}				if(shouldIncludeProperty(type, searchedProperties, CONTENT_TYPE_PROP)) {            writeSimpleElement(CONTENT_TYPE_PROP, resource.getMimeType(), serializer);		}				if(shouldIncludeProperty(type, searchedProperties, SUPPORTED_LOCK_PROP)) {		    serializer.startElement(WebDAV.DAV_NS, "supportedlock", "D:supportedlock", attrs);		    serializer.startElement(WebDAV.DAV_NS, "lockentry", "D:lockentry", attrs);		    serializer.startElement(WebDAV.DAV_NS, "lockscope", "D:lockscope", attrs);		    writeEmptyElement(EXCLUSIVE_LOCK_PROP, serializer);		    serializer.endElement(WebDAV.DAV_NS, "lockscope", "D:lockscope");		    serializer.startElement(WebDAV.DAV_NS, "locktype", "D:locktype", attrs);		    writeEmptyElement(WRITE_LOCK_PROP, serializer);		    serializer.endElement(WebDAV.DAV_NS, "locktype", "D:locktype");		    serializer.endElement(WebDAV.DAV_NS, "lockentry", "D:lockentry");		    serializer.endElement(WebDAV.DAV_NS, "supportedlock", "D:supportedlock");		}				serializer.endElement(WebDAV.DAV_NS, "prop", "D:prop");		writeSimpleElement(STATUS_PROP, "HTTP/1.1 200 OK", serializer);				serializer.endElement(WebDAV.DAV_NS, "propstat", "D:propstat");		if(type == FIND_BY_PROPERTY) {			List unvisited = searchedProperties.unvisitedProperties();			if(unvisited.size() > 0) {				// there were unsupported properties. Report these to the client.				serializer.startElement(WebDAV.DAV_NS, "propstat", "D:propstat", attrs);				serializer.startElement(WebDAV.DAV_NS, "prop", "D:prop", attrs);				for(Iterator i = unvisited.iterator(); i.hasNext(); ) {					writeEmptyElement((QName)i.next(), serializer);				}				serializer.endElement(WebDAV.DAV_NS, "prop", "D:prop");				writeSimpleElement(STATUS_PROP, "HTTP/1.1 404 Not Found", serializer);				serializer.endElement(WebDAV.DAV_NS, "propstat", "D:propstat");			}		}		serializer.endElement(WebDAV.DAV_NS, "response", "D:response");	}