/** * Creates a new {@link OperationRequest}. The given {@code headers} will be augmented * to ensure that they always include a {@code Content-Length} header if the request * has any content and a {@code Host} header. * @param uri the request's uri * @param method the request method * @param content the content of the request * @param headers the request's headers * @param parameters the request's parameters * @param parts the request's parts * @param cookies the request's cookies * @return the {@code OperationRequest} */ public OperationRequest create(URI uri, HttpMethod method, byte[] content, HttpHeaders headers, Parameters parameters, Collection<OperationRequestPart> parts, Collection<RequestCookie> cookies) { return new StandardOperationRequest(uri, method, content, augmentHeaders(headers, uri, content), parameters, parts, cookies); }
/** * Creates a new {@code OperationRequest} based on the given {@code original} but with * the given {@code newHeaders}. * @param original the original request * @param newHeaders the new headers * @return the new request with the new headers */ public OperationRequest createFrom(OperationRequest original, HttpHeaders newHeaders) { return new StandardOperationRequest(original.getUri(), original.getMethod(), original.getContent(), newHeaders, original.getParameters(), original.getParts(), original.getCookies()); }
/** * Creates a new {@code OperationRequest} based on the given {@code original} but with * the given {@code newParameters}. * @param original the original request * @param newParameters the new parameters * @return the new request with the new parameters */ public OperationRequest createFrom(OperationRequest original, Parameters newParameters) { return new StandardOperationRequest(original.getUri(), original.getMethod(), original.getContent(), original.getHeaders(), newParameters, original.getParts(), original.getCookies()); }
/** * Creates a new {@code OperationRequest} based on the given {@code original} but with * the given {@code newContent}. If the original request had a {@code Content-Length} * header it will be modified to match the length of the new content. * @param original the original request * @param newContent the new content * @return the new request with the new content */ public OperationRequest createFrom(OperationRequest original, byte[] newContent) { return new StandardOperationRequest(original.getUri(), original.getMethod(), newContent, getUpdatedHeaders(original.getHeaders(), newContent), original.getParameters(), original.getParts(), original.getCookies()); }