} if(!resource.getPermissions().validate(user, Permission.READ)) { response.sendError(HttpServletResponse.SC_FORBIDDEN, "Not allowed to read resource"); return;
	public void process(User user, HttpServletRequest request,			HttpServletResponse response, Collection collection,			DocumentImpl resource) throws ServletException, IOException {		if(resource == null) {			// GET is not available on collections			response.sendError(HttpServletResponse.SC_FORBIDDEN, "GET is not available on collections");			return;		}		String contentType;		if(resource.getResourceType() == DocumentImpl.XML_FILE)			contentType = WebDAV.XML_CONTENT;		else			contentType = WebDAV.BINARY_CONTENT;		response.setContentType(contentType);		response.addDateHeader("Last-Modified", resource.getLastModified());				byte[] contentData = null;		DBBroker broker = null;		try {			broker = pool.get();			if(resource.getResourceType() == DocumentImpl.XML_FILE) {				Serializer serializer = broker.getSerializer();				serializer.reset();				try {					serializer.setProperties(WebDAV.OUTPUT_PROPERTIES);					String content = serializer.serialize(resource);					contentData = content.getBytes("UTF-8");				} catch (SAXException e) {					throw new ServletException("Error while serializing document: " + e.getMessage(), e);				}			} else				contentData = broker.getBinaryResourceData((BinaryDocument)resource);		} catch (EXistException e) {			throw new ServletException("Error while serializing document: " + e.getMessage(), e);		} finally {			pool.release(broker);		}		if(contentData == null) {			response.sendError(HttpServletResponse.SC_NOT_FOUND);			return;		}		response.setContentLength(contentData.length);		ServletOutputStream os = response.getOutputStream();		os.write(contentData);		os.flush();	}