rewrite-config-servlet 2.0.0.Alpha2

org.ocpsoft.rewrite.servlet.config
Class Response

java.lang.Object
  extended by org.ocpsoft.rewrite.config.DefaultOperationBuilder
      extended by org.ocpsoft.rewrite.servlet.config.HttpOperation
          extended by org.ocpsoft.rewrite.servlet.config.Response
All Implemented Interfaces:
ConfigurationElement, Operation, OperationBuilder

public abstract class Response
extends HttpOperation

Responsible for adding various properties such as headers and cookies to the HttpServletResponse

Author:
Lincoln Baxter, III

Nested Class Summary
 
Nested classes/interfaces inherited from class org.ocpsoft.rewrite.config.DefaultOperationBuilder
DefaultOperationBuilder.NoOp
 
Constructor Summary
Response()
           
 
Method Summary
static Response addCookie(javax.servlet.http.Cookie cookie)
          Create an Operation that adds a Cookie to the HttpServletResponse
static Response addDateHeader(String name, long value)
          Create an Operation that adds a date header to the HttpServletResponse
static Response addHeader(String name, String value)
          Create an Operation that adds a header to the HttpServletResponse
static Response addIntHeader(String name, int value)
          Create an Operation that adds an int header to the HttpServletResponse
static Response setCode(int code)
           
 String toString()
           
static Response withOutputInterceptedBy(ResponseContentInterceptor... buffers)
          Add the given ResponseContentInterceptor instances to the current ServletResponse.
static Response withOutputStreamWrappedBy(ResponseStreamWrapper... wrappers)
           
 
Methods inherited from class org.ocpsoft.rewrite.servlet.config.HttpOperation
perform, performHttp
 
Methods inherited from class org.ocpsoft.rewrite.config.DefaultOperationBuilder
and, create, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Response

public Response()
Method Detail

withOutputInterceptedBy

public static Response withOutputInterceptedBy(ResponseContentInterceptor... buffers)
                                        throws IllegalStateException
Add the given ResponseContentInterceptor instances to the current ServletResponse. This will activate response buffering on the current ServletRequest - meaning that generated output will not be sent to the client until the entire request has completed and all registered ResponseContentInterceptor instances have been executed.

WARNING: This will cause the ENTIRE response to be buffered in memory, which may cause performance issues on larger responses. Make sure you know what you are doing! If it is possible to do the necessary operations using a ResponseStreamWrapper instead, you should probably consider doing so to avoid memory overhead.

Throws:
IllegalStateException - When output has already been written to the client.

withOutputStreamWrappedBy

public static Response withOutputStreamWrappedBy(ResponseStreamWrapper... wrappers)
                                          throws IllegalStateException
Throws:
IllegalStateException

addHeader

public static Response addHeader(String name,
                                 String value)
Create an Operation that adds a header to the HttpServletResponse


addDateHeader

public static Response addDateHeader(String name,
                                     long value)
Create an Operation that adds a date header to the HttpServletResponse


addIntHeader

public static Response addIntHeader(String name,
                                    int value)
Create an Operation that adds an int header to the HttpServletResponse


addCookie

public static Response addCookie(javax.servlet.http.Cookie cookie)
Create an Operation that adds a Cookie to the HttpServletResponse


setCode

public static Response setCode(int code)

toString

public String toString()
Overrides:
toString in class Object

rewrite-config-servlet 2.0.0.Alpha2

Copyright © 2012 OCPsoft. All Rights Reserved.