} response.setContentType(resource.getMimeType());
} DocumentMetadata metadata = resource.getMetadata(); response.setContentType(metadata.getMimeType());
	public void process(User user, HttpServletRequest request,			HttpServletResponse response, String path) throws ServletException, IOException {		DBBroker broker = null;		Collection collection = null;		DocumentImpl resource = null;		try {			broker = pool.get();			collection = broker.openCollection(path, Lock.READ_LOCK);			if(collection != null) {                response.setContentLength(0);                response.addDateHeader("Last-Modified", collection.getCreationTime());				return;			}			resource = broker.openDocument(path, Lock.READ_LOCK);			if(resource == null) {				response.sendError(HttpServletResponse.SC_NOT_FOUND, "Resource not found");				return;			}			if(!resource.getPermissions().validate(user, Permission.READ)) {				response.sendError(HttpServletResponse.SC_FORBIDDEN, READ_PERMISSION_DENIED);				return;			} 			response.setContentType(resource.getMimeType());			response.setContentLength(resource.getContentLength());			response.addDateHeader("Last-Modified", resource.getLastModified());		} catch (EXistException e) {			throw new ServletException(e.getMessage(), e);		} catch (PermissionDeniedException e) {			response.sendError(HttpServletResponse.SC_FORBIDDEN, READ_PERMISSION_DENIED);		} finally {			if(collection != null)				collection.release();			if(resource != null)				resource.getUpdateLock().release(Lock.READ_LOCK);			pool.release(broker);		}	}