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


Java HttpHeaders.IF_MATCH属性代码示例

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


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

示例1: delete

/**
 * process DELETE Method and delete this resource.
 * @param ifMatch If-Match header
 * @return JAX-RS response object
 */
@WriteAPI
@DELETE
public Response delete(@HeaderParam(HttpHeaders.IF_MATCH) final String ifMatch) {
    // Check exist
    checkFileExists();
    // Access Control
    davRsCmp.getParent().checkAccessContext(davRsCmp.getAccessContext(), CellPrivilege.ROOT);
    ResponseBuilder rb = davRsCmp.getDavCmp().delete(ifMatch, false);
    return rb.build();
}
 
开发者ID:personium,项目名称:personium-core,代码行数:15,代码来源:CellSnapshotDavFileResource.java

示例2: put

/**
 * process PUT Method and update the file.
 * @param contentType Content-Type Header
 * @param ifMatch If-Match Header
 * @param inputStream Request Body
 * @return JAX-RS response object
 */
@WriteAPI
@PUT
public Response put(@HeaderParam(HttpHeaders.CONTENT_TYPE) final String contentType,
        @HeaderParam(HttpHeaders.IF_MATCH) final String ifMatch,
        final InputStream inputStream) {
    // Access Control
    this.davRsCmp.checkAccessContext(this.davRsCmp.getAccessContext(), BoxPrivilege.WRITE);

    ResponseBuilder rb = this.davRsCmp.getDavCmp().putForUpdate(contentType, inputStream, ifMatch);
    return rb.build();
}
 
开发者ID:personium,项目名称:personium-core,代码行数:18,代码来源:DavFileResource.java

示例3: delete

/**
 * process DELETE Method and delete this resource.
 * @param ifMatch If-Match header
 * @return JAX-RS response object
 */
@WriteAPI
@DELETE
public Response delete(@HeaderParam(HttpHeaders.IF_MATCH) final String ifMatch) {
    // Access Control
    // DavFileResourceは必ず親(最上位はBox)を持つため、this.davRsCmp.getParent()の結果がnullになることはない
    this.davRsCmp.getParent().checkAccessContext(this.davRsCmp.getAccessContext(), BoxPrivilege.WRITE);

    ResponseBuilder rb = this.davRsCmp.getDavCmp().delete(ifMatch, false);
    return rb.build();
}
 
开发者ID:personium,项目名称:personium-core,代码行数:15,代码来源:DavFileResource.java

示例4: merge

/**
 * MERGE メソッドの処理.
 * @param reader リクエストボディ
 * @param accept Accept ヘッダ
 * @param ifMatch If-Match ヘッダ
 * @return JAX-RSResponse
 */
public Response merge(Reader reader,
        @HeaderParam(HttpHeaders.ACCEPT) final String accept,
        @HeaderParam(HttpHeaders.IF_MATCH) final String ifMatch) {
    // メソッド実行可否チェック
    checkNotAllowedMethod();

    // アクセス制御
    this.odataResource.checkAccessContext(this.accessContext,
            this.odataResource.getNecessaryWritePrivilege(getEntitySetName()));

    // リクエストからOEntityWrapperを作成する.
    OEntity oe = this.createRequestEntity(reader, this.oEntityKey);
    OEntityWrapper oew = new OEntityWrapper(null, oe, null);

    // 必要ならばメタ情報をつける処理
    this.odataResource.beforeMerge(oew, this.oEntityKey);

    // If-Matchヘッダで入力されたETagをMVCC用での衝突検知用にOEntityWrapperに設定する。
    String etag = ODataResource.parseEtagHeader(ifMatch);
    oew.setEtag(etag);

    // MERGE処理をODataProducerに依頼。
    // こちらでリソースの存在確認もしてもらう。
    getOdataProducer().mergeEntity(getEntitySetName(), this.oEntityKey, oew);

    // 特に例外があがらなければ、レスポンスを返す。
    // oewに新たに登録されたETagを返す
    etag = oew.getEtag();
    return Response.noContent()
            .header(HttpHeaders.ETAG, ODataResource.renderEtagHeader(etag))
            .header(ODataConstants.Headers.DATA_SERVICE_VERSION, ODataVersion.V2.asString)
            .build();

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

示例5: put

/**
 * PUT メソッドの処理.
 * @param reader リクエストボディ
 * @param accept Accept ヘッダ
 * @param ifMatch If-Match ヘッダ
 * @return JAX-RSResponse
 */
@WriteAPI
@PUT
public Response put(Reader reader,
        @HeaderParam(HttpHeaders.ACCEPT) final String accept,
        @HeaderParam(HttpHeaders.IF_MATCH) final String ifMatch) {

    // メソッド実行可否チェック
    checkNotAllowedMethod();

    // アクセス制御
    this.odataResource.checkAccessContext(this.accessContext,
            this.odataResource.getNecessaryWritePrivilege(getEntitySetName()));

    String etag;

    // リクエストの更新をProducerに依頼
    OEntityWrapper oew = updateEntity(reader, ifMatch);

    // 特に例外があがらなければ、レスポンスを返す。
    // oewに新たに登録されたETagを返す
    etag = oew.getEtag();
    return Response.noContent()
            .header(HttpHeaders.ETAG, ODataResource.renderEtagHeader(etag))
            .header(ODataConstants.Headers.DATA_SERVICE_VERSION, ODataVersion.V2.asString)
            .build();
}
 
开发者ID:personium,项目名称:personium-core,代码行数:33,代码来源:ODataEntityResource.java

示例6: merge

/**
 * MERGE メソッドの処理.
 * @param reader リクエストボディ
 * @param accept Accept ヘッダ
 * @param ifMatch If-Match ヘッダ
 * @return JAX-RSResponse
 */
@WriteAPI
@MERGE
public Response merge(Reader reader,
        @HeaderParam(HttpHeaders.ACCEPT) final String accept,
        @HeaderParam(HttpHeaders.IF_MATCH) final String ifMatch) {
    ODataMergeResource oDataMergeResource = new ODataMergeResource(this.odataResource, this.getEntitySetName(),
            this.keyString);
    return oDataMergeResource.merge(reader, accept, ifMatch);
}
 
开发者ID:personium,项目名称:personium-core,代码行数:16,代码来源:ODataEntityResource.java

示例7: delete

/**
 * DELETEメソッドの処理.
 * @param accept Accept ヘッダ
 * @param ifMatch If-Match ヘッダ
 * @return JAX-RS Response
 */
@WriteAPI
@DELETE
public Response delete(
        @HeaderParam(HttpHeaders.ACCEPT) final String accept,
        @HeaderParam(HttpHeaders.IF_MATCH) final String ifMatch) {
    // アクセス制御
    this.odataResource.checkAccessContext(this.accessContext,
            this.odataResource.getNecessaryWritePrivilege(getEntitySetName()));

    deleteEntity(ifMatch);
    return Response.noContent().header(ODataConstants.Headers.DATA_SERVICE_VERSION, ODataVersion.V2.asString)
            .build();
}
 
开发者ID:personium,项目名称:personium-core,代码行数:19,代码来源:ODataEntityResource.java

示例8: put

/**
 * process PUT Method and update the file.
 * <p>
 * TODO Security considerations.
 * Implementing PUT makes it possible to perform Import with the snapshot file modified by the user.
 * Does malicious tampering with snapshot file cause problems?
 * It is necessary to carefully verify.
 *
 * @param contentType Content-Type Header
 * @param ifMatch If-Match Header
 * @param inputStream Request Body
 * @return JAX-RS response object
 */
@WriteAPI
@PUT
public Response put(@HeaderParam(HttpHeaders.CONTENT_TYPE) final String contentType,
        @HeaderParam(HttpHeaders.IF_MATCH) final String ifMatch,
        final InputStream inputStream) {
    // Access Control
    davRsCmp.getParent().checkAccessContext(davRsCmp.getAccessContext(), CellPrivilege.ROOT);

    ResponseBuilder rb = davRsCmp.getDavCmp().putForUpdate(contentType, inputStream, ifMatch);
    return rb.build();
}
 
开发者ID:personium,项目名称:personium-core,代码行数:24,代码来源:CellSnapshotDavFileResource.java


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