当前位置: 首页>>代码示例>>Java>>正文


Java HttpHeaders.CONTENT_LENGTH属性代码示例

本文整理汇总了Java中javax.ws.rs.core.HttpHeaders.CONTENT_LENGTH属性的典型用法代码示例。如果您正苦于以下问题:Java HttpHeaders.CONTENT_LENGTH属性的具体用法?Java HttpHeaders.CONTENT_LENGTH怎么用?Java HttpHeaders.CONTENT_LENGTH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.ws.rs.core.HttpHeaders的用法示例。


在下文中一共展示了HttpHeaders.CONTENT_LENGTH属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: propfind

/**
 * 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(PersoniumCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {
    // Check exist
    checkFileExists();
    // Access Control
    davRsCmp.getParent().checkAccessContext(davRsCmp.getAccessContext(), CellPrivilege.ROOT);
    return davRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding, CellPrivilege.ROOT);
}
 
开发者ID:personium,项目名称:personium-core,代码行数:19,代码来源:CellSnapshotDavFileResource.java

示例2: propfind

/**
 * 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(PersoniumCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {
    // Access Control
    this.cellRsCmp.checkAccessContext(this.cellRsCmp.getAccessContext(), CellPrivilege.PROPFIND);
    return this.cellRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            CellPrivilege.ACL_READ);
}
 
开发者ID:personium,项目名称:personium-core,代码行数:18,代码来源:CellResource.java

示例3: propfind

/**
 * 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(Reader requestBodyXml,
        @HeaderParam(PersoniumCoreUtils.HttpHeaders.DEPTH) String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) Long contentLength,
        @HeaderParam("Transfer-Encoding") String transferEncoding) {
    // Access Control
    cellSnapshotCellRsCmp.checkAccessContext(cellSnapshotCellRsCmp.getAccessContext(), CellPrivilege.ROOT);
    return cellSnapshotCellRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            CellPrivilege.ROOT);
}
 
开发者ID:personium,项目名称:personium-core,代码行数:18,代码来源:CellSnapshotResource.java

示例4: propfind

/**
 * 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(PersoniumCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {
    // Access Control
    this.davRsCmp.checkAccessContext(this.davRsCmp.getAccessContext(), BoxPrivilege.READ_PROPERTIES);
    return this.davRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            BoxPrivilege.READ_ACL);
}
 
开发者ID:personium,项目名称:personium-core,代码行数:18,代码来源:DavFileResource.java

示例5: propfind

/**
 * @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(PersoniumCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {
    // Access Control
    this.davRsCmp.checkAccessContext(this.davRsCmp.getAccessContext(), BoxPrivilege.READ_PROPERTIES);
    return this.davRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            BoxPrivilege.READ_ACL);
}
 
开发者ID:personium,项目名称:personium-core,代码行数:17,代码来源:PersoniumEngineSourceCollection.java

示例6: propfind

/**
 * 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(PersoniumCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {
    // Access Control
    this.davRsCmp.checkAccessContext(this.davRsCmp.getAccessContext(), BoxPrivilege.READ_PROPERTIES);
    return this.davRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            BoxPrivilege.READ_ACL);

}
 
开发者ID:personium,项目名称:personium-core,代码行数:19,代码来源:ODataSvcCollectionResource.java

示例7: 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(PersoniumCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {
    // Access Control
    this.davRsCmp.checkAccessContext(this.davRsCmp.getAccessContext(), BoxPrivilege.READ_PROPERTIES);
    return this.davRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            BoxPrivilege.READ_ACL);

}
 
开发者ID:personium,项目名称:personium-core,代码行数:18,代码来源:DavCollectionResource.java

示例8: propfind

/**
 * 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(PersoniumCoreUtils.HttpHeaders.DEPTH) final String depth,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
        @HeaderParam("Transfer-Encoding") final String transferEncoding) {
    // Access Control
    this.boxRsCmp.checkAccessContext(this.getAccessContext(), BoxPrivilege.READ_PROPERTIES);
    return this.boxRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
            BoxPrivilege.READ_ACL);
}
 
开发者ID:personium,项目名称:personium-core,代码行数:18,代码来源:BoxResource.java

示例9: mkcol

/**
 * MKCOLメソッドの処理. boxインストールを行う.
 * @param uriInfo UriInfo
 * @param pCredHeader dcCredHeader
 * @param contentType Content-Typeヘッダの値
 * @param contentLength Content-Lengthヘッダの値
 * @param requestKey イベントログに出力するRequestKeyフィールドの値
 * @param inStream HttpリクエストのInputStream
 * @return JAX-RS Response
 */
@WriteAPI
@WebDAVMethod.MKCOL
public Response mkcol(
        @Context final UriInfo uriInfo,
        @HeaderParam(PersoniumCoreUtils.HttpHeaders.X_PERSONIUM_CREDENTIAL) final String pCredHeader,
        @HeaderParam(HttpHeaders.CONTENT_TYPE) final String contentType,
        @HeaderParam(HttpHeaders.CONTENT_LENGTH) final String contentLength,
        @HeaderParam(PersoniumCoreUtils.HttpHeaders.X_PERSONIUM_REQUESTKEY) String requestKey,
        final InputStream inStream) {

    PersoniumEventBus eventBus = new PersoniumEventBus(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-Personium-RequestKeyの解析(指定なしの場合にデフォルト値を補充)
        requestKey = EventResource.validateXPersoniumRequestKey(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 PersoniumCoreException.Misc.METHOD_NOT_ALLOWED;
        }

        // Boxを作成するためにCellCtlResource、ODataEntityResource(ODataProducer)が必要
        // この時点では "X-Personium-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-Personium-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 PersoniumCoreException) {
            event.setResult(Integer.toString(((PersoniumCoreException) e).getStatus()));
            if (((PersoniumCoreException) e).getStatus() < HttpStatus.SC_INTERNAL_SERVER_ERROR) {
                event.setLevel(LEVEL.INFO);
            } 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;
}
 
开发者ID:personium,项目名称:personium-core,代码行数:78,代码来源:BoxResource.java


注:本文中的javax.ws.rs.core.HttpHeaders.CONTENT_LENGTH属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。