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

The following examples show how to use javax.ws.rs.core.HttpHeaders#LOCATION . 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: SAML2IdPMetadataService.java    From syncope with Apache License 2.0 6 votes vote down vote up
/**
 * Store the metadata and keys to finalize the metadata generation process.
 *
 * @param saml2IdPMetadataTO SAML2IdPMetadata to be created
 * @return Response object featuring Location header of created SAML 2.0 IdP metadata
 */
@ApiResponses({
    @ApiResponse(responseCode = "201",
            description = "SAML2IdPMetadata successfully created", headers = {
                @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                        @Schema(type = "string"),
                        description = "UUID generated for the entity created"),
                @Header(name = HttpHeaders.LOCATION, schema =
                        @Schema(type = "string"),
                        description = "URL of the entity created") }),
    @ApiResponse(responseCode = "409",
            description = "Metadata already existing") })
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response set(@NotNull SAML2IdPMetadataTO saml2IdPMetadataTO);
 
Example 2
Source File: SAML2SPMetadataService.java    From syncope with Apache License 2.0 6 votes vote down vote up
/**
 * Store the metadata to finalize the metadata generation process.
 *
 * @param metadataTO SAML2SPMetadataTO to be created
 * @return Response object featuring Location header of created SAML 2.0 SP metadata
 */
@ApiResponses({
    @ApiResponse(responseCode = "201",
        description = "SAML2SPMetadata successfully created", headers = {
        @Header(name = RESTHeaders.RESOURCE_KEY, schema =
        @Schema(type = "string"),
            description = "UUID generated for the entity created"),
        @Header(name = HttpHeaders.LOCATION, schema =
        @Schema(type = "string"),
            description = "URL of the entity created") }),
    @ApiResponse(responseCode = "409",
        description = "Metadata already existing") })
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response set(@NotNull SAML2SPMetadataTO metadataTO);
 
Example 3
Source File: SAML2SPKeystoreService.java    From syncope with Apache License 2.0 6 votes vote down vote up
/**
 * Store the keystore to finalize the keystore generation process.
 *
 * @param keystoreTO SAML2SPMetadataKeystoreTO to be created
 * @return Response object featuring Location header of created SAML 2.0 SP keystore
 */
@ApiResponses({
    @ApiResponse(responseCode = "201",
        description = "SAML2SPKeystoreTO successfully created", headers = {
        @Header(name = RESTHeaders.RESOURCE_KEY, schema =
        @Schema(type = "string"),
            description = "UUID generated for the entity created"),
        @Header(name = HttpHeaders.LOCATION, schema =
        @Schema(type = "string"),
            description = "URL of the entity created") }),
    @ApiResponse(responseCode = "409",
        description = "Metadata already existing") })
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response set(@NotNull SAML2SPKeystoreTO keystoreTO);
 
Example 4
Source File: UserSelfService.java    From syncope with Apache License 2.0 6 votes vote down vote up
/**
 * Self-registration for new user.
 *
 * @param createReq user to be created
 * @return Response object featuring Location header of self-registered user as well as the user itself
 * 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" }))
@ApiResponses(
        @ApiResponse(responseCode = "201",
                description = "User successfully created enriched with propagation status information, as Entity,"
                + "or empty if 'Prefer: return-no-content' was specified",
                content =
                @Content(schema =
                        @Schema(implementation = ProvisioningResult.class)), headers = {
            @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                    @Schema(type = "string"),
                    description = "UUID generated for the user created"),
            @Header(name = HttpHeaders.LOCATION, schema =
                    @Schema(type = "string"),
                    description = "URL of the user created"),
            @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") }))
@POST
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response create(@NotNull UserCR createReq);
 
Example 5
Source File: SyncopeService.java    From syncope with Apache License 2.0 6 votes vote down vote up
/**
 * Requests for batch execution.
 *
 * @param input batch request
 * @return batch results returned as Response entity, in case no 'Prefer: respond-async' was specified
 */
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference to process the batch request asynchronously",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "", allowableValues = { "respond-async" }))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "Batch request processed, results returned as Response entity, "
            + "in case no 'Prefer: respond-async' was specified"),
    @ApiResponse(responseCode = "202",
            description = "Batch accepted for asynchronous processing, "
            + "in case 'Prefer: respond-async' was specified", headers = {
                @Header(name = HttpHeaders.LOCATION, schema =
                        @Schema(type = "string"),
                        description = "URL to poll in order to get the results of the requested batch processing"),
                @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") }) })
@POST
@Path("/batch")
@Consumes(RESTHeaders.MULTIPART_MIXED)
@Produces(RESTHeaders.MULTIPART_MIXED)
Response batch(InputStream input);
 
Example 6
Source File: SRARouteService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new route.
 *
 * @param routeTO route to be created
 * @return Response object featuring Location header of created route
 */
@ApiResponses(
        @ApiResponse(responseCode = "201",
                description = "Route successfully created", headers = {
            @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                    @Schema(type = "string"),
                    description = "UUID generated for the entity created"),
            @Header(name = HttpHeaders.LOCATION, schema =
                    @Schema(type = "string"),
                    description = "URL of the entity created") }))
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response create(@NotNull SRARouteTO routeTO);
 
Example 7
Source File: RelationshipTypeService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new relationshipType.
 *
 * @param relationshipTypeTO relationshipType to be created
 * @return Response object featuring Location header of created relationshipType
 */
@ApiResponses(
        @ApiResponse(responseCode = "201",
                description = "RelationshipType successfully created", headers = {
            @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                    @Schema(type = "string"),
                    description = "Key value for the entity created"),
            @Header(name = HttpHeaders.LOCATION, schema =
                    @Schema(type = "string"),
                    description = "URL of the entity created") }))
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response create(@NotNull RelationshipTypeTO relationshipTypeTO);
 
Example 8
Source File: RoleService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new role.
 *
 * @param roleTO role to be created
 * @return Response object featuring Location header of created role
 */
@ApiResponses(
        @ApiResponse(responseCode = "201",
                description = "Role successfully created", headers = {
            @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                    @Schema(type = "string"),
                    description = "Key value for the entity created"),
            @Header(name = HttpHeaders.LOCATION, schema =
                    @Schema(type = "string"),
                    description = "URL of the entity created") }))
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response create(@NotNull RoleTO roleTO);
 
Example 9
Source File: RealmService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new realm under the given path.
 *
 * @param parentPath full path of the parent realm
 * @param realmTO new realm
 * @return Response object featuring Location header of created realm as well as the realm itself
 * 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 = 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 = "201",
                description = "Realm successfully created enriched with propagation status information, as Entity,"
                + "or empty if 'Prefer: return-no-content' was specified",
                content =
                @Content(schema =
                        @Schema(implementation = ProvisioningResult.class)), headers = {
            @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                    @Schema(type = "string"),
                    description = "UUID generated for the realm created"),
            @Header(name = HttpHeaders.LOCATION, schema =
                    @Schema(type = "string"),
                    description = "URL of the realm created"),
            @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") }))
@POST
@Path("{parentPath:.*}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response create(@NotNull @PathParam("parentPath") String parentPath, @NotNull RealmTO realmTO);
 
Example 10
Source File: AuthModuleService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new authentication module.
 *
 * @param authModuleTO AuthModule to be created.
 * @return Response object featuring Location header of created authentication module
 */
@ApiResponses(
        @ApiResponse(responseCode = "201",
                description = "AuthModule successfully created", headers = {
            @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                    @Schema(type = "string"),
                    description = "UUID generated for the entity created"),
            @Header(name = HttpHeaders.LOCATION, schema =
                    @Schema(type = "string"),
                    description = "URL of the entity created") }))
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response create(@NotNull AuthModuleTO authModuleTO);
 
Example 11
Source File: SecurityQuestionService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new security question.
 *
 * @param securityQuestionTO security question to be created
 * @return Response object featuring Location header of created security question
 */
@ApiResponses(
        @ApiResponse(responseCode = "201",
                description = "SecurityQuestion successfully created", headers = {
            @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                    @Schema(type = "string"),
                    description = "UUID generated for the entity created"),
            @Header(name = HttpHeaders.LOCATION, schema =
                    @Schema(type = "string"),
                    description = "URL of the entity created") }))
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response create(@NotNull SecurityQuestionTO securityQuestionTO);
 
Example 12
Source File: AnyTypeService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new anyType.
 *
 * @param anyTypeTO anyType to be created
 * @return Response object featuring Location header of created anyType
 */
@ApiResponses(
        @ApiResponse(responseCode = "201",
                description = "AnyType successfully created", headers = {
            @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                    @Schema(type = "string"),
                    description = "Key value for the entity created"),
            @Header(name = HttpHeaders.LOCATION, schema =
                    @Schema(type = "string"),
                    description = "URL of the entity created") }))
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response create(@NotNull AnyTypeTO anyTypeTO);
 
Example 13
Source File: NotificationService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new notification.
 *
 * @param notificationTO Creates a new notification.
 * @return Response object featuring Location header of created notification
 */
@ApiResponses(
        @ApiResponse(responseCode = "201",
                description = "Notification successfully created", headers = {
            @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                    @Schema(type = "string"),
                    description = "UUID generated for the entity created"),
            @Header(name = HttpHeaders.LOCATION, schema =
                    @Schema(type = "string"),
                    description = "URL of the entity created") }))
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response create(@NotNull NotificationTO notificationTO);
 
Example 14
Source File: ReportService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new report.
 *
 * @param reportTO report to be created
 * @return Response object featuring Location header of created report
 */
@ApiResponses(
        @ApiResponse(responseCode = "201",
                description = "Report successfully created", headers = {
            @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                    @Schema(type = "string"),
                    description = "UUID generated for the entity created"),
            @Header(name = HttpHeaders.LOCATION, schema =
                    @Schema(type = "string"),
                    description = "URL of the entity created") }))
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response create(@NotNull ReportTO reportTO);
 
Example 15
Source File: OIDCProviderService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new OIDC Provider.
 *
 * @param oidcProviderTO OpenID Connect Provider configuration to be stored
 * @return Response object featuring Location header of created OIDC Provider
 */
@ApiResponses(
        @ApiResponse(responseCode = "201",
                description = "OIDC Provider successfully created", headers = {
            @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                    @Schema(type = "string"),
                    description = "Key value for the entity created"),
            @Header(name = HttpHeaders.LOCATION, schema =
                    @Schema(type = "string"),
                    description = "URL of the entity created") }))
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response create(OIDCProviderTO oidcProviderTO);
 
Example 16
Source File: DynRealmService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new dynamic realm.
 *
 * @param dynDynRealmTO dynamic realm to be created
 * @return Response object featuring Location header of created dynamic realm
 */
@ApiResponses(
        @ApiResponse(responseCode = "201",
                description = "DynRealm successfully created", headers = {
            @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                    @Schema(type = "string"),
                    description = "Key value for the entity created"),
            @Header(name = HttpHeaders.LOCATION, schema =
                    @Schema(type = "string"),
                    description = "URL of the entity created") }))
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response create(@NotNull DynRealmTO dynDynRealmTO);
 
Example 17
Source File: ResourceService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new resource.
 *
 * @param resourceTO Resource to be created
 * @return Response object featuring Location header of created resource
 */
@ApiResponses(
        @ApiResponse(responseCode = "201",
                description = "Resource successfully created", headers = {
            @Header(name = RESTHeaders.RESOURCE_KEY, schema =
                    @Schema(type = "string"),
                    description = "Key value for the entity created"),
            @Header(name = HttpHeaders.LOCATION, schema =
                    @Schema(type = "string"),
                    description = "URL of the entity created") }))
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response create(@NotNull ResourceTO resourceTO);
 
Example 18
Source File: MCRRestDerivates.java    From mycore with GNU General Public License v3.0 5 votes vote down vote up
@POST
@Operation(
    summary = "Adds a new derivate (with defaults for 'display-enabled', 'main-doc', 'label') in the given object",
    responses = @ApiResponse(responseCode = "201",
        headers = @Header(name = HttpHeaders.LOCATION, description = "URL of the new derivate")),
    tags = MCRRestUtils.TAG_MYCORE_DERIVATE)
@MCRRequireTransaction
@MCRAccessControlExposeHeaders(HttpHeaders.LOCATION)
public Response createDefaultDerivate() {
    return doCreateDerivate(new DerivateMetadata());
}
 
Example 19
Source File: MCRRestAPIObjects.java    From mycore with GNU General Public License v3.0 3 votes vote down vote up
/**
 * create / update a MyCoRe object
 *  
 * @param info - the injected Jersey URIInfo object
 * @param request - the injected HTTPServletRequest object
 *
 * @param uploadedInputStream - the MyCoRe Object (XML) as inputstream from HTTP Post
 * @param fileDetails - file metadata from HTTP Post
 * 
 * @return a Jersey Response object
 * @throws MCRRestAPIException
 * 
 */
@POST
@Produces({ MediaType.TEXT_XML + ";charset=UTF-8" })
@Consumes(MediaType.MULTIPART_FORM_DATA)
@MCRRequireTransaction
@MCRAccessControlExposeHeaders(HttpHeaders.LOCATION)
public Response uploadObject(@Context UriInfo info, @Context HttpServletRequest request,
    @FormDataParam("file") InputStream uploadedInputStream,
    @FormDataParam("file") FormDataContentDisposition fileDetails) throws MCRRestAPIException {
    return MCRRestAPIUploadHelper.uploadObject(info, request, uploadedInputStream, fileDetails);
}
 
Example 20
Source File: MCRRestAPIObjects.java    From mycore with GNU General Public License v3.0 3 votes vote down vote up
/**
 * create a new (empty) MyCoRe derivate or returns one that already exists (by label)
 *  
 * @param info - the injected Jersey URIInfo object
 * @param request - the injected HTTPServletRequest object
 * 
 * @param mcrObjID - a MyCoRe Object ID
 * 
 * @param label - the label of the new derivate
 * @param overwrite - if true, return an existing derivate (with same label)
 * 
 * @return a Jersey Response object
 * @throws MCRRestAPIException
 * 
 */

@POST
@Path("/{" + PARAM_MCRID + "}/derivates")
@Produces({ MediaType.TEXT_XML + ";charset=UTF-8" })
@Consumes(MediaType.MULTIPART_FORM_DATA)
@MCRRequireTransaction
@MCRAccessControlExposeHeaders(HttpHeaders.LOCATION)
public Response uploadDerivate(@Context UriInfo info, @Context HttpServletRequest request,
    @PathParam(PARAM_MCRID) String mcrObjID, @FormDataParam("label") String label,
    @FormDataParam("classifications") String classifications,
    @FormDataParam("overwriteOnExistingLabel") @DefaultValue("false") boolean overwrite)
    throws MCRRestAPIException {
    return MCRRestAPIUploadHelper.uploadDerivate(info, request, mcrObjID, label, classifications, overwrite);
}