| java.lang.Object org.w3c.jigsaw.servlet.JigsawHttpServletResponse
JigsawHttpServletResponse | public class JigsawHttpServletResponse implements HttpServletResponse(Code) | | author: Alexandre Rafalovitch author: Anselm Baird-Smith author: Benoît Mahé (bmahe@w3.org) author: Roland Mainz (Roland.Mainz@informatik.med.uni-giessen.de) |
Method Summary | |
public void | addCookie(Cookie cookie) Adds the specified cookie to the response. | public void | addDateHeader(String name, long date) | public void | addHeader(String name, String value) | public void | addIntHeader(String name, int value) | public boolean | containsHeader(String header) Checks whether the response message header has a field with the
specified name. | public String | encodeRedirectURL(String url) Encodes the specified URL for use in the sendRedirect method or, if
encoding is not needed, returns the URL unchanged. | public String | encodeRedirectUrl(String url) Encodes the specified URL for use in the sendRedirect method or, if
encoding is not needed, returns the URL unchanged. | public String | encodeURL(String url) Encodes the specified URL by including the session ID in it, or, if
encoding is not needed, returns the URL unchanged. | public String | encodeUrl(String url) Encodes the specified URL by including the session ID in it, or, if
encoding is not needed, returns the URL unchanged. | public void | flushBuffer() Forces any content in the buffer to be written to the client. | protected synchronized void | flushStream(boolean close) Flush the output stream. | public int | getBufferSize() Returns the actual buffer size used for the response. | public String | getCharacterEncoding() | synchronized ServletOutputStream | getJigsawOutputStream(boolean writerUsed) | public Locale | getLocale() Returns the locale assigned to the response. | public synchronized ServletOutputStream | getOutputStream() Returns an output stream for writing binary response data.
A ServletOutputStream exception: IOException - if an I/O exception has occurred exception: IllegalStateException - if getWriter has been called on this same request. | protected synchronized OutputStream | getRawOutputStream() returns the raw output stream regardless of what happened before
used for internal operation (e.g. | protected Reply | getReply() | public synchronized PrintWriter | getWriter() Returns a print writer for writing formatted text responses. | public boolean | isCommitted() Returns a boolean indicating if the response has been
committed. | protected boolean | isStreamObtained() | synchronized void | notifyClient() | public void | reset() Clears any data that exists in the buffer as well as the status code and
headers. | public void | resetBuffer() Clears any data that exists in the buffer but not status code and
headers. | public synchronized void | sendError(int i, String msg) Sends an error response to the client using the specified status code
and descriptive message. | public synchronized void | sendError(int i) Sends an error response to the client using the specified status
code and a default message. | public synchronized void | sendRedirect(String url) Sends a temporary redirect response to the client using the specified
redirect location URL. | public void | setBufferSize(int size) Sets the preferred buffer size for the body of the response. | public void | setContentLength(int i) Sets the content length for this response. | public void | setContentType(String spec) Sets the content type for this response. | public void | setDateHeader(String name, long date) Adds a field to the response header with the given name and date-valued
field. | public void | setHeader(String name, String value) Adds a field to the response header with the given name and value. | public void | setIntHeader(String name, int value) Adds a field to the response header with the given name and integer
value. | public void | setLocale(Locale locale) Sets the locale of the response, setting the headers (including the
Content-Type's charset) as appropriate. | protected void | setServletRequest(JigsawHttpServletRequest jrequest) | public void | setStatus(int i, String reason) Sets the status code and message for this response. | public void | setStatus(int i) Sets the status code for this response. | public void | unsetHeader(String name) |
CHARSET_PARAMETER | final public static String CHARSET_PARAMETER(Code) | | |
DEFAULT_BUFFER_SIZE | final public static int DEFAULT_BUFFER_SIZE(Code) | | |
MIN_BUFFER_SIZE | final public static int MIN_BUFFER_SIZE(Code) | | |
buffer_size | protected int buffer_size(Code) | | |
addCookie | public void addCookie(Cookie cookie)(Code) | | Adds the specified cookie to the response. It can be called multiple
times to set more than one cookie.
Parameters: cookie - - the Cookie to return to the client |
addDateHeader | public void addDateHeader(String name, long date)(Code) | | |
addIntHeader | public void addIntHeader(String name, int value)(Code) | | |
containsHeader | public boolean containsHeader(String header)(Code) | | Checks whether the response message header has a field with the
specified name.
Parameters: name - - the header field name true if the response message header has a field with the specified name; false otherwise |
encodeRedirectURL | public String encodeRedirectURL(String url)(Code) | | Encodes the specified URL for use in the 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.
Parameters: url - - the url to be encoded. the encoded URL if encoding is needed; the unchanged URL otherwise. See Also: JigsawHttpServletResponse.sendRedirect See Also: JigsawHttpServletResponse.encodeUrl |
encodeRedirectUrl | public String encodeRedirectUrl(String url)(Code) | | Encodes the specified URL for use in the 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.
Parameters: url - - the url to be encoded. the encoded URL if encoding is needed; the unchanged URL otherwise. See Also: JigsawHttpServletResponse.sendRedirect See Also: JigsawHttpServletResponse.encodeUrl |
encodeURL | public String encodeURL(String url)(Code) | | Encodes the specified URL by including the session ID in it, 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. For example, if the browser supports
cookies, or session tracking is turned off, URL encoding is unnecessary.
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.
Parameters: url - - the url to be encoded. the encoded URL if encoding is needed; the unchanged URL otherwise. |
encodeUrl | public String encodeUrl(String url)(Code) | | Encodes the specified URL by including the session ID in it, 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. For example, if the browser supports
cookies, or session tracking is turned off, URL encoding is unnecessary.
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.
Parameters: url - - the url to be encoded. the encoded URL if encoding is needed; the unchanged URL otherwise. |
flushStream | protected synchronized void flushStream(boolean close) throws IOException(Code) | | Flush the output stream.
Parameters: close - Close the stream if true. exception: IOException - if an IO error occurs. |
getCharacterEncoding | public String getCharacterEncoding()(Code) | | Return the Charset parameter of content type
A String instance |
getRawOutputStream | protected synchronized OutputStream getRawOutputStream()(Code) | | returns the raw output stream regardless of what happened before
used for internal operation (e.g. writing an exception trailer).
an underlying output stream if available (even when a writer isused) |
isStreamObtained | protected boolean isStreamObtained()(Code) | | |
notifyClient | synchronized void notifyClient()(Code) | | |
sendError | public synchronized void sendError(int i, String msg) throws IOException(Code) | | Sends an error response to the client using the specified status code
and descriptive message. If setStatus has previously been called, it is
reset to the error status code. The message is sent as the body of an
HTML page, which is returned to the user to describe the problem. The
page is sent with a default HTML header; the message is enclosed in
simple body tags ().
Parameters: sc - - the status code Parameters: msg - - the detail message exception: IOException - If an I/O error has occurred. |
sendError | public synchronized void sendError(int i) throws IOException(Code) | | Sends an error response to the client using the specified status
code and a default message.
Parameters: sc - - the status code exception: IOException - If an I/O error has occurred. |
sendRedirect | public synchronized void sendRedirect(String url) throws IOException(Code) | | Sends a temporary redirect response to the client using the specified
redirect location URL. The URL must be absolute (for example,
https://hostname/path/file.html). Relative URLs are not permitted here.
Parameters: url - - the redirect location URL exception: IOException - If an I/O error has occurred. |
setBufferSize | public void setBufferSize(int size)(Code) | | Sets the preferred buffer size for the body of the response.
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, 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 .
Parameters: size - the preferred buffer size exception: IllegalStateException - if this method is called aftercontent has been written See Also: JigsawHttpServletResponse.getBufferSize See Also: JigsawHttpServletResponse.flushBuffer See Also: JigsawHttpServletResponse.isCommitted See Also: JigsawHttpServletResponse.reset |
setContentLength | public void setContentLength(int i)(Code) | | Sets the content length for this response.
Parameters: len - - the content length |
setContentType | public void setContentType(String spec)(Code) | | Sets the content type for this response. This type may later be
implicitly modified by addition of properties such as the MIME
charset= if the service finds it necessary, and the appropriate
media type property has not been set.
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.
Parameters: spec - - the content's MIME type See Also: JigsawHttpServletResponse.getOutputStream See Also: JigsawHttpServletResponse.getWriter |
setDateHeader | public void setDateHeader(String name, long date)(Code) | | Adds a field to the response header with the given name and date-valued
field. The date is specified in terms of milliseconds since the epoch.
If the date field had 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.
Parameters: name - - the name of the header field Parameters: value - - the header field's date value See Also: JigsawHttpServletResponse.containsHeader See Also: |
setHeader | public void setHeader(String name, String value)(Code) | | Adds a field to the response header with the given name and value. If
the field had 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.
Parameters: name - - the name of the header field Parameters: value - - the header field's value See Also: JigsawHttpServletResponse.containsHeader |
setIntHeader | public void setIntHeader(String name, int value)(Code) | | Adds a field to the response header with the given name and integer
value. If the field had 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.
Parameters: name - - the name of the header field Parameters: value - - the header field's integer value See Also: JigsawHttpServletResponse.containsHeader |
setStatus | public void setStatus(int i, String reason)(Code) | | Sets the status code and message for this response. If the field had
already been set, the new value overwrites the previous one. The message
is sent as the body of an HTML page, which is returned to the user to
describe the problem. The page is sent with a default HTML header; the
message is enclosed in simple body tags ().
Parameters: i - - the status code Parameters: reason - - the status message |
setStatus | public void setStatus(int i)(Code) | | Sets the status code for this response. This method is used to set the
return status code when there is no error (for example, for the status
codes SC_OK or SC_MOVED_TEMPORARILY). If there is an error, the
sendError method should be used instead.
Parameters: i - - the status code See Also: JigsawHttpServletResponse.sendError |
|
|