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

The following examples show how to use javax.ws.rs.core.HttpHeaders#IF_MATCH . 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: ODataEntityResource.java    From io with Apache License 2.0 6 votes vote down vote up
/**
 * PUT メソッドの処理.
 * @param reader リクエストボディ
 * @param accept Accept ヘッダ
 * @param ifMatch If-Match ヘッダ
 * @return JAX-RSResponse
 */
@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();
}
 
Example 2
Source File: DavFileResource.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * 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
 */
@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();
}
 
Example 3
Source File: DavFileResource.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * process DELETE Method and delete this resource.
 * @param ifMatch If-Match header
 * @return JAX-RS response object
 */
@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();
}
 
Example 4
Source File: ODataMergeResource.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * 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();

}
 
Example 5
Source File: ODataEntityResource.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * MERGE メソッドの処理.
 * @param reader リクエストボディ
 * @param accept Accept ヘッダ
 * @param ifMatch If-Match ヘッダ
 * @return JAX-RSResponse
 */
@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);
}
 
Example 6
Source File: ODataEntityResource.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * DELETEメソッドの処理.
 * @param accept Accept ヘッダ
 * @param ifMatch If-Match ヘッダ
 * @return JAX-RS Response
 */
@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();
}
 
Example 7
Source File: RemediationService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Perform remediation by updating the provided user, group or any object.
 *
 * @param remediationKey key for remediation to act on
 * @param updateReq user, group or any object to update
 * @return Response object featuring the updated object enriched with propagation status information
 */
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = HttpHeaders.IF_MATCH, in = ParameterIn.HEADER,
        description = "When the provided ETag value does not match the latest modification date of the entity, "
        + "an error is reported and the requested operation is not performed.",
        allowEmptyValue = true, schema =
        @Schema(type = "string"))
@Parameter(name = RESTHeaders.NULL_PRIORITY_ASYNC, in = ParameterIn.HEADER,
        description = "If 'true', instructs the propagation process not to wait for completion when communicating"
        + " with External Resources with no priority set",
        allowEmptyValue = true, schema =
        @Schema(type = "boolean", defaultValue = "false"))
@Parameter(name = "remediationKey", description = "Remediation's key", in = ParameterIn.PATH, schema =
        @Schema(type = "string"))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "Object successfully updated enriched with propagation status information, as Entity",
            content =
            @Content(schema =
                    @Schema(implementation = ProvisioningResult.class))),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")),
    @ApiResponse(responseCode = "412",
            description = "The ETag value provided via the 'If-Match' header does not match the latest modification"
            + " date of the entity") })
@PATCH
@Path("{remediationKey}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response remedy(@NotNull @PathParam("remediationKey") String remediationKey, @NotNull AnyUR updateReq);
 
Example 8
Source File: RemediationService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Perform remediation by deleting the provided user, group or any object.
 *
 * @param remediationKey key for remediation to act on
 * @param anyKey user's, group's or any object's key to delete
 * @return Response object featuring the deleted object enriched with propagation status information
 */
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = HttpHeaders.IF_MATCH, in = ParameterIn.HEADER,
        description = "When the provided ETag value does not match the latest modification date of the entity, "
        + "an error is reported and the requested operation is not performed.",
        allowEmptyValue = true, schema =
        @Schema(type = "string"))
@Parameter(name = RESTHeaders.NULL_PRIORITY_ASYNC, in = ParameterIn.HEADER,
        description = "If 'true', instructs the propagation process not to wait for completion when communicating"
        + " with External Resources with no priority set",
        allowEmptyValue = true, schema =
        @Schema(type = "boolean", defaultValue = "false"))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "Object successfully deleted enriched with propagation status information, as Entity",
            content =
            @Content(schema =
                    @Schema(implementation = ProvisioningResult.class))),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")),
    @ApiResponse(responseCode = "412",
            description = "The ETag value provided via the 'If-Match' header does not match the latest modification"
            + " date of the entity") })
@DELETE
@Path("{remediationKey}/{anyKey}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response remedy(
        @NotNull @PathParam("remediationKey") String remediationKey,
        @NotNull @PathParam("anyKey") String anyKey);
 
Example 9
Source File: GroupService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Updates group matching the provided key.
 *
 * @param updateReq modification to be applied to group matching the provided key
 * @return Response object featuring the updated group enriched with propagation status information
 */
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = HttpHeaders.IF_MATCH, in = ParameterIn.HEADER,
        description = "When the provided ETag value does not match the latest modification date of the entity, "
        + "an error is reported and the requested operation is not performed.",
        allowEmptyValue = true, schema =
        @Schema(type = "string"))
@Parameter(name = RESTHeaders.NULL_PRIORITY_ASYNC, in = ParameterIn.HEADER,
        description = "If 'true', instructs the propagation process not to wait for completion when communicating"
        + " with External Resources with no priority set",
        allowEmptyValue = true, schema =
        @Schema(type = "boolean", defaultValue = "false"))
@Parameter(name = "key", description = "Group's key", in = ParameterIn.PATH, schema =
        @Schema(type = "string"))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "Group successfully updated enriched with propagation status information, as Entity",
            content =
            @Content(schema =
                    @Schema(implementation = ProvisioningResult.class))),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")),
    @ApiResponse(responseCode = "412",
            description = "The ETag value provided via the 'If-Match' header does not match the latest modification"
            + " date of the entity") })
@PATCH
@Path("{key}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response update(@NotNull GroupUR updateReq);
 
Example 10
Source File: AnyObjectService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Updates any object matching the provided key.
 *
 * @param updateReq modification to be applied to any object matching the provided key
 * @return Response object featuring the updated any object enriched with propagation status information
 */
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = HttpHeaders.IF_MATCH, in = ParameterIn.HEADER,
        description = "When the provided ETag value does not match the latest modification date of the entity, "
        + "an error is reported and the requested operation is not performed.",
        allowEmptyValue = true, schema =
        @Schema(type = "string"))
@Parameter(name = RESTHeaders.NULL_PRIORITY_ASYNC, in = ParameterIn.HEADER,
        description = "If 'true', instructs the propagation process not to wait for completion when communicating"
        + " with External Resources with no priority set",
        allowEmptyValue = true, schema =
        @Schema(type = "boolean", defaultValue = "false"))
@Parameter(name = "key", description = "Any Object's key", in = ParameterIn.PATH, schema =
        @Schema(type = "string"))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "Any object successfully updated enriched with propagation status information, as Entity",
            content =
            @Content(schema =
                    @Schema(implementation = ProvisioningResult.class))),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")),
    @ApiResponse(responseCode = "412",
            description = "The ETag value provided via the 'If-Match' header does not match the latest modification"
            + " date of the entity") })
@PATCH
@Path("{key}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response update(@NotNull AnyObjectUR updateReq);
 
Example 11
Source File: AnyService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Deletes any object matching provided key.
 *
 * @param key any object key or name
 * @return Response object featuring the deleted any object enriched with propagation status information
 */
@Operation(operationId = "deleteAny")
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = HttpHeaders.IF_MATCH, in = ParameterIn.HEADER,
        description = "When the provided ETag value does not match the latest modification date of the entity, "
        + "an error is reported and the requested operation is not performed.",
        allowEmptyValue = true, schema =
        @Schema(type = "string"))
@Parameter(name = RESTHeaders.NULL_PRIORITY_ASYNC, in = ParameterIn.HEADER,
        description = "If 'true', instructs the propagation process not to wait for completion when communicating"
        + " with External Resources with no priority set",
        allowEmptyValue = true, schema =
        @Schema(type = "boolean", defaultValue = "false"))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "User, Group or Any Object successfully deleted enriched with propagation status "
            + "information, as Entity", content =
            @Content(schema =
                    @Schema(implementation = ProvisioningResult.class))),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")),
    @ApiResponse(responseCode = "412",
            description = "The ETag value provided via the 'If-Match' header does not match the latest modification"
            + " date of the entity") })
@DELETE
@Path("{key}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response delete(@NotNull @PathParam("key") String key);
 
Example 12
Source File: AnyService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Executes resource-related operations on given entity.
 *
 * @param req external resources to be used for propagation-related operations
 * @return batch results as Response entity
 */
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = HttpHeaders.IF_MATCH, in = ParameterIn.HEADER,
        description = "When the provided ETag value does not match the latest modification date of the entity, "
        + "an error is reported and the requested operation is not performed.",
        allowEmptyValue = true, schema =
        @Schema(type = "string"))
@Parameter(name = RESTHeaders.NULL_PRIORITY_ASYNC, in = ParameterIn.HEADER,
        description = "If 'true', instructs the propagation process not to wait for completion when communicating"
        + " with External Resources with no priority set",
        allowEmptyValue = true, schema =
        @Schema(type = "boolean", defaultValue = "false"))
@Parameter(name = "key", description = "Entity's key", in = ParameterIn.PATH, schema =
        @Schema(type = "string"))
@Parameter(name = "action", description = "Deassociation action", in = ParameterIn.PATH, schema =
        @Schema(implementation = ResourceDeassociationAction.class))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "Batch results available, returned as Response entity"),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")),
    @ApiResponse(responseCode = "412",
            description = "The ETag value provided via the 'If-Match' header does not match the latest modification"
            + " date of the entity") })
@POST
@Path("{key}/deassociate/{action}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces(RESTHeaders.MULTIPART_MIXED)
Response deassociate(@NotNull ResourceDR req);
 
Example 13
Source File: AnyService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Executes resource-related operations on given entity.
 *
 * @param req external resources to be used for propagation-related operations
 * @return batch results as Response entity
 */
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = HttpHeaders.IF_MATCH, in = ParameterIn.HEADER,
        description = "When the provided ETag value does not match the latest modification date of the entity, "
        + "an error is reported and the requested operation is not performed.",
        allowEmptyValue = true, schema =
        @Schema(type = "string"))
@Parameter(name = RESTHeaders.NULL_PRIORITY_ASYNC, in = ParameterIn.HEADER,
        description = "If 'true', instructs the propagation process not to wait for completion when communicating"
        + " with External Resources with no priority set",
        allowEmptyValue = true, schema =
        @Schema(type = "boolean", defaultValue = "false"))
@Parameter(name = "key", description = "Entity's key", in = ParameterIn.PATH, schema =
        @Schema(type = "string"))
@Parameter(name = "action", description = "Association action", in = ParameterIn.PATH, schema =
        @Schema(implementation = ResourceAssociationAction.class))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "Batch results available, returned as Response entity"),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")),
    @ApiResponse(responseCode = "412",
            description = "The ETag value provided via the 'If-Match' header does not match the latest modification"
            + " date of the entity") })
@POST
@Path("{key}/associate/{action}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces(RESTHeaders.MULTIPART_MIXED)
Response associate(@NotNull ResourceAR req);
 
Example 14
Source File: UserService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Updates user matching the provided key.
 *
 * @param updateReq modification to be applied to user matching the provided key
 * @return Response object featuring the updated user enriched with propagation status information
 */
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = HttpHeaders.IF_MATCH, in = ParameterIn.HEADER,
        description = "When the provided ETag value does not match the latest modification date of the entity, "
        + "an error is reported and the requested operation is not performed.",
        allowEmptyValue = true, schema =
        @Schema(type = "string"))
@Parameter(name = RESTHeaders.NULL_PRIORITY_ASYNC, in = ParameterIn.HEADER,
        description = "If 'true', instructs the propagation process not to wait for completion when communicating"
        + " with External Resources with no priority set",
        allowEmptyValue = true, schema =
        @Schema(type = "boolean", defaultValue = "false"))
@Parameter(name = "key", description = "User's key", in = ParameterIn.PATH, schema =
        @Schema(type = "string"))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "User successfully updated enriched with propagation status information, as Entity",
            content =
            @Content(schema =
                    @Schema(implementation = ProvisioningResult.class))),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")),
    @ApiResponse(responseCode = "412",
            description = "The ETag value provided via the 'If-Match' header does not match the latest modification"
            + " date of the entity") })
@PATCH
@Path("{key}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response update(@NotNull UserUR updateReq);
 
Example 15
Source File: UserService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Performs a status update on given user.
 *
 * @param updateReq status update details
 * @return Response object featuring the updated user enriched with propagation status information
 */
@Parameter(
        name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = HttpHeaders.IF_MATCH, in = ParameterIn.HEADER,
        description = "When the provided ETag value does not match the latest modification date of the entity, "
        + "an error is reported and the requested operation is not performed.",
        allowEmptyValue = true, schema =
        @Schema(type = "string"))
@Parameter(name = RESTHeaders.NULL_PRIORITY_ASYNC, in = ParameterIn.HEADER,
        description = "If 'true', instructs the propagation process not to wait for completion when communicating"
        + " with External Resources with no priority set",
        allowEmptyValue = true, schema =
        @Schema(type = "boolean", defaultValue = "false"))
@Parameter(name = "key", description = "User's key", in = ParameterIn.PATH, schema =
        @Schema(type = "string"))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "User successfully updated enriched with propagation status information, as Entity",
            content =
            @Content(schema =
                    @Schema(implementation = ProvisioningResult.class))),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")),
    @ApiResponse(responseCode = "412",
            description = "The ETag value provided via the 'If-Match' header does not match the latest modification"
            + " date of the entity") })
@POST
@Path("{key}/status")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response status(@NotNull StatusR updateReq);
 
Example 16
Source File: AbstractClient.java    From cxf with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Client match(EntityTag tag, boolean ifNot) {
    String hName = ifNot ? HttpHeaders.IF_NONE_MATCH : HttpHeaders.IF_MATCH;
    state.getRequestHeaders().putSingle(hName, tag.toString());
    return this;
}