|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.servlet.DynamoHttpServletResponse
public class DynamoHttpServletResponse
This object implements an extended version of javax.servlet.http.HttpServletResponse. It includes additional functionality for
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
static java.lang.String |
REQUEST_ID
Name of the query parameter to use to store the request id on redirects |
Fields inherited from interface javax.servlet.http.HttpServletResponse |
---|
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_FOUND, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY |
Constructor Summary | |
---|---|
DynamoHttpServletResponse()
Constructs a new wrapper javax.servlet.http.HttpServletResponse wrapper |
|
DynamoHttpServletResponse(javax.servlet.http.HttpServletResponse pResponse)
Constructs a new wrapper javax.servlet.http.HttpServletResponse wrapper |
Method Summary | |
---|---|
void |
addCookie(javax.servlet.http.Cookie cookie)
Uses the given HTTP response message to assign a new value to a browser-specific cookie. |
void |
addCookieAsHeader(javax.servlet.http.Cookie cookie)
Uses the given HTTP response message to assign a new value to a browser-specific cookie. |
void |
addCookieToBuffer(javax.servlet.http.Cookie pCookie)
Adds a cookie to the CookieBuffer. |
void |
addDateHeader(java.lang.String pName,
long pValue)
Adds a field to the response header with a given name and date-valued field. |
void |
addHeader(java.lang.String pName,
java.lang.String pValue)
Adds a field to the response header with a given name and value. |
void |
addIntHeader(java.lang.String pName,
int pValue)
Adds a field to the response header with a given name and integer value. |
boolean |
containsHeader(java.lang.String pName)
Returns true if the response message header has a field with the specified name. |
java.lang.String |
encodeLocalRedirectURL(java.lang.String pLocation,
DynamoHttpServletRequest pRequest)
Convert a (possibly relative) URL to a form appropriate for sendRedirect. |
java.lang.String |
encodeRedirectUrl(java.lang.String url)
Deprecated. |
java.lang.String |
encodeRedirectURL(java.lang.String url)
Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed,
returns the URL unchanged. |
java.lang.String |
encodeUrl(java.lang.String url)
Deprecated. |
java.lang.String |
encodeURL(java.lang.String url)
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. |
void |
flushBuffer()
Forces any content in the buffer to be written to the client. |
int |
getBufferSize()
Returns the actual buffer size used for the response. |
java.lang.String |
getCharacterEncoding()
Returns the character encoding used for writing text to the body of this response. |
java.lang.String |
getContentType()
Gets the content type for this response. |
boolean |
getContentTypeSet()
|
java.lang.String |
getCookieString(javax.servlet.http.Cookie pCookie)
Append the cookie to the specified buffer. |
boolean |
getDoExitTracking()
|
java.util.Dictionary |
getHeaders()
Returns a Dictionary of the headers that have been set so far. |
java.util.Enumeration |
getHeaders(java.lang.String pHeaderName)
Returns all the values of the specified request header as an Enumeration of objects. |
java.util.Locale |
getLocale()
Returns the locale assigned to the response. |
atg.servlet.LocaleToCharsetMapper |
getLocaleToCharsetMapper()
Returns the LocaleToCharsetMapper property |
javax.servlet.ServletOutputStream |
getOutputStream()
Returns an output stream for writing response data. |
javax.servlet.http.HttpServletResponse |
getResponse()
Returns the HttpServletResponse property |
int |
getStatus()
Returns the status code sent through this response object. |
javax.servlet.ServletResponseWrapper |
getWrapper()
Returns the ServletResponseWrapper wrapping this request. |
java.io.PrintWriter |
getWriter()
Returns the print writer for writing text response data |
boolean |
isCommitted()
Returns a boolean indicating if the response has been committed. |
boolean |
isOutputStreamRetrieved()
|
boolean |
isOutputStreamUsed()
Returns true if the servlet output stream has been set or used in this request |
boolean |
isResponseComplete()
Returns true if we know that a complete response has already been sent. |
boolean |
isWriterUsed()
Returns true if the print writer has been set or used in this request |
void |
reset()
Clears any data that exists in the buffer as well as the status code and headers. |
void |
resetBuffer()
Clears the content of the underlying buffer in the response without clearing headers or status code. |
void |
sendError(int pCode)
Sends an error response to the client using the specified status code and a default message. |
void |
sendError(int pCode,
java.lang.String pMessage)
Sends an error response to the client using the specified status code and descriptive message. |
void |
sendLocalRedirect(java.lang.String pLocation,
DynamoHttpServletRequest pRequest)
Sends a redirect response to the client using the specified redirect location URL. |
void |
sendRedirect(java.lang.String pLocation)
Sends a redirect response to the client using the specified redirect location URL. |
void |
sendRedirect(java.lang.String pLocation,
boolean pAllowAllURLs)
Sends a redirect response to the client using the specified redirect location URL. |
static void |
setAllowChangeHeadersDuringInclude(boolean pAllow)
Method to allow/disallow changing headers on the response during an include. |
void |
setBufferSize(int pBufferSize)
Sets the preferred buffer size for the body of the response. |
void |
setCharacterEncoding(java.lang.String pCharset)
|
void |
setContentLength(int pLength)
Sets the content length for this response. |
void |
setContentType(java.lang.String pContentType)
Sets the content type for this response. |
void |
setContentTypeSet(boolean pContentTypeSet)
Sets the property ContentTypeSet. |
void |
setDateHeader(java.lang.String pName,
long pValue)
Adds a field to the response header with a given name and date-valued field. |
void |
setDoExitTracking(boolean pDoExitTracking)
Sets the property doExitTracking. |
void |
setHeader(java.lang.String pName,
java.lang.String pValue)
Adds a field to the response header with a given name and value. |
void |
setIntHeader(java.lang.String pName,
int pValue)
Adds a field to the response header with a given name and integer value. |
void |
setLocale(java.util.Locale pLocale)
Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate. |
void |
setLocaleToCharsetMapper(atg.servlet.LocaleToCharsetMapper pMapper)
Sets the LocaleToCharsetMapper property |
void |
setOutputStream(javax.servlet.ServletOutputStream pOutputStream)
Sets the output stream property. |
void |
setRequest(DynamoHttpServletRequest pRequest)
Sets the servlet request corresponding to the response for this method. |
void |
setResponse(javax.servlet.http.HttpServletResponse pResponse)
Sets the HttpServletResponse property |
void |
setStatus(int pCode)
Sets the status code and a default message for this response. |
void |
setStatus(int pCode,
java.lang.String pMessage)
Deprecated. |
boolean |
setStrictOutputAccess(boolean pStrict)
StrictOutputAccess controls whether the Servlet 2.2 behavior of restricting access to PrintWriters and OuputStreams is imposed. |
void |
setWrapper(javax.servlet.ServletResponseWrapper pWrapper)
Sets the ServletResponseWrapper wrapping this request. |
void |
setWriter(java.io.PrintWriter pWriter)
Sets the writer for use by subsequent requests. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
public static final java.lang.String REQUEST_ID
Constructor Detail |
---|
public DynamoHttpServletResponse()
public DynamoHttpServletResponse(javax.servlet.http.HttpServletResponse pResponse)
pResponse
- the instance being wrappedMethod Detail |
---|
public void setResponse(javax.servlet.http.HttpServletResponse pResponse)
public void setRequest(DynamoHttpServletRequest pRequest)
public javax.servlet.http.HttpServletResponse getResponse()
public void setLocaleToCharsetMapper(atg.servlet.LocaleToCharsetMapper pMapper)
public atg.servlet.LocaleToCharsetMapper getLocaleToCharsetMapper()
public void setOutputStream(javax.servlet.ServletOutputStream pOutputStream)
public void setWriter(java.io.PrintWriter pWriter)
public boolean setStrictOutputAccess(boolean pStrict)
public java.util.Dictionary getHeaders()
public java.util.Enumeration getHeaders(java.lang.String pHeaderName)
Enumeration
of objects. The objects
returned may be a Strings, Integers, or Longs, depending
on whether setHeader, setIntHeader, or setDateHeader
was used.
Some headers, such as Set-Cookie
can be sent
to clients as several headers each with a different value rather than
sending the header as a comma separated list.
If the request did not include any headers
of the specified name, this method returns an empty
Enumeration
.
The header name is case insensitive. You can use
this method with any request header.
pHeaderName
- a String
specifying the header
name
Enumeration
containing the
values of the requested header, or an empty Enumeration
if the request does not have any headers of that name.public void setContentLength(int pLength)
setContentLength
in interface javax.servlet.ServletResponse
pLength
- the content lengthpublic void setContentType(java.lang.String pContentType)
setContentType
in interface javax.servlet.ServletResponse
the
- content's MIME typepublic java.lang.String getContentType()
getContentType
in interface javax.servlet.ServletResponse
the
- content's MIME typepublic void setContentTypeSet(boolean pContentTypeSet)
pContentTypeSet
- new value to setpublic boolean getContentTypeSet()
public void setDoExitTracking(boolean pDoExitTracking)
pDoExitTracking
- new value to setpublic boolean getDoExitTracking()
public javax.servlet.ServletOutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface javax.servlet.ServletResponse
java.io.IOException
- if an I/O exception has occurredpublic boolean containsHeader(java.lang.String pName)
containsHeader
in interface javax.servlet.http.HttpServletResponse
pName
- the header field namepublic void setStatus(int pCode, java.lang.String pMessage)
setStatus
in interface javax.servlet.http.HttpServletResponse
pCode
- the status codepMessage
- the status messagepublic void setStatus(int pCode)
setStatus
in interface javax.servlet.http.HttpServletResponse
pCode
- the status codepublic int getStatus()
public void setHeader(java.lang.String pName, java.lang.String pValue)
setHeader
in interface javax.servlet.http.HttpServletResponse
pName
- the header namepValue
- the header valuepublic void addHeader(java.lang.String pName, java.lang.String pValue)
addHeader
in interface AddHeaderHttpServletResponse
addHeader
in interface javax.servlet.http.HttpServletResponse
pName
- the header namepValue
- the header valuepublic void setIntHeader(java.lang.String pName, int pValue)
setIntHeader
in interface javax.servlet.http.HttpServletResponse
pName
- the header namepValue
- the header valuepublic void addIntHeader(java.lang.String pName, int pValue)
addIntHeader
in interface AddHeaderHttpServletResponse
addIntHeader
in interface javax.servlet.http.HttpServletResponse
pName
- the header namepValue
- the header valuepublic void setDateHeader(java.lang.String pName, long pValue)
setDateHeader
in interface javax.servlet.http.HttpServletResponse
pName
- the header namepValue
- the header valuepublic void addDateHeader(java.lang.String pName, long pValue)
addDateHeader
in interface AddHeaderHttpServletResponse
addDateHeader
in interface javax.servlet.http.HttpServletResponse
pName
- the header namepValue
- the header valuepublic void sendError(int pCode, java.lang.String pMessage) throws java.io.IOException
sendError
in interface javax.servlet.http.HttpServletResponse
pCode
- the status codepMessage
- the detail message
java.io.IOException
- If an I/O error has occurred.public void sendError(int pCode) throws java.io.IOException
sendError
in interface javax.servlet.http.HttpServletResponse
pCode
- the status code
java.io.IOException
- If an I/O error has occurred.public void sendRedirect(java.lang.String pLocation) throws java.io.IOException
Servlet 2.3 requires that this method handle relative URLs so that's what we do when running in the DAS J2EE container. Here's how it says we're supposed to handle things:
If we're not in DAS-J2EE then the URL must be absolute
(e.g., https://hostname/path/file.html
). Relative URLs are
not permitted here.
sendRedirect
in interface javax.servlet.http.HttpServletResponse
pLocation
- the redirect location URL
java.io.IOException
- If an I/O error has occurred.public void sendRedirect(java.lang.String pLocation, boolean pAllowAllURLs) throws java.io.IOException
Servlet 2.3 requires that this method handle relative URLs so that's what we do when running in the DAS J2EE container. Here's how it says we're supposed to handle things:
If we're not in DAS-J2EE then the URL must be absolute
(e.g., https://hostname/path/file.html
). Relative URLs are
not permitted here.
pLocation
- the redirect location URLpAllowAllURLs
- whether to allow all URLs, even non-local ones.
By default, non-local URLs are validated by the redirectURLValidator.
java.io.IOException
- If an I/O error has occurred.public java.lang.String encodeUrl(java.lang.String url)
All URLs emitted by a Servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.
encodeUrl
in interface javax.servlet.http.HttpServletResponse
url
- the url to be encoded.
encodeURL(java.lang.String)
public java.lang.String encodeURL(java.lang.String url)
All URLs emitted by a Servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.
encodeURL
in interface javax.servlet.http.HttpServletResponse
url
- the url to be encoded.
public java.lang.String encodeRedirectUrl(java.lang.String url)
sendRedirect
method or, if encoding is not needed,
returns the URL unchanged. The implementation of this method
should include the logic to determine whether the session ID
needs to be encoded in the URL. Because the rules for making
this determination differ from those used to decide whether to
encode a normal link, this method is seperate from the
encodeUrl
method.
All URLs sent to the HttpServletResponse.sendRedirect method should be run through this method. Otherwise, URL rewriting canont be used with browsers which do not support cookies.
encodeRedirectUrl
in interface javax.servlet.http.HttpServletResponse
url
- the url to be encoded.
encodeRedirectURL(java.lang.String)
public java.lang.String encodeRedirectURL(java.lang.String url)
sendRedirect
method or, if encoding is not needed,
returns the URL unchanged. The implementation of this method
should include the logic to determine whether the session ID
needs to be encoded in the URL. Because the rules for making
this determination differ from those used to decide whether to
encode a normal link, this method is seperate from the
encodeUrl
method.
All URLs sent to the HttpServletResponse.sendRedirect method should be run through this method. Otherwise, URL rewriting canont be used with browsers which do not support cookies.
encodeRedirectURL
in interface javax.servlet.http.HttpServletResponse
url
- the url to be encoded.
sendRedirect(java.lang.String)
,
encodeURL(java.lang.String)
public java.io.PrintWriter getWriter() throws java.io.IOException
getWriter
in interface javax.servlet.ServletResponse
java.io.IOException
public boolean isWriterUsed()
public boolean isOutputStreamUsed()
public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface atg.servlet.CharacterEncodable
getCharacterEncoding
in interface javax.servlet.ServletResponse
public void addCookie(javax.servlet.http.Cookie cookie)
addCookie
in interface javax.servlet.http.HttpServletResponse
public void addCookieAsHeader(javax.servlet.http.Cookie cookie)
public java.lang.String getCookieString(javax.servlet.http.Cookie pCookie)
public void addCookieToBuffer(javax.servlet.http.Cookie pCookie)
atg.servlet.http.CookieBuffer
public java.lang.String encodeLocalRedirectURL(java.lang.String pLocation, DynamoHttpServletRequest pRequest) throws java.net.MalformedURLException
This function is invoked by sendLocalRedirect to generate a URL to send pass to sendRedirect.
pLocation
- the location to send as a redirectpRequest
- the request containing the URI of the current
request, used when converting relative URL's to absolute URL's.
java.io.IOException
java.net.MalformedURLException
sendLocalRedirect(java.lang.String, atg.servlet.DynamoHttpServletRequest)
,
sendRedirect(java.lang.String)
public void sendLocalRedirect(java.lang.String pLocation, DynamoHttpServletRequest pRequest) throws java.io.IOException
In general, this function should be used when redirecting back to a page on the same site. If you are redirecting to a page on some other site, use the full absolute URL and call sendRedirect().
Note that sendLocalRedirect uses encodeLocalRedirectURL to convert the passed in URL to the form passed to sendRedirect().
pLocation
- the location to send as a redirectpRequest
- the request containing the URI of the current
request, used when converting relative URL's to absolute URL's.
java.io.IOException
sendRedirect(java.lang.String)
public boolean isResponseComplete()
public int getBufferSize()
getBufferSize
in interface javax.servlet.ServletResponse
setBufferSize(int)
,
flushBuffer()
,
isCommitted()
,
reset()
public void setBufferSize(int pBufferSize)
getBufferSize
.
A larger buffer allows more content to be written before anything is
actually sent, thus providing the servlet with more time to set
appropriate status codes and headers. A smaller buffer decreases
server memory load and allows the client to start receiving data more
quickly.
This method must be called before any response body content is
written; if content has been written, this method throws an
IllegalStateException
.
setBufferSize
in interface javax.servlet.ServletResponse
pBufferSize
- the preferred buffer size
java.lang.IllegalStateException
- if this method is called after
content has been writtengetBufferSize()
,
flushBuffer()
,
isCommitted()
,
reset()
public boolean isCommitted()
isCommitted
in interface javax.servlet.ServletResponse
getBufferSize()
,
flushBuffer()
,
setBufferSize(int)
,
reset()
public void flushBuffer() throws java.io.IOException
flushBuffer
in interface javax.servlet.ServletResponse
java.io.IOException
getBufferSize()
,
isCommitted()
,
setBufferSize(int)
,
reset()
public void reset()
IllegalStateException
.
reset
in interface javax.servlet.ServletResponse
java.lang.IllegalStateException
- if the response has already been committedgetBufferSize()
,
flushBuffer()
,
setBufferSize(int)
,
isCommitted()
public void resetBuffer()
IllegalStateException
.
resetBuffer
in interface javax.servlet.ServletResponse
setBufferSize(int)
,
getBufferSize()
,
isCommitted()
,
reset()
public java.util.Locale getLocale()
getLocale
in interface javax.servlet.ServletResponse
setLocale(java.util.Locale)
public void setLocale(java.util.Locale pLocale)
setLocale
in interface javax.servlet.ServletResponse
pLocale
- the locale of the responsegetLocale()
public javax.servlet.ServletResponseWrapper getWrapper()
public void setWrapper(javax.servlet.ServletResponseWrapper pWrapper)
public static void setAllowChangeHeadersDuringInclude(boolean pAllow)
public void setCharacterEncoding(java.lang.String pCharset)
setCharacterEncoding
in interface javax.servlet.ServletResponse
public boolean isOutputStreamRetrieved()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |