java.lang.Object |
↳ |
javax.servlet.ServletResponseWrapper |
|
↳ |
javax.servlet.http.HttpServletResponseWrapper |
|
|
↳ |
com.atlassian.jira.util.http.response.ObservantResponseWrapper |
Class Overview
This HttpServletResponseWrapper can capture the HTTP response code and also to know the length of the data output.
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
[Expand]
Inherited Constants |
From interface
javax.servlet.http.HttpServletResponse
int |
SC_ACCEPTED |
|
int |
SC_BAD_GATEWAY |
|
int |
SC_BAD_REQUEST |
|
int |
SC_CONFLICT |
|
int |
SC_CONTINUE |
|
int |
SC_CREATED |
|
int |
SC_EXPECTATION_FAILED |
|
int |
SC_FORBIDDEN |
|
int |
SC_FOUND |
|
int |
SC_GATEWAY_TIMEOUT |
|
int |
SC_GONE |
|
int |
SC_HTTP_VERSION_NOT_SUPPORTED |
|
int |
SC_INTERNAL_SERVER_ERROR |
|
int |
SC_LENGTH_REQUIRED |
|
int |
SC_METHOD_NOT_ALLOWED |
|
int |
SC_MOVED_PERMANENTLY |
|
int |
SC_MOVED_TEMPORARILY |
|
int |
SC_MULTIPLE_CHOICES |
|
int |
SC_NON_AUTHORITATIVE_INFORMATION |
|
int |
SC_NOT_ACCEPTABLE |
|
int |
SC_NOT_FOUND |
|
int |
SC_NOT_IMPLEMENTED |
|
int |
SC_NOT_MODIFIED |
|
int |
SC_NO_CONTENT |
|
int |
SC_OK |
|
int |
SC_PARTIAL_CONTENT |
|
int |
SC_PAYMENT_REQUIRED |
|
int |
SC_PRECONDITION_FAILED |
|
int |
SC_PROXY_AUTHENTICATION_REQUIRED |
|
int |
SC_REQUESTED_RANGE_NOT_SATISFIABLE |
|
int |
SC_REQUEST_ENTITY_TOO_LARGE |
|
int |
SC_REQUEST_TIMEOUT |
|
int |
SC_REQUEST_URI_TOO_LONG |
|
int |
SC_RESET_CONTENT |
|
int |
SC_SEE_OTHER |
|
int |
SC_SERVICE_UNAVAILABLE |
|
int |
SC_SWITCHING_PROTOCOLS |
|
int |
SC_TEMPORARY_REDIRECT |
|
int |
SC_UNAUTHORIZED |
|
int |
SC_UNSUPPORTED_MEDIA_TYPE |
|
int |
SC_USE_PROXY |
|
|
Public Methods |
long
|
getContentLen()
Returns the length of the content that has been sent back via this HttpServletResponseWrapper.
|
ServletOutputStream
|
getOutputStream()
Overridden to capture output content length
|
int
|
getStatus()
|
PrintWriter
|
getWriter()
Overridden to capture output content length
|
void
|
sendError(int sc, String s)
Overridden to capture HTTP status codes
|
void
|
sendError(int sc)
Overridden to capture HTTP status codes
|
void
|
setStatus(int sc, String s)
Overridden to capture HTTP status codes
|
void
|
setStatus(int sc)
Overridden to capture HTTP status codes
|
[Expand]
Inherited Methods |
From class
javax.servlet.http.HttpServletResponseWrapper
|
From class
javax.servlet.ServletResponseWrapper
void
|
flushBuffer()
|
int
|
getBufferSize()
|
String
|
getCharacterEncoding()
|
String
|
getContentType()
|
Locale
|
getLocale()
|
ServletOutputStream
|
getOutputStream()
|
ServletResponse
|
getResponse()
|
PrintWriter
|
getWriter()
|
boolean
|
isCommitted()
|
boolean
|
isWrapperFor(Class arg0)
|
boolean
|
isWrapperFor(ServletResponse arg0)
|
void
|
reset()
|
void
|
resetBuffer()
|
void
|
setBufferSize(int arg0)
|
void
|
setCharacterEncoding(String arg0)
|
void
|
setContentLength(int arg0)
|
void
|
setContentType(String arg0)
|
void
|
setLocale(Locale arg0)
|
void
|
setResponse(ServletResponse arg0)
|
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
From interface
javax.servlet.ServletResponse
void
|
flushBuffer()
|
int
|
getBufferSize()
|
String
|
getCharacterEncoding()
|
String
|
getContentType()
|
Locale
|
getLocale()
|
ServletOutputStream
|
getOutputStream()
|
PrintWriter
|
getWriter()
|
boolean
|
isCommitted()
|
void
|
reset()
|
void
|
resetBuffer()
|
void
|
setBufferSize(int arg0)
|
void
|
setCharacterEncoding(String arg0)
|
void
|
setContentLength(int arg0)
|
void
|
setContentType(String arg0)
|
void
|
setLocale(Locale arg0)
|
|
From interface
javax.servlet.http.HttpServletResponse
|
Public Constructors
public
ObservantResponseWrapper
(HttpServletResponse httpServletResponse)
Public Methods
public
long
getContentLen
()
Returns the length of the content that has been sent back via this HttpServletResponseWrapper.
This is a count in character OR bytes, depending on form of output was used. Let em explain!
If the web response uses the getOutputStream()
method, then the content length will be a count of
bytes. If they use the getWriter()
method, then it will be a count of characters.
We dont want to get into the game of working out how a set of Unicode characters translate into a series of bytes. Its expensive
and the point of this code is to be as cheap as possible.
Returns
- the length of the content that has been sent back via this HttpServletResponseWrapper in bytes or characters
depending on whcih output mechanism is used.
public
ServletOutputStream
getOutputStream
()
Overridden to capture output content length
public
int
getStatus
()
Returns
- the HTTP status code set on this HttpServletResponseWrapper
Overridden to capture output content length
public
void
sendError
(int sc, String s)
Overridden to capture HTTP status codes
public
void
sendError
(int sc)
Overridden to capture HTTP status codes
public
void
setStatus
(int sc, String s)
Overridden to capture HTTP status codes
public
void
setStatus
(int sc)
Overridden to capture HTTP status codes