/** * Creates a new {@link OperationResponse}. If the response has any content, the given * {@code headers} will be augmented to ensure that they include a * {@code Content-Length} header. * @param status the status of the response * @param headers the request's headers * @param content the content of the request * @return the {@code OperationResponse} */ public OperationResponse create(HttpStatus status, HttpHeaders headers, byte[] content) { return new StandardOperationResponse(status, augmentHeaders(headers, content), content); }
/** * Creates a new {@code OperationResponse} based on the given {@code original} but * with the given {@code newHeaders}. * @param original the original response * @param newHeaders the new headers * @return the new response with the new headers */ public OperationResponse createFrom(OperationResponse original, HttpHeaders newHeaders) { return new StandardOperationResponse(original.getStatus(), newHeaders, original.getContent()); }
/** * Creates a new {@code OperationResponse} based on the given {@code original} but * with the given {@code newContent}. If the original response had a * {@code Content-Length} header it will be modified to match the length of the new * content. * @param original the original response * @param newContent the new content * @return the new response with the new content */ public OperationResponse createFrom(OperationResponse original, byte[] newContent) { return new StandardOperationResponse(original.getStatus(), getUpdatedHeaders(original.getHeaders(), newContent), newContent); }