/** Initializes the options builder. */ public Builder() { options = new BatchOptions(); }
public List<BatchRequestPart> parseBatchRequest(final InputStream content, final String boundary, final BatchOptions options) throws BatchDeserializerException { this.options = options; BatchRequestTransformator transformator = new BatchRequestTransformator(options.getRawBaseUri(), options.getRawServiceResolutionUri()); return parse(content, boundary, transformator); }
@Override public void processBatch(final BatchFacade facade, final ODataRequest request, final ODataResponse response) throws ODataApplicationException, ODataLibraryException { final int handle = context.getDebugger().startRuntimeMeasurement(this, "processBatch"); final String boundary = facade.extractBoundaryFromContentType(request.getHeader(HttpHeader.CONTENT_TYPE)); final BatchOptions options = BatchOptions.with() .rawBaseUri(request.getRawBaseUri()) .rawServiceResolutionUri(request.getRawServiceResolutionUri()) .build(); final List<BatchRequestPart> requestParts = odata.createFixedFormatDeserializer() .parseBatchRequest(request.getBody(), boundary, options); final List<ODataResponsePart> responseParts = new ArrayList<>(); for (final BatchRequestPart part : requestParts) { responseParts.add(facade.handleBatchRequest(part)); } final String responseBoundary = "batch_" + UUID.randomUUID().toString(); final InputStream responseContent = odata.createFixedFormatSerializer().batchResponse(responseParts, responseBoundary); response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary=" + responseBoundary); response.setContent(responseContent); response.setStatusCode(HttpStatusCode.ACCEPTED.getStatusCode()); context.getDebugger().stopRuntimeMeasurement(handle); }
private List<BatchRequestPart> parseBatch(final InputStream in, final String boundary, final BatchRequestTransformator transformator) throws IOException, BatchDeserializerException { final List<BatchRequestPart> resultList = new LinkedList<BatchRequestPart>(); final List<List<Line>> bodyPartStrings = splitBodyParts(in, boundary); for (List<Line> bodyPartString : bodyPartStrings) { BatchBodyPart bodyPart = new BatchBodyPart(bodyPartString, boundary, options.isStrict()).parse(); resultList.addAll(transformator.transform(bodyPart)); } return resultList; }
final String boundary = extractBoundary(getRequestContentType()); final BatchOptions options = BatchOptions.with().rawBaseUri(request.getRawBaseUri()) .rawServiceResolutionUri(this.request.getRawServiceResolutionUri()).build();
private List<BatchRequestPart> parseBatch(final InputStream in, final String boundary, final BatchRequestTransformator transformator) throws IOException, BatchDeserializerException { final List<BatchRequestPart> resultList = new LinkedList<BatchRequestPart>(); final List<List<Line>> bodyPartStrings = splitBodyParts(in, boundary); for (List<Line> bodyPartString : bodyPartStrings) { BatchBodyPart bodyPart = new BatchBodyPart(bodyPartString, boundary, options.isStrict()).parse(); resultList.addAll(transformator.transform(bodyPart)); } return resultList; }
final String boundary = extractBoundary(getRequestContentType()); final BatchOptions options = BatchOptions.with().rawBaseUri(request.getRawBaseUri()) .rawServiceResolutionUri(this.request.getRawServiceResolutionUri()).build();
public List<BatchRequestPart> parseBatchRequest(final InputStream content, final String boundary, final BatchOptions options) throws BatchDeserializerException { this.options = options; BatchRequestTransformator transformator = new BatchRequestTransformator(options.getRawBaseUri(), options.getRawServiceResolutionUri()); return parse(content, boundary, transformator); }
/** Initializes the options builder. */ public Builder() { options = new BatchOptions(); }