Class Response
java.lang.Object
org.ocpsoft.rewrite.config.DefaultOperationBuilder
org.ocpsoft.rewrite.servlet.config.HttpOperation
org.ocpsoft.rewrite.servlet.config.Response
- All Implemented Interfaces:
Operation,OperationBuilder
Responsible for manipulating properties such as headers, cookies,
ResponseContentInterceptor and
ResponseStreamWrapper instances to the current HttpServletResponse- Author:
- Lincoln Baxter, III
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OperationBuilderstatic OperationBuilderaddDateHeader(String name, long value) Create anOperationthat adds a date header to theHttpServletResponsestatic OperationBuilderCreate anOperationthat adds a header to theHttpServletResponsestatic OperationBuilderaddIntHeader(String name, int value) static OperationBuildercomplete()Create anOperationthat halts furtherRewriteprocessing and completes the currentHttpServletResponse.static OperationBuilderCompress theServletOutputStreamcontents written to the client.static OperationBuilderCompress theServletOutputStreamcontents written to the client.static ConditionBuilderCreate aConditionthat evaluates the status ofServletResponse.isCommitted().static OperationBuildersetContentType(String contentType) Create anOperationthat sets the content type for theHttpServletResponsestatic OperationBuildersetStatus(int status) Create anOperationthat sets the given status code viaHttpServletResponse.setStatus(int).static OperationBuilderwithOutputInterceptedBy(ResponseContentInterceptor... buffers) Create anOperationthat adds the givenResponseContentInterceptorinstances to the currentServletResponse.static OperationBuilderwithOutputStreamWrappedBy(ResponseStreamWrapper... wrappers) Create anOperationthat adds the givenResponseStreamWrapperinstances to the currentServletResponse.static OperationBuilderwrite(byte... bytes) Create anOperationthat writes the given bytes to the currentHttpServletResponseupon execution.static OperationBuilderwrite(InputStream stream) Create anOperationthat writes the contents of the givenInputStreamcurrentHttpServletResponseupon execution.static OperationBuilderCreate anOperationthat writes theStringvalue of the givenObjectto the currentHttpServletResponseupon execution.Methods inherited from class org.ocpsoft.rewrite.servlet.config.HttpOperation
perform, performHttpMethods inherited from class org.ocpsoft.rewrite.config.DefaultOperationBuilder
and
-
Constructor Details
-
Response
public Response()
-
-
Method Details
-
withOutputInterceptedBy
public static OperationBuilder withOutputInterceptedBy(ResponseContentInterceptor... buffers) throws IllegalStateException Create anOperationthat adds the givenResponseContentInterceptorinstances to the currentServletResponse. This will activate response buffering on the currentServletRequest- meaning that generated output will not be sent to the client until the entire request has completed and all registeredResponseContentInterceptorinstances have been executed on the outbound response content.WARNING: This will cause the ENTIRE response to be buffered in memory, which may cause performance issues on larger responses. Make sure you you really need to buffer the entire response! Favor using a
ResponseStreamWrapperif desired behavior may be performed as a stream operation; this will result in far less memory overhead.- Throws:
IllegalStateException- When output has already been written to the client.
-
withOutputStreamWrappedBy
public static OperationBuilder withOutputStreamWrappedBy(ResponseStreamWrapper... wrappers) throws IllegalStateException Create anOperationthat adds the givenResponseStreamWrapperinstances to the currentServletResponse. This will activate response stream wrapping on the currentServletRequest- meaning response content will be piped through all registeredResponseStreamWrapperinstances as it is written to the clientServletOutputStream.- Throws:
IllegalStateException- When output has already been written to the client.
-
addHeader
Create anOperationthat adds a header to theHttpServletResponse -
addDateHeader
Create anOperationthat adds a date header to theHttpServletResponse -
setContentType
Create anOperationthat sets the content type for theHttpServletResponse -
addIntHeader
-
addCookie
-
gzipCompression
Compress theServletOutputStreamcontents written to the client.WARNING: This causes response content to be buffered in memory in order to properly count the response 'Content-Length'.
-
gzipStreamCompression
Compress theServletOutputStreamcontents written to the client.WARNING: This means that the HTTP response will not contain a 'Content-Length' header.
-
write
Create anOperationthat writes the given bytes to the currentHttpServletResponseupon execution. -
write
Create anOperationthat writes theStringvalue of the givenObjectto the currentHttpServletResponseupon execution. The value to be written is obtained usingObject.toString(). -
write
Create anOperationthat writes the contents of the givenInputStreamcurrentHttpServletResponseupon execution. -
setStatus
Create anOperationthat sets the given status code viaHttpServletResponse.setStatus(int). This does not callServletResponse.flushBuffer() -
complete
Create anOperationthat halts furtherRewriteprocessing and completes the currentHttpServletResponse. -
isCommitted
Create aConditionthat evaluates the status ofServletResponse.isCommitted().
-