public class

CapturingResponseWrapper

extends HttpServletResponseWrapper
java.lang.Object
   ↳ javax.servlet.ServletResponseWrapper
     ↳ javax.servlet.http.HttpServletResponseWrapper
       ↳ com.atlassian.jira.util.http.response.CapturingResponseWrapper

Class Overview

This HttpServletResponseWrapper can capture an initial amount of response data and the headers/cookies that may be set on the response.

THREAD SAFETY - One of these must be constructed on each HTTP request/response and hence only one thread may write to it at the one time. This suits the whole servlet engine idea,

Summary

Nested Classes
class CapturingResponseWrapper.HttpHeader This class represent the HTTP headers that have been output to this ResponseWrapper  
[Expand]
Inherited Constants
From interface javax.servlet.http.HttpServletResponse
Public Constructors
CapturingResponseWrapper(HttpServletResponse httpServletResponse, int maxCaptureLen)
This will wrap the HttpServletResponse and capture up to maxCaptureLen of the response output.
Public Methods
void addCookie(Cookie cookie)
Overridden to capture cookie information.
void addDateHeader(String s, long l)
Overridden to capture HTTP header information
void addHeader(String s, String s1)
Overridden to capture HTTP header information
void addIntHeader(String s, int i)
byte[] getBytes()
This returns the bytes that have been captured on the ResponseWrapper.
List getCookieList()
This returns a list of all the Cookie's that have been set on this response
List getHeaderList()
This returns a list of all the CapturingResponseWrapper.HttpHeader's that have been set on this response
ServletOutputStream getOutputStream()
PrintWriter getWriter()
void setDateHeader(String s, long l)
Overridden to capture HTTP header information
void setHeader(String s, String s1)
Overridden to capture HTTP header information
void setIntHeader(String s, int i)
Overridden to capture HTTP header information
int size()
This returns the number of bytes that have been captured so far.
[Expand]
Inherited Methods
From class javax.servlet.http.HttpServletResponseWrapper
From class javax.servlet.ServletResponseWrapper
From class java.lang.Object
From interface javax.servlet.ServletResponse
From interface javax.servlet.http.HttpServletResponse

Public Constructors

public CapturingResponseWrapper (HttpServletResponse httpServletResponse, int maxCaptureLen)

This will wrap the HttpServletResponse and capture up to maxCaptureLen of the response output.

Parameters
httpServletResponse the servlet response
maxCaptureLen the maximum number of bytes to capture

Public Methods

public void addCookie (Cookie cookie)

Overridden to capture cookie information.

public void addDateHeader (String s, long l)

Overridden to capture HTTP header information

public void addHeader (String s, String s1)

Overridden to capture HTTP header information

public void addIntHeader (String s, int i)

public byte[] getBytes ()

This returns the bytes that have been captured on the ResponseWrapper.

Returns
  • the bytes that have been captured on the ResponseWrapper

public List getCookieList ()

This returns a list of all the Cookie's that have been set on this response

Returns
  • a list of all the Cookie's that have been set on this response

public List getHeaderList ()

This returns a list of all the CapturingResponseWrapper.HttpHeader's that have been set on this response

Returns

public ServletOutputStream getOutputStream ()

Throws
IOException

public PrintWriter getWriter ()

Throws
IOException

public void setDateHeader (String s, long l)

Overridden to capture HTTP header information

public void setHeader (String s, String s1)

Overridden to capture HTTP header information

public void setIntHeader (String s, int i)

Overridden to capture HTTP header information

public int size ()

This returns the number of bytes that have been captured so far.

Returns
  • the the number of bytes that have been captured so far.