com.unboundid.scim.wink.JSONBulkResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scim-sdk Show documentation
Show all versions of scim-sdk Show documentation
The UnboundID SCIM SDK is a library that may be used to interact with various
types of SCIM-enabled endpoints (such as the UnboundID server products) to
perform lightweight, cloud-based identity management via the SCIM Protocol.
See http://www.simplecloud.info for more information.
/*
* Copyright 2012-2016 UnboundID Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (GPLv2 only)
* or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see .
*/
package com.unboundid.scim.wink;
import com.unboundid.scim.sdk.OAuthTokenHandler;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.core.UriInfo;
import java.io.InputStream;
/**
* This class is a JAX-RS resource for the Bulk operation, where JSON
* content type is specified in the URL path.
*/
@Path("Bulk.json")
public class JSONBulkResource extends AbstractBulkResource
{
/**
* Create a new instance of the bulk resource.
*
* @param application The SCIM JAX-RS application associated with this
* resource.
* @param tokenHandler The token handler to use for OAuth
* authentication.
*/
public JSONBulkResource(final SCIMApplication application,
final OAuthTokenHandler tokenHandler)
{
super(application, tokenHandler);
}
/**
* Implement the POST operation consuming and producing JSON format.
*
* @param inputStream The content to be consumed.
* @param request The HTTP servlet request.
* @param securityContext The security context for the request.
* @param headers The request headers.
* @param uriInfo The URI info for the request.
*
* @return The response to the request.
*/
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response doJsonJsonPost(final InputStream inputStream,
@Context final HttpServletRequest request,
@Context final SecurityContext securityContext,
@Context final HttpHeaders headers,
@Context final UriInfo uriInfo)
{
final RequestContext requestContext =
new RequestContext(request, securityContext, headers, uriInfo,
MediaType.APPLICATION_JSON_TYPE,
MediaType.APPLICATION_JSON_TYPE);
return postBulk(requestContext, inputStream);
}
}