|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.enhydra.servlet.connectionMethods.EnhydraDirector.EnhydraDirectorProtocol
org.enhydra.servlet.connectionMethods.EnhydraDirector.EnhydraDirectorConnection
Field Summary | |
static java.lang.String |
DEFAULT_ENCODING
|
static java.lang.String |
FORM_POST_MIME_TYPE
Standard Mime type for POST-ed forms. |
protected org.apache.tomcat.util.http.mapper.MappingData |
mappingData
|
protected org.apache.catalina.util.ParameterMap |
parameterMap
|
protected org.apache.catalina.Session |
session
The currently active session for this request. |
Fields inherited from interface javax.servlet.http.HttpServletRequest |
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
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 | |
EnhydraDirectorConnection(org.apache.commons.logging.Log chan)
|
Method Summary | |
void |
activate()
Override the activate() method to allow per-connection variables to be reset for each new connection. |
void |
addCookie(javax.servlet.http.Cookie cookie)
Add a cookie to the list of cookies to send to the browser. |
void |
addDateHeader(java.lang.String name,
long date)
Adds a response header with the given name and date value. |
void |
addHeader(java.lang.String name,
java.lang.String value)
Adds a response header with the given name and integer value. |
void |
addIntHeader(java.lang.String name,
int value)
Adds a response header with the given name and integer value. |
protected boolean |
authRequired()
Implementation class must provide this method. |
void |
closeOutput()
Method to close output stream. |
protected void |
configureSessionCookie(javax.servlet.http.Cookie cookie)
|
boolean |
containsHeader(java.lang.String name)
Returns true if the current response contains the
named header. |
void |
doWrite(byte[] buffer,
int pos,
int count)
Write a chunk of bytes. |
java.lang.String |
encodeRedirectUrl(java.lang.String url)
Encodes the specified URL for use in the sendRedirect method. |
java.lang.String |
encodeRedirectURL(java.lang.String url)
|
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. |
java.lang.String |
encodeURL(java.lang.String url)
|
void |
flushBuffer()
Forces any content in the buffer to be written to the client. |
java.lang.String |
formatResponseCookie(javax.servlet.http.Cookie cookie)
|
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of an attribute of the request. |
java.util.Enumeration |
getAttributeNames()
|
protected byte[] |
getAuthData()
Abstract method to get authentication secret data. |
java.lang.String |
getAuthType()
Gets the authentication scheme of this request. |
int |
getBufferSize()
Returns the actual buffer size used for the response. |
java.lang.String |
getCharacterEncoding()
|
int |
getContentLength()
Get the size of the request data. |
java.lang.String |
getContentType()
Get the content type of the request. |
org.apache.catalina.Context |
getContext()
Get the Context |
java.lang.String |
getContextPath()
Get the Context Path |
javax.servlet.http.Cookie[] |
getCookies()
Gets the array of cookies found in this request. |
long |
getDateHeader(java.lang.String name)
Gets the value of the requested date header field of this request. |
protected EnhydraDirectorFunction |
getFunction(int type)
Internal dispatch table for server side function handlers. |
java.lang.String |
getHeader(java.lang.String name)
Gets the value of the requested header field of this request. |
java.util.Enumeration |
getHeaderNames()
Gets the header names for this request. |
java.util.Enumeration |
getHeaders(java.lang.String name)
Returns all the values of the specified requst header as an Enumeration of String objects.
|
java.lang.String |
getHost()
Get the host name |
javax.servlet.ServletInputStream |
getInputStream()
Get an input stream for reading binary data in the request body. |
int |
getIntHeader(java.lang.String name)
Gets the value of the specified integer header field of this request. |
java.lang.String |
getIPPortToken()
|
java.lang.String |
getLocalAddr()
Returns the Internet Protocol (IP) address of the interface on which the request was received. |
java.util.Locale |
getLocale()
Gets the locale of the response. |
java.util.Enumeration |
getLocales()
|
java.lang.String |
getLocalName()
Returns the host name of the Internet Protocol (IP) interface on which the request was received. |
int |
getLocalPort()
Returns the Internet Protocol (IP) port number of the interface on which the request was received. |
org.apache.tomcat.util.http.mapper.MappingData |
getMappingData()
Get the Mapping Data |
java.lang.String |
getMessage()
|
java.lang.String |
getMethod()
Gets the HTTP method (for example, GET, POST, PUT) with which this request was made. |
javax.servlet.ServletOutputStream |
getOutputStream()
Returns the byte output stream object for this response. |
java.lang.String |
getParameter(java.lang.String name)
Get a string containing the lone value of the specified parameter. |
java.util.Map |
getParameterMap()
Returns a java.util.Map of the parameters of this request. |
java.util.Enumeration |
getParameterNames()
Get the parameter names for this request. |
java.lang.String[] |
getParameterValues(java.lang.String name)
Get the values of the specified parameter for the request. |
java.lang.String |
getPathInfo()
Gets any optional extra path information following the servlet path of this request's URI, but immediately preceding its query string. |
java.lang.String |
getPathTranslated()
Gets any optional extra path information following the servlet path of this request's URI, but immediately preceding its query string, and translates it to a real path. |
java.lang.String |
getProtocol()
Get the protocol and version of the request. |
java.lang.String |
getQueryString()
Gets any query string that is part of the HTTP request URI. |
java.io.BufferedReader |
getReader()
Returns a buffered reader for reading text in the request body. |
java.lang.String |
getRealPath(java.lang.String path)
Applies alias rules to the specified virtual path and returns the corresponding real path, or null if the translation can not be performed for any reason. |
java.lang.String |
getRemoteAddr()
Get the IP address of the agent that sent the request. |
java.lang.String |
getRemoteHost()
Get the fully qualified host name of the agent that sent the request. |
int |
getRemotePort()
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request. |
java.lang.String |
getRemoteUser()
Gets the name of the user making this request. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String path)
|
java.lang.String |
getRequestedSessionId()
Gets the session id specified with this request. |
java.lang.String |
getRequestURI()
Get the part of this request's URI that is to the left of any query string. |
java.lang.StringBuffer |
getRequestURL()
Reconstructs the URL the client used to make the request. |
int |
getResponseContentLength()
Return the Content Length associated with this Response. |
java.lang.String |
getResponseContentType()
Return the Content Type associated with this Response. |
javax.servlet.http.Cookie[] |
getResponseCookies()
Get the Cookies associated with this Response.. |
java.lang.String |
getResponseHeader(java.lang.String name)
Get the Header with the specified name associated with this Response. |
java.lang.String[] |
getResponseHeaderNames()
Return the Header Names associated with this Response. |
java.lang.String[] |
getResponseHeaderValues()
Return the Header Values associated with this Response. |
java.lang.String |
getScheme()
Get the scheme of the URL used in this request, for example "http", "https", or "ftp". |
java.lang.String |
getServerName()
Get the host name of the server that received the request. |
int |
getServerPort()
Get the port number on which this request was received. |
java.lang.String |
getServletPath()
Gets the part of this request's URI that refers to the servlet being invoked. |
javax.servlet.http.HttpSession |
getSession()
Gets the current valid session associated with this request, if create is false or, if necessary, creates a new session for the request, if create is true. |
javax.servlet.http.HttpSession |
getSession(boolean create)
|
boolean |
getSessionAffinity()
|
int |
getStatus()
Return the Status Type associated with this Response. |
java.security.Principal |
getUserPrincipal()
|
org.apache.catalina.Wrapper |
getWrapper()
Get the Wrapper within which this Request is being processed. |
java.io.PrintWriter |
getWriter()
Gets a character stream printing writer for the response. |
boolean |
hasMoreElements()
Stub hasMoreElements implementation so this instance
can be passed as an empty enumeration.
|
boolean |
isCommitted()
Returns a boolean indicating whether the response has been committed. |
boolean |
isRequestedSessionIdFromCookie()
Checks whether the session id specified by this request came in as a cookie. |
boolean |
isRequestedSessionIdFromUrl()
Checks whether the session id specified by this request came in as part of the URL. |
boolean |
isRequestedSessionIdFromURL()
Checks whether the session id specified by this request came in as part of the URL. |
boolean |
isRequestedSessionIdValid()
Checks whether this request is associated with a session that is valid in the current session context. |
boolean |
isSecure()
|
boolean |
isUserInRole(java.lang.String role)
Returns a boolean indicating whether the authenticated user is included in the specified logical "role". |
java.lang.String |
maxAgeToExpires(int maxAge)
|
java.util.Hashtable |
mergeParameters(java.util.Hashtable one,
java.util.Hashtable two)
|
java.lang.Object |
nextElement()
Stub nextElement implementation so this instance
can be passed as an empty enumeration.
|
void |
obtainSessionId()
|
java.util.Hashtable |
parsePostData(int len,
javax.servlet.ServletInputStream in,
java.lang.String encoding)
|
protected void |
processCgiHeader(byte[] nameBytes,
byte[] valueBytes)
Abstract method to get authentication secret data. |
protected void |
processCookie(byte[] nameBytes,
byte[] valueBytes)
Abstract method to get authentication secret data. |
protected void |
processHttpHeader(byte[] nameBytes,
byte[] valueBytes)
Abstract method to get authentication secret data. |
void |
recycle()
|
void |
removeAttribute(java.lang.String name)
Remove attribute with the specified name |
void |
reset()
Clears any data that exists in the buffer as well as the status code and headers. |
void |
resetBuffer()
|
void |
sendError(int sc)
Sends an error response to the client using the specified status code and a default message. |
void |
sendError(int sc,
java.lang.String msg)
Sends an error response to the client using the specified status code and descriptive message. |
void |
sendRedirect(java.lang.String location)
Sends a temporary redirect response to the client using the specified redirect location URL. |
void |
setAttribute(java.lang.String name)
Set attribute with the specified name |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Set the Attribute with the specified name and value |
void |
setAuthData(java.lang.String authData)
Sets authentication data. |
void |
setBufferSize(int size)
Sets the preferred buffer size for the body of the response. |
void |
setCharacterEncoding(java.lang.String e)
|
void |
setContentLength(int len)
Sets the value of the outgoing Content-Length header.
|
void |
setContentType(java.lang.String type)
Sets the MIME content type of the outgoing response. |
void |
setContext(org.apache.catalina.Context context)
Set the Context |
void |
setDateHeader(java.lang.String name,
long date)
Sets a response header with the given name and date value. |
void |
setHeader(java.lang.String name,
java.lang.String value)
Sets a response header with the given name and integer value. |
void |
setIntHeader(java.lang.String name,
int value)
Sets a response header with the given name and integer value. |
void |
setIPPortToken(java.lang.String ipPortToken)
These values are used by the session manager to determine what IP and Port number to include with the user's session cookie. |
void |
setLocale(java.util.Locale loc)
mora servlet response Sets the locale of the response. |
void |
setQueryString(java.lang.String queryString)
Sets the query string that is part of the HTTP request URI. |
void |
setSessionAffinity(boolean sessionAffinity)
This flag is used by the session manager to determine if the IP and Port string should be included in the session cookie. |
void |
setSessionAffinityIdChangeRequest(boolean newValue)
If EnhydraDirector request to change ServerID this will be set to "true" |
void |
setStatus(int sc)
Sets the status code for this response. |
void |
setStatus(int sc,
java.lang.String sm)
Sets the status code for this response. |
void |
setUserPrincipal(java.security.Principal principal)
|
void |
setWrapper(org.apache.catalina.Wrapper wrapper)
Set the Wrapper within which this Request is being processed. |
protected void |
stuffInternalHeader(java.lang.String name,
java.lang.String value)
Private helper method to stuff a header into the request headers list. |
Methods inherited from class org.enhydra.servlet.connectionMethods.EnhydraDirector.EnhydraDirectorProtocol |
authenticate, authenticate, callback, closeConnection, closeInput, connect, deactivate, discardEntity, finishHeaders, getStateName, getStateName, inputAvailable, isAuthenticated, isConnected, isOpen, read, read, read, readExactly, readExactly, sendCookie, sendHeader, skip, toString, write, write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String DEFAULT_ENCODING
protected org.apache.catalina.Session session
protected org.apache.catalina.util.ParameterMap parameterMap
public static final java.lang.String FORM_POST_MIME_TYPE
protected org.apache.tomcat.util.http.mapper.MappingData mappingData
Constructor Detail |
public EnhydraDirectorConnection(org.apache.commons.logging.Log chan) throws java.io.IOException
Method Detail |
public org.apache.tomcat.util.http.mapper.MappingData getMappingData()
public org.apache.catalina.Wrapper getWrapper()
public void setWrapper(org.apache.catalina.Wrapper wrapper)
public javax.servlet.http.Cookie[] getResponseCookies()
public void setIPPortToken(java.lang.String ipPortToken)
public java.lang.String getIPPortToken()
public void setSessionAffinity(boolean sessionAffinity)
public boolean getSessionAffinity()
public void activate() throws java.io.IOException
activate
in class EnhydraDirectorProtocol
java.io.IOException
- If an error occurs.public void recycle()
protected EnhydraDirectorFunction getFunction(int type)
getFunction
in class EnhydraDirectorProtocol
type
- Protocol-defined function type number.
protected boolean authRequired()
authRequired
in class EnhydraDirectorProtocol
true
if authentication is required.protected byte[] getAuthData()
This method must be provided by the implementation class. It checks the configuration and finds the secret authentication data used to verify authentication responses from clients.
getAuthData
in class EnhydraDirectorProtocol
null
if authentication data does not exist.public void setAuthData(java.lang.String authData)
This method allows the connection method handler to pass the configured authentication string to this instance for use in establishing connections.
protected void processCgiHeader(byte[] nameBytes, byte[] valueBytes)
processCgiHeader
in class EnhydraDirectorProtocol
null
if authentication data does not exist.protected void stuffInternalHeader(java.lang.String name, java.lang.String value)
If this is used to stuff 'pseudo' headers for internal code, then the headers should have illegal names that can't conflict with valid HTTP headers.
name
- The header name.
null
if authentication data does not exist.protected void processHttpHeader(byte[] nameBytes, byte[] valueBytes)
processHttpHeader
in class EnhydraDirectorProtocol
null
if authentication data does not exist.protected void processCookie(byte[] nameBytes, byte[] valueBytes)
processCookie
in class EnhydraDirectorProtocol
null
if authentication data does not exist.public boolean hasMoreElements()
hasMoreElements
implementation so this instance
can be passed as an empty enumeration.
This is necessary because Enumeration
cannot
be instantiated by itself, and some methods in this class
must return an empty enumeration if certain headers or
parameters are not found.
hasMoreElements
in interface java.util.Enumeration
false
, indicating no more
elements are in this enumeration.public java.lang.Object nextElement() throws java.util.NoSuchElementException
nextElement
implementation so this instance
can be passed as an empty enumeration.
This is necessary because Enumeration
cannot
be instantiated by itself, and some methods in this class
must return an empty enumeration if certain headers or
parameters are not found.
nextElement
in interface java.util.Enumeration
Object
, but in this case it
only throws exceptions.
java.util.NoSuchElementException
- Always.public java.lang.String getAuthType()
getAuthType
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getContextPath()
getContextPath
in interface javax.servlet.http.HttpServletRequest
public org.apache.catalina.Context getContext()
public void setContext(org.apache.catalina.Context context)
public javax.servlet.http.Cookie[] getCookies()
getCookies
in interface javax.servlet.http.HttpServletRequest
public long getDateHeader(java.lang.String name)
getDateHeader
in interface javax.servlet.http.HttpServletRequest
name
- the String containing the name of the requested
header field. The comparison is case insensitive.
java.lang.IllegalArgumentException
- If value of header can't be
converted to an int.public java.lang.String getHeader(java.lang.String name)
getHeader
in interface javax.servlet.http.HttpServletRequest
name
- The String containing the name of the requested
header field. The comparison is case insensitive.
public java.util.Enumeration getHeaderNames()
getHeaderNames
in interface javax.servlet.http.HttpServletRequest
public java.util.Enumeration getHeaders(java.lang.String name)
Enumeration
of String
objects.
Some headers, such as Accept-Language
can be sent
by 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.
getHeaders
in interface javax.servlet.http.HttpServletRequest
name
- 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 int getIntHeader(java.lang.String name) throws java.lang.NumberFormatException
getIntHeader
in interface javax.servlet.http.HttpServletRequest
name
- The String containing the name of the requested
header field. The comparison is case insensitive.
java.lang.NumberFormatException
- If value of header can't be
converted to an int.public java.lang.String getMethod()
getMethod
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getPathInfo()
getPathInfo
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getPathTranslated()
getPathTranslated
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getQueryString()
getQueryString
in interface javax.servlet.http.HttpServletRequest
public void setQueryString(java.lang.String queryString)
public java.lang.String getRemoteUser()
getRemoteUser
in interface javax.servlet.http.HttpServletRequest
public int getLocalPort()
getLocalPort
in interface javax.servlet.ServletRequest
public int getRemotePort()
getRemotePort
in interface javax.servlet.ServletRequest
public java.lang.String getLocalAddr()
getLocalAddr
in interface javax.servlet.ServletRequest
public java.lang.String getLocalName()
getLocalName
in interface javax.servlet.ServletRequest
public java.lang.String getRequestedSessionId()
getRequestedSessionId
in interface javax.servlet.http.HttpServletRequest
isRequestedSessionIdValid()
public java.lang.String getRequestURI()
getRequestURI
in interface javax.servlet.http.HttpServletRequest
HttpUtils.getRequestURL(javax.servlet.http.HttpServletRequest)
public java.lang.String getServletPath()
getServletPath
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.http.HttpSession getSession()
getSession
in interface javax.servlet.http.HttpServletRequest
public void obtainSessionId()
public javax.servlet.http.HttpSession getSession(boolean create)
getSession
in interface javax.servlet.http.HttpServletRequest
protected void configureSessionCookie(javax.servlet.http.Cookie cookie)
public java.security.Principal getUserPrincipal()
getUserPrincipal
in interface javax.servlet.http.HttpServletRequest
public void setUserPrincipal(java.security.Principal principal)
public boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie
in interface javax.servlet.http.HttpServletRequest
getSession()
public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl
in interface javax.servlet.http.HttpServletRequest
getSession()
public boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL
in interface javax.servlet.http.HttpServletRequest
getSession()
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid
in interface javax.servlet.http.HttpServletRequest
getRequestedSessionId()
,
HttpSessionContext
,
getSession()
public boolean isUserInRole(java.lang.String role)
false
.
isUserInRole
in interface javax.servlet.http.HttpServletRequest
role
- a String
specifying the name
of the role
boolean
indicating whether
the user making this request belongs to a given role;
false
if the user has not been
authenticatedpublic java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface javax.servlet.ServletRequest
name
- The name of the attribute whose value is required.
public java.util.Enumeration getAttributeNames()
getAttributeNames
in interface javax.servlet.ServletRequest
public int getContentLength()
getContentLength
in interface javax.servlet.ServletRequest
public java.lang.String getContentType()
getContentType
in interface javax.servlet.ServletRequest
public javax.servlet.ServletInputStream getInputStream() throws java.io.IOException
getInputStream
in interface javax.servlet.ServletRequest
java.lang.IllegalStateException
- if getReader has been
called on this same request.
java.io.IOException
- on other I/O related errors.getReader
public java.util.Enumeration getLocales()
getLocales
in interface javax.servlet.ServletRequest
public java.lang.String getParameter(java.lang.String name)
This call is case sensitive.
getParameter
in interface javax.servlet.ServletRequest
name
- The name of the parameter whose value is required.
getParameterValues(java.lang.String)
public java.util.Enumeration getParameterNames()
getParameterNames
in interface javax.servlet.ServletRequest
public java.lang.String[] getParameterValues(java.lang.String name)
The name is case sensitive.
getParameterValues
in interface javax.servlet.ServletRequest
name
- the name of the parameter whose value is required.
ServletRequest.getParameter(java.lang.String)
public java.lang.String getProtocol()
getProtocol
in interface javax.servlet.ServletRequest
<protocol>/<major version>.<minor
version>
.public java.io.BufferedReader getReader() throws java.io.IOException
getReader
in interface javax.servlet.ServletRequest
UnsupportedEncodingException
- if the character set encoding
is unsupported, so the text can't be correctly decoded.
java.lang.IllegalStateException
- if getInputStream has been
called on this same request.
java.io.IOException
- on other I/O related errors.getInputStream
public java.lang.String getRealPath(java.lang.String path)
getRealPath
in interface javax.servlet.ServletRequest
path
- The virtual path to be translated to a real path.
public java.lang.String getRemoteAddr()
getRemoteAddr
in interface javax.servlet.ServletRequest
public java.lang.String getRemoteHost()
getRemoteHost
in interface javax.servlet.ServletRequest
public java.lang.String getScheme()
getScheme
in interface javax.servlet.ServletRequest
public java.lang.String getServerName()
getServerName
in interface javax.servlet.ServletRequest
public java.lang.String getHost()
public int getServerPort()
getServerPort
in interface javax.servlet.ServletRequest
public boolean isSecure()
isSecure
in interface javax.servlet.ServletRequest
public void removeAttribute(java.lang.String name)
removeAttribute
in interface javax.servlet.ServletRequest
public void setAttribute(java.lang.String name)
public void setHeader(java.lang.String name, java.lang.String value)
If the header has already been set, the new value overwrites the
previous one. The containsHeader
method can be used
to test for the presence of a header before setting its value.
setHeader
in interface javax.servlet.http.HttpServletResponse
name
- The name of the header.value
- The value to assign.public void addHeader(java.lang.String name, java.lang.String value)
This method allows response headers to have multiple values.
addHeader
in interface javax.servlet.http.HttpServletResponse
name
- The name of the header.value
- The value to assign.public void addCookie(javax.servlet.http.Cookie cookie)
addCookie
in interface javax.servlet.http.HttpServletResponse
cookie
- The cookie to add.public boolean containsHeader(java.lang.String name)
true
if the current response contains the
named header.
containsHeader
in interface javax.servlet.http.HttpServletResponse
name
- The name of the header.
public java.lang.String encodeUrl(java.lang.String url)
encodeUrl
in interface javax.servlet.http.HttpServletResponse
public java.lang.String encodeRedirectUrl(java.lang.String url)
sendRedirect
method.
encodeRedirectUrl
in interface javax.servlet.http.HttpServletResponse
public java.lang.String getMessage()
public void sendError(int sc, java.lang.String msg) throws java.io.IOException
sendError
in interface javax.servlet.http.HttpServletResponse
sc
- The status code.msg
- The descriptive message.
java.io.IOException
- If an I/O error has occured.public void sendError(int sc) throws java.io.IOException
sendError
in interface javax.servlet.http.HttpServletResponse
sc
- The status code.
java.io.IOException
- If an I/O error has occured.public void sendRedirect(java.lang.String location) throws java.io.IOException
sendRedirect
in interface javax.servlet.http.HttpServletResponse
location
- The redirect location URL.
java.io.IOException
- If an I/O error has occured.public void setDateHeader(java.lang.String name, long date)
If the header has already been set, the new value overwrites the
previous one. The containsHeader
method can be used
to test for the presence of a header before setting its value.
setDateHeader
in interface javax.servlet.http.HttpServletResponse
name
- The name of the header.public void addDateHeader(java.lang.String name, long date)
This method allows response headers to have multiple values.
addDateHeader
in interface javax.servlet.http.HttpServletResponse
name
- The name of the header.public void setIntHeader(java.lang.String name, int value)
If the header has already been set, the new value overwrites the
previous one. The containsHeader
method can be used
to test for the presence of a header before setting its value.
setIntHeader
in interface javax.servlet.http.HttpServletResponse
name
- The name of the header.value
- The value to assign.public void addIntHeader(java.lang.String name, int value)
This method allows response headers to have multiple values.
addIntHeader
in interface javax.servlet.http.HttpServletResponse
name
- The name of the header.value
- The value to assign.public void setStatus(int sc, java.lang.String sm)
setStatus
in interface javax.servlet.http.HttpServletResponse
sc
- The HTTP status code.sm
- Message to send with status code.public void setStatus(int sc)
This method is used to set the return status code when there
is no error. (For example, SC_OK or SC_MOVED_TEMPORARILY). If there
is an error, the sendError
method should be used instead.
setStatus
in interface javax.servlet.http.HttpServletResponse
sc
- The status code.public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletRequest
public javax.servlet.ServletOutputStream getOutputStream() throws java.io.IOException
This method may not be called if it or getWriter()
have already been called.
getOutputStream
in interface javax.servlet.ServletResponse
java.lang.IllegalStateException
- If this method is called after the
output stream has already been gotten.
java.io.IOException
public java.io.PrintWriter getWriter() throws java.io.IOException
This implementation is not fully functional, since it uses the default character encoding instead of mapping the charset portion of the Content-Type to the correct encoding.
getWriter
in interface javax.servlet.ServletResponse
PrintWriter
stream for output.
java.io.IOException
- If an I/O error occurs.
java.lang.IllegalStateException
- If getOutputStream() already called.
UnsupportedEncodingException
- If an unknown character
encoding is specified.public void setContentLength(int len)
Content-Length
header.
Sets the length of the outgoing content. Any data sent beyond this length will be discarded, and the output will be padded to this length after the output stream is closed. Padding is with octets of value 0 (zero).
setContentLength
in interface javax.servlet.ServletResponse
len
- The Content-Length value.public void setContentType(java.lang.String type)
FIXME XXX - This is not fully implemented. It simply copies
the type verbatim to the MIME headers sent with the response.
Future versions of this class may attempt to read the
"charset" portion of the content type to determine which
encoding, if any, should be used for streams returned by
getWriter()
. This will require a configuration
table that maps locales, MIME charsets, and Java encodings.
setContentType
in interface javax.servlet.ServletResponse
type
- The MIME type of this response.public void setBufferSize(int size)
The servlet container will use a buffer at least as large as
the size requested. The actual buffer size used can be found
using getBufferSize
.
A larger buffer allows more content to be written before anything is actually sent, this 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
size
- The preferred buffer size.
java.lang.IllegalStateException
- If called after content written.public int getBufferSize()
If no buffering is used, this method returns 0
.
getBufferSize
in interface javax.servlet.ServletResponse
public void flushBuffer() throws java.io.IOException
A call to this method automatically commits the response, meaning the status code and headers will be written.
flushBuffer
in interface javax.servlet.ServletResponse
java.io.IOException
- If an I/O error occurs.public boolean isCommitted()
A committed response has already had its status code and headers written.
isCommitted
in interface javax.servlet.ServletResponse
public void reset() throws java.lang.IllegalStateException
IllegalStateException
.
reset
in interface javax.servlet.ServletResponse
java.lang.IllegalStateException
- If the response has already
been committed.public void setLocale(java.util.Locale loc)
This is supposed to set the headers, including Content-Type
and Content-Encoding
. However, it is not * clear how to
map between character encodings and locales.
Probably, future revisions of this class will use some sort of mapping
table to set the encodings. For now, it just keeps track of which
locale is set and uses Latin1 encoding in the underlying output
stream. Servlets that want to use other encodings should create an
appropriate PrintWriter
on the binary stream given by
getOutputStream
.
XXX - FIXME.
setLocale
in interface javax.servlet.ServletResponse
loc
- The local set for output on this response.public java.util.Locale getLocale()
Locale is supposed to determine some attributes of headers, including
Content-Type
and Content-Encoding
.
Unfortunately, it is not clear how to map between character encodings
and locales.
Probably, future revisions of this class will use some sort
of mapping table to set the encodings. For now, it just keeps
track of which locale is set and uses Latin1 encoding in the
underlying output stream. Servlets that want to use other
encodings should create an appropriate PrintWriter
on the binary stream given by getOutputStream
.
XXX - FIXME.
getLocale
in interface javax.servlet.ServletRequest
public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
getRequestDispatcher
in interface javax.servlet.ServletRequest
public java.lang.String encodeURL(java.lang.String url)
encodeURL
in interface javax.servlet.http.HttpServletResponse
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface javax.servlet.ServletRequest
public java.lang.String encodeRedirectURL(java.lang.String url)
encodeRedirectURL
in interface javax.servlet.http.HttpServletResponse
public void resetBuffer()
resetBuffer
in interface javax.servlet.ServletResponse
public void setCharacterEncoding(java.lang.String e)
setCharacterEncoding
in interface javax.servlet.ServletRequest
public java.util.Map getParameterMap()
getParameterMap
in interface javax.servlet.ServletRequest
public java.lang.String getResponseHeader(java.lang.String name)
public java.lang.String[] getResponseHeaderNames()
public java.lang.String[] getResponseHeaderValues()
public int getStatus()
public java.lang.String getResponseContentType()
public int getResponseContentLength()
public java.lang.StringBuffer getRequestURL()
Because this method returns a StringBuffer
,
not a string, you can modify the URL easily, for example,
to append query parameters.
This method is useful for creating redirect messages and for reporting errors.
getRequestURL
in interface javax.servlet.http.HttpServletRequest
StringBuffer
object containing
the reconstructed URLpublic java.util.Hashtable mergeParameters(java.util.Hashtable one, java.util.Hashtable two)
public void doWrite(byte[] buffer, int pos, int count) throws java.io.IOException
java.io.IOException
public void closeOutput() throws java.io.IOException
closeOutput
in class EnhydraDirectorProtocol
java.io.IOException
public void setSessionAffinityIdChangeRequest(boolean newValue)
newValue
- The sessionAffinityIdChangeRequest to set.public java.lang.String formatResponseCookie(javax.servlet.http.Cookie cookie)
public java.lang.String maxAgeToExpires(int maxAge)
public java.util.Hashtable parsePostData(int len, javax.servlet.ServletInputStream in, java.lang.String encoding)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |