Java Code Examples for javax.ws.rs.core.HttpHeaders#CONTENT_LENGTH

The following examples show how to use javax.ws.rs.core.HttpHeaders#CONTENT_LENGTH . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CellResource.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * PROPFINDメソッドの処理.
 * @param requestBodyXml Request Body
 * @param depth Depth Header
 * @param contentLength Content-Length Header
 * @param transferEncoding Transfer-Encoding Header
 * @return JAX-RS Response
 */
@WebDAVMethod.PROPFIND
public Response propfind(final Reader requestBodyXml,
        @DefaultValue("0") @HeaderParam(DcCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {

    return this.cellRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            CellPrivilege.PROPFIND, CellPrivilege.ACL_READ);
}
 
Example 2
Source File: DavFileResource.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * process PROPFIND Method.
 * @param requestBodyXml request body
 * @param depth Depth Header
 * @param contentLength Content-Length Header
 * @param transferEncoding Transfer-Encoding Header
 * @return JAX-RS response object
 */
@WebDAVMethod.PROPFIND
public Response propfind(final Reader requestBodyXml,
        @HeaderParam(DcCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {

    return this.davRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            BoxPrivilege.READ_PROPERTIES, BoxPrivilege.READ_ACL);
}
 
Example 3
Source File: ODataSvcCollectionResource.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * PROPFINDの処理.
 * @param requestBodyXml リクエストボディ
 * @param depth Depthヘッダ
 * @param contentLength Content-Length ヘッダ
 * @param transferEncoding Transfer-Encoding ヘッダ
 * @return JAX-RS Response
 */
@WebDAVMethod.PROPFIND
public Response propfind(final Reader requestBodyXml,
        @HeaderParam(DcCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {

    return this.davRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            BoxPrivilege.READ_PROPERTIES, BoxPrivilege.READ_ACL);

}
 
Example 4
Source File: DcEngineSourceCollection.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * @param requestBodyXml Request Body
 * @param depth Depth Header
 * @param contentLength Content-Length Header
 * @param transferEncoding Transger-Encoding Header
 * @return JAX-RS Response
 */
@WebDAVMethod.PROPFIND
public Response propfind(final Reader requestBodyXml,
        @HeaderParam(DcCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {

    return this.davRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            BoxPrivilege.READ_PROPERTIES, BoxPrivilege.READ_ACL);
}
 
Example 5
Source File: DcEngineSvcCollectionResource.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * PROPFINDの処理.
 * @param requestBodyXml リクエストボディ
 * @param depth Depthヘッダ
 * @param contentLength Content-Length ヘッダ
 * @param transferEncoding Transfer-Encoding ヘッダ
 * @return JAX-RS Response
 */
@WebDAVMethod.PROPFIND
public Response propfind(final Reader requestBodyXml,
        @HeaderParam(DcCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {

    return this.davRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            BoxPrivilege.READ_PROPERTIES, BoxPrivilege.READ_ACL);

}
 
Example 6
Source File: DavCollectionResource.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * @param requestBodyXml Request Body
 * @param depth Depth Header
 * @param contentLength Content-Length Header
 * @param transferEncoding Transfer-Encoding Header
 * @return JAX-RS Response
 */
@WebDAVMethod.PROPFIND
public Response propfind(final Reader requestBodyXml,
        @HeaderParam(DcCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {

    return this.davRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            BoxPrivilege.READ_PROPERTIES, BoxPrivilege.READ_ACL);

}
 
Example 7
Source File: BoxResource.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * PROPFINDメソッドの処理.
 * @param requestBodyXml Request Body
 * @param depth Depth Header
 * @param contentLength Content-Length Header
 * @param transferEncoding Transfer-Encoding Header
 * @return JAX-RS Response
 */
@WebDAVMethod.PROPFIND
public Response propfind(final Reader requestBodyXml,
        @HeaderParam(DcCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {

    return this.davRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            BoxPrivilege.READ_PROPERTIES, BoxPrivilege.READ_ACL);
}
 
Example 8
Source File: BoxResource.java    From io with Apache License 2.0 4 votes vote down vote up
/**
 * MKCOLメソッドの処理. boxインストールを行う.
 * @param uriInfo UriInfo
 * @param dcCredHeader dcCredHeader
 * @param contentType Content-Typeヘッダの値
 * @param contentLength Content-Lengthヘッダの値
 * @param requestKey イベントログに出力するRequestKeyフィールドの値
 * @param inStream HttpリクエストのInputStream
 * @return JAX-RS Response
 */
@WebDAVMethod.MKCOL
public Response mkcol(
        @Context final UriInfo uriInfo,
        @HeaderParam(DcCoreUtils.HttpHeaders.X_DC_CREDENTIAL) final String dcCredHeader,
        @HeaderParam(HttpHeaders.CONTENT_TYPE) final String contentType,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final String contentLength,
        @HeaderParam(DcCoreUtils.HttpHeaders.X_DC_REQUESTKEY) String requestKey,
        final InputStream inStream) {

    DcEventBus eventBus = new DcEventBus(this.cell);
    Event event = null;
    Response res = null;
    try {
        // ログファイル出力
        JSONEvent reqBody = new JSONEvent();
        reqBody.setAction(WebDAVMethod.MKCOL.toString());
        reqBody.setLevel(LEVEL.INFO);
        reqBody.setObject(this.cell.getUrl() + boxName);
        reqBody.setResult("");
        // X-Dc-RequestKeyの解析(指定なしの場合にデフォルト値を補充)
        requestKey = EventResource.validateXDcRequestKey(requestKey);
        // TODO findBugs対策↓
        log.debug(requestKey);

        event = EventResource.createEvent(reqBody, requestKey, this.accessContext);
        // eventBus.outputEventLog(event);

        if (Box.DEFAULT_BOX_NAME.equals(this.boxName)) {
            throw DcCoreException.Misc.METHOD_NOT_ALLOWED;
        }

        // Boxを作成するためにCellCtlResource、ODataEntityResource(ODataProducer)が必要
        // この時点では "X-Dc-Credential" ヘッダーは不要なのでnullを指定する
        CellCtlResource cellctl = new CellCtlResource(this.accessContext, null, this.cellRsCmp);
        String keyName = "'" + this.boxName + "'";
        ODataEntityResource odataEntity = new ODataEntityResource(cellctl, Box.EDM_TYPE_NAME, keyName);

        Map<String, String> headers = new HashMap<String, String>();
        headers.put(HttpHeaders.CONTENT_TYPE, contentType);
        headers.put(HttpHeaders.CONTENT_LENGTH, contentLength);

        // X-Dc-RequestKeyの解析(指定なしの場合にデフォルト値を補充)
        BarFileInstaller installer =
                new BarFileInstaller(this.cell, this.boxName, odataEntity, uriInfo);

        res = installer.barFileInstall(headers, inStream, event.getRequestKey());
        event.setResult(Integer.toString(res.getStatus()));
    } catch (RuntimeException e) {
        // TODO 内部イベントの正式対応が必要
        if (e instanceof DcCoreException) {
            event.setResult(Integer.toString(((DcCoreException) e).getStatus()));
            if (((DcCoreException) e).getStatus() > HttpStatus.SC_INTERNAL_SERVER_ERROR) {
                event.setLevel(LEVEL.WARN);
            } else {
                event.setLevel(LEVEL.ERROR);
            }
        } else {
            event.setResult(Integer.toString(HttpStatus.SC_INTERNAL_SERVER_ERROR));
            event.setLevel(LEVEL.ERROR);
        }
        throw e;
    } finally {
        // 終了ログファイル出力
        eventBus.outputEventLog(event);
    }
    return res;
}