List of usage examples for com.liferay.portal.kernel.webdav WebDAVStorage getRootPath
public String getRootPath();
From source file:it.smc.calendar.sync.caldav.methods.BasePropMethodImpl.java
License:Open Source License
protected int writeResponseXML(WebDAVRequest webDAVRequest, Set<QName> props) throws Exception { WebDAVStorage storage = webDAVRequest.getWebDAVStorage(); long depth = WebDAVUtil.getDepth(webDAVRequest.getHttpServletRequest()); Document document = SAXReaderUtil.createDocument(); Element multistatusElement = SAXReaderUtil.createElement(CalDAVProps.createQName("multistatus")); document.setRootElement(multistatusElement); Resource resource = storage.getResource(webDAVRequest); if (resource != null) { addResponse(storage, webDAVRequest, resource, props, multistatusElement, depth); String xml = document.formattedString(StringPool.FOUR_SPACES); if (_log.isDebugEnabled()) { _log.debug("Response XML\n" + xml); }/*from w w w .j av a 2 s. c o m*/ // Set the status prior to writing the XML int status = WebDAVUtil.SC_MULTI_STATUS; HttpServletResponse response = webDAVRequest.getHttpServletResponse(); response.setContentType(ContentTypes.TEXT_XML_UTF8); response.setStatus(status); try { ServletResponseUtil.write(response, xml); response.flushBuffer(); } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn(e); } } return status; } else { if (_log.isDebugEnabled()) { _log.debug("No resource found for " + storage.getRootPath() + webDAVRequest.getPath()); } return HttpServletResponse.SC_NOT_FOUND; } }