use of org.apache.jackrabbit.webdav.search.SearchResource in project jackrabbit by apache.
the class AbstractWebdavServlet method doOptions.
/**
* The OPTION method
*
* @param request
* @param response
* @param resource
*/
protected void doOptions(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException {
response.addHeader(DavConstants.HEADER_DAV, resource.getComplianceClass());
response.addHeader("Allow", resource.getSupportedMethods());
response.addHeader("MS-Author-Via", DavConstants.HEADER_DAV);
if (resource instanceof SearchResource) {
String[] langs = ((SearchResource) resource).getQueryGrammerSet().getQueryLanguages();
for (String lang : langs) {
response.addHeader(SearchConstants.HEADER_DASL, "<" + lang + ">");
}
}
// with DeltaV the OPTIONS request may contain a Xml body.
OptionsResponse oR = null;
OptionsInfo oInfo = request.getOptionsInfo();
if (oInfo != null && resource instanceof DeltaVResource) {
oR = ((DeltaVResource) resource).getOptionResponse(oInfo);
}
if (oR == null) {
response.setStatus(DavServletResponse.SC_OK);
} else {
response.sendXmlResponse(oR, DavServletResponse.SC_OK);
}
}
use of org.apache.jackrabbit.webdav.search.SearchResource in project jackrabbit by apache.
the class AbstractWebdavServlet method doSearch.
/**
* The SEARCH method
*
* @param request
* @param response
* @param resource
* @throws DavException
* @throws IOException
*/
protected void doSearch(WebdavRequest request, WebdavResponse response, DavResource resource) throws DavException, IOException {
if (!(resource instanceof SearchResource)) {
response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
return;
}
Document doc = request.getRequestDocument();
if (doc != null) {
SearchInfo sR = SearchInfo.createFromXml(doc.getDocumentElement());
response.sendMultiStatus(((SearchResource) resource).search(sR));
} else {
// request without request body is valid if requested resource
// is a 'query' resource.
response.sendMultiStatus(((SearchResource) resource).search(null));
}
}
Aggregations