|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.jigsaw.servlet.JigsawHttpServletResponse
public class JigsawHttpServletResponse
Field Summary | |
---|---|
protected int |
buffer_size
|
static java.lang.String |
CHARSET_PARAMETER
|
static int |
DEFAULT_BUFFER_SIZE
|
static java.lang.String |
INCLUDED
|
protected JigsawHttpServletRequest |
jrequest
|
protected java.util.Locale |
locale
|
static int |
MIN_BUFFER_SIZE
|
static java.lang.String |
MONITOR
|
protected java.io.ByteArrayOutputStream |
out
Our temp stream. |
protected java.io.PipedOutputStream |
pout
|
static java.lang.String |
STREAM
|
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_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_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY |
Method Summary | |
---|---|
void |
addCookie(javax.servlet.http.Cookie cookie)
Adds the specified cookie to the response. |
void |
addDateHeader(java.lang.String name,
long date)
|
void |
addHeader(java.lang.String name,
java.lang.String value)
|
void |
addIntHeader(java.lang.String name,
int value)
|
boolean |
containsHeader(java.lang.String header)
Checks whether the response message header has a field with the specified name. |
java.lang.String |
encodeRedirectUrl(java.lang.String url)
Deprecated. since jsdk2.1 |
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. since jsdk2.1 |
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. |
protected void |
flushStream(boolean close)
Flush the output stream. |
int |
getBufferSize()
Returns the actual buffer size used for the response. |
java.lang.String |
getCharacterEncoding()
Return the Charset parameter of content type |
java.util.Locale |
getLocale()
Returns the locale assigned to the response. |
javax.servlet.ServletOutputStream |
getOutputStream()
Returns an output stream for writing binary response data. |
protected java.io.OutputStream |
getRawOutputStream()
returns the raw output stream regardless of what happened before used for internal operation (e.g. |
protected Reply |
getReply()
|
java.io.PrintWriter |
getWriter()
Returns a print writer for writing formatted text responses. |
boolean |
isCommitted()
Returns a boolean indicating if the response has been committed. |
protected boolean |
isStreamObtained()
|
void |
reset()
Clears any data that exists in the buffer as well as the status code and headers. |
void |
resetBuffer()
Clears any data that exists in the buffer but not status code and headers. |
void |
sendError(int i)
Sends an error response to the client using the specified status code and a default message. |
void |
sendError(int i,
java.lang.String msg)
Sends an error response to the client using the specified status code and descriptive message. |
void |
sendRedirect(java.lang.String url)
Sends a temporary redirect response to the client using the specified redirect location URL. |
void |
setBufferSize(int size)
Sets the preferred buffer size for the body of the response. |
void |
setContentLength(int i)
Sets the content length for this response. |
void |
setContentType(java.lang.String spec)
Sets the content type for this response. |
void |
setDateHeader(java.lang.String name,
long date)
Adds a field to the response header with the given name and date-valued field. |
void |
setHeader(java.lang.String name,
java.lang.String value)
Adds a field to the response header with the given name and value. |
void |
setIntHeader(java.lang.String name,
int value)
Adds a field to the response header with the given name and integer value. |
void |
setLocale(java.util.Locale locale)
Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate. |
protected void |
setServletRequest(JigsawHttpServletRequest jrequest)
|
void |
setStatus(int i)
Sets the status code for this response. |
void |
setStatus(int i,
java.lang.String reason)
Deprecated. since jsdk2.1 |
void |
unsetHeader(java.lang.String name)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CHARSET_PARAMETER
public static final int DEFAULT_BUFFER_SIZE
public static final int MIN_BUFFER_SIZE
protected java.util.Locale locale
protected java.io.ByteArrayOutputStream out
protected java.io.PipedOutputStream pout
protected JigsawHttpServletRequest jrequest
protected int buffer_size
public static final java.lang.String INCLUDED
public static final java.lang.String STREAM
public static final java.lang.String MONITOR
Method Detail |
---|
protected void setServletRequest(JigsawHttpServletRequest jrequest)
public void setContentLength(int i)
setContentLength
in interface javax.servlet.ServletResponse
len
- - the content lengthpublic void setContentType(java.lang.String spec)
This response property may only be assigned one time. If a writer is to be used to write a text response, this method must be called before the method getWriter. If an output stream will be used to write a response, this method must be called before the output stream is used to write response data.
setContentType
in interface javax.servlet.ServletResponse
spec
- - the content's MIME typegetOutputStream()
,
getWriter()
protected boolean isStreamObtained()
protected Reply getReply()
public javax.servlet.ServletOutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface javax.servlet.ServletResponse
java.io.IOException
- if an I/O exception has occurred
java.lang.IllegalStateException
- if getWriter has been called on this
same request.getWriter()
protected java.io.OutputStream getRawOutputStream()
public void setStatus(int i, java.lang.String reason)
setStatus
in interface javax.servlet.http.HttpServletResponse
i
- - the status codereason
- - the status messagepublic void setStatus(int i)
setStatus
in interface javax.servlet.http.HttpServletResponse
i
- - the status codesendError(int, java.lang.String)
public void setHeader(java.lang.String name, java.lang.String value)
setHeader
in interface javax.servlet.http.HttpServletResponse
name
- - the name of the header fieldvalue
- - the header field's valuecontainsHeader(java.lang.String)
public void setIntHeader(java.lang.String name, int value)
setIntHeader
in interface javax.servlet.http.HttpServletResponse
name
- - the name of the header fieldvalue
- - the header field's integer valuecontainsHeader(java.lang.String)
public void setDateHeader(java.lang.String name, long date)
setDateHeader
in interface javax.servlet.http.HttpServletResponse
name
- - the name of the header fieldvalue
- - the header field's date valuecontainsHeader(java.lang.String)
public void unsetHeader(java.lang.String name)
public void sendError(int i, java.lang.String msg) throws java.io.IOException
sendError
in interface javax.servlet.http.HttpServletResponse
sc
- - the status codemsg
- - the detail message
java.io.IOException
- If an I/O error has occurred.public void sendError(int i) throws java.io.IOException
sendError
in interface javax.servlet.http.HttpServletResponse
sc
- - the status code
java.io.IOException
- If an I/O error has occurred.public void sendRedirect(java.lang.String url) throws java.io.IOException
sendRedirect
in interface javax.servlet.http.HttpServletResponse
url
- - the redirect location URL
java.io.IOException
- If an I/O error has occurred.public boolean containsHeader(java.lang.String header)
containsHeader
in interface javax.servlet.http.HttpServletResponse
name
- - the header field name
public void addCookie(javax.servlet.http.Cookie cookie)
addCookie
in interface javax.servlet.http.HttpServletResponse
cookie
- - the Cookie to return to the clientpublic java.lang.String encodeRedirectUrl(java.lang.String url)
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.lang.String encodeRedirectURL(java.lang.String url)
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.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 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 getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletResponse
public java.io.PrintWriter getWriter() throws java.io.IOException, java.io.UnsupportedEncodingException
getWriter
in interface javax.servlet.ServletResponse
java.io.UnsupportedEncodingException
- if no such encoding can be
provided
java.lang.IllegalStateException
- if getOutputStream has been called
on this same request.
java.io.IOException
- on other errors.getOutputStream()
,
setContentType(java.lang.String)
protected void flushStream(boolean close) throws java.io.IOException
close
- Close the stream if true.
java.io.IOException
- if an IO error occurs.public void setBufferSize(int size)
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
size
- the preferred buffer size
java.lang.IllegalStateException
- if this method is called after
content has been writtengetBufferSize()
,
flushBuffer()
,
isCommitted()
,
reset()
public int getBufferSize()
getBufferSize
in interface javax.servlet.ServletResponse
setBufferSize(int)
,
flushBuffer()
,
isCommitted()
,
reset()
public void flushBuffer() throws java.io.IOException
flushBuffer
in interface javax.servlet.ServletResponse
java.io.IOException
setBufferSize(int)
,
getBufferSize()
,
isCommitted()
,
reset()
public boolean isCommitted()
isCommitted
in interface javax.servlet.ServletResponse
setBufferSize(int)
,
getBufferSize()
,
flushBuffer()
,
reset()
public void reset()
IllegalStateException
.
reset
in interface javax.servlet.ServletResponse
java.lang.IllegalStateException
- if the response has already been
committedsetBufferSize(int)
,
getBufferSize()
,
flushBuffer()
,
isCommitted()
public void resetBuffer()
IllegalStateException
.
java.lang.IllegalStateException
- if the response has already been
committedsetBufferSize(int)
,
getBufferSize()
,
flushBuffer()
,
isCommitted()
public void setLocale(java.util.Locale locale)
getWriter()
. By default, the response locale
is the default locale for the server.
setLocale
in interface javax.servlet.ServletResponse
loc
- the locale of the responsegetLocale()
public java.util.Locale getLocale()
getLocale
in interface javax.servlet.ServletResponse
setLocale(java.util.Locale)
public void addHeader(java.lang.String name, java.lang.String value)
addHeader
in interface javax.servlet.http.HttpServletResponse
public void addDateHeader(java.lang.String name, long date)
addDateHeader
in interface javax.servlet.http.HttpServletResponse
public void addIntHeader(java.lang.String name, int value)
addIntHeader
in interface javax.servlet.http.HttpServletResponse
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |