Search in sources :

Example 1 with OptionsResponse

use of org.apache.jackrabbit.webdav.version.OptionsResponse in project jackrabbit by apache.

the class AbstractResource method getOptionResponse.

//-------------------------------------------< DeltaVResource interface >---
/**
     * @param optionsInfo
     * @return object to be used in the OPTIONS response body or <code>null</code>
     * @see DeltaVResource#getOptionResponse(org.apache.jackrabbit.webdav.version.OptionsInfo)
     */
@Override
public OptionsResponse getOptionResponse(OptionsInfo optionsInfo) {
    OptionsResponse oR = null;
    if (optionsInfo != null) {
        oR = new OptionsResponse();
        // DAV:workspace-collection-set is supported.
        if (optionsInfo.containsElement(DeltaVConstants.XML_VH_COLLECTION_SET, DeltaVConstants.NAMESPACE)) {
            String[] hrefs = new String[] { getLocatorFromItemPath(ItemResourceConstants.VERSIONSTORAGE_PATH).getHref(true) };
            oR.addEntry(DeltaVConstants.XML_VH_COLLECTION_SET, DeltaVConstants.NAMESPACE, hrefs);
        }
        if (optionsInfo.containsElement(DeltaVConstants.XML_WSP_COLLECTION_SET, DeltaVConstants.NAMESPACE)) {
            // workspaces cannot be created anywhere.
            oR.addEntry(DeltaVConstants.XML_WSP_COLLECTION_SET, DeltaVConstants.NAMESPACE, new String[0]);
        }
    }
    return oR;
}
Also used : OptionsResponse(org.apache.jackrabbit.webdav.version.OptionsResponse)

Example 2 with OptionsResponse

use of org.apache.jackrabbit.webdav.version.OptionsResponse in project jackrabbit by apache.

the class DeltaVResourceImpl method getOptionResponse.

//------------------------------------------------------< DeltaVResource>---
/**
     * @param optionsInfo
     * @return object to be used in the OPTIONS response body or <code>null</code>
     * @see DeltaVResource#getOptionResponse(org.apache.jackrabbit.webdav.version.OptionsInfo)
     */
public OptionsResponse getOptionResponse(OptionsInfo optionsInfo) {
    OptionsResponse oR = null;
    if (optionsInfo != null) {
        oR = new OptionsResponse();
        // currently only DAV:version-history-collection-set is supported
        if (optionsInfo.containsElement(DeltaVConstants.XML_VH_COLLECTION_SET, DeltaVConstants.NAMESPACE)) {
            String[] hrefs = new String[] { getLocatorFromNodePath("/" + JcrConstants.JCR_SYSTEM + "/" + JcrConstants.JCR_VERSIONSTORAGE).getHref(true) };
            oR.addEntry(DeltaVConstants.XML_VH_COLLECTION_SET, DeltaVConstants.NAMESPACE, hrefs);
        }
    }
    return oR;
}
Also used : OptionsResponse(org.apache.jackrabbit.webdav.version.OptionsResponse)

Example 3 with OptionsResponse

use of org.apache.jackrabbit.webdav.version.OptionsResponse 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);
    }
}
Also used : DeltaVResource(org.apache.jackrabbit.webdav.version.DeltaVResource) SearchResource(org.apache.jackrabbit.webdav.search.SearchResource) OptionsResponse(org.apache.jackrabbit.webdav.version.OptionsResponse) OptionsInfo(org.apache.jackrabbit.webdav.version.OptionsInfo)

Aggregations

OptionsResponse (org.apache.jackrabbit.webdav.version.OptionsResponse)3 SearchResource (org.apache.jackrabbit.webdav.search.SearchResource)1 DeltaVResource (org.apache.jackrabbit.webdav.version.DeltaVResource)1 OptionsInfo (org.apache.jackrabbit.webdav.version.OptionsInfo)1