001/* 002 * Copyright 2012-2016 UnboundID Corp. 003 * 004 * This program is free software; you can redistribute it and/or modify 005 * it under the terms of the GNU General Public License (GPLv2 only) 006 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 007 * as published by the Free Software Foundation. 008 * 009 * This program is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 * GNU General Public License for more details. 013 * 014 * You should have received a copy of the GNU General Public License 015 * along with this program; if not, see <http://www.gnu.org/licenses>. 016 */ 017 018package com.unboundid.scim.wink; 019 020import com.unboundid.scim.sdk.OAuthTokenHandler; 021 022import javax.servlet.http.HttpServletRequest; 023import javax.ws.rs.Consumes; 024import javax.ws.rs.POST; 025import javax.ws.rs.Path; 026import javax.ws.rs.Produces; 027import javax.ws.rs.core.Context; 028import javax.ws.rs.core.HttpHeaders; 029import javax.ws.rs.core.MediaType; 030import javax.ws.rs.core.Response; 031import javax.ws.rs.core.SecurityContext; 032import javax.ws.rs.core.UriInfo; 033import java.io.InputStream; 034 035 036 037/** 038 * This class is a JAX-RS resource for the Bulk operation, where XML 039 * content type is specified in the URL path. 040 */ 041@Path("Bulk.xml") 042public class XMLBulkResource extends AbstractBulkResource 043{ 044 /** 045 * Create a new instance of the bulk resource. 046 * 047 * @param application The SCIM JAX-RS application associated with this 048 * resource. 049 * @param tokenHandler The token handler to use for OAuth 050 * authentication. 051 */ 052 public XMLBulkResource(final SCIMApplication application, 053 final OAuthTokenHandler tokenHandler) 054 { 055 super(application, tokenHandler); 056 } 057 058 059 060 /** 061 * Implement the POST operation consuming and producing XML format. 062 * 063 * @param inputStream The content to be consumed. 064 * @param request The HTTP servlet request. 065 * @param securityContext The security context for the request. 066 * @param headers The request headers. 067 * @param uriInfo The URI info for the request. 068 * 069 * @return The response to the request. 070 */ 071 @POST 072 @Consumes(MediaType.APPLICATION_XML) 073 @Produces(MediaType.APPLICATION_XML) 074 public Response doXmlXmlPost(final InputStream inputStream, 075 @Context final HttpServletRequest request, 076 @Context final SecurityContext securityContext, 077 @Context final HttpHeaders headers, 078 @Context final UriInfo uriInfo) 079 { 080 final RequestContext requestContext = 081 new RequestContext(request, securityContext, headers, uriInfo, 082 MediaType.APPLICATION_XML_TYPE, 083 MediaType.APPLICATION_XML_TYPE); 084 return postBulk(requestContext, inputStream); 085 } 086}