![]() |
Quadcap Embeddable Server |
Inheritance diagram for com.quadcap.http.server22.HttpResponse:

This interface allows a servlet's service method to manipulate HTTP-protocol specified header information and return data to its client. It is implemented by network service developers for use within servlets.
Definition at line 74 of file HttpResponse.java.
Public Member Functions | |
| HttpResponse (WebWorker w) | |
| Construct a new HttpResponse for the specified worker. | |
| void | reset (HttpOutputStream os) |
| void | writeHeaders () throws IOException |
| Write the result code and the message headers for the response. | |
| void | setContentLength (int len) |
| Sets the content length for this response. | |
| void | setContentType (String type) |
| Sets the content type for this response. | |
| ServletOutputStream | getOutputStream () throws IOException |
| Returns an output stream for writing binary response data. | |
| PrintWriter | getWriter () throws IOException |
| Returns a print writer for writing formatted text responses. | |
| JspWriter | getJspWriter (int bufferSize, boolean autoFlush) throws IOException |
| String | getCharacterEncoding () |
| Returns the character set encoding used for this MIME body. | |
| void | addCookie (Cookie cookie) |
| Adds the specified cookie to the response. | |
| boolean | containsHeader (String name) |
| Checks whether the response message header has a field with the specified name. | |
| void | setStatus (int sc, String sm) |
| Sets the status code and message for this response. | |
| void | setStatus (int sc) |
| Sets the status code for this response. | |
| void | setHeader (String name, String value) |
| Adds a field to the response header with the given name and value. | |
| void | addHeader (String name, String value) |
| Add a new header value -- this method allows multiple headers with the same name. | |
| void | setIntHeader (String name, int value) |
| Adds a field to the response header with the given name and integer value. | |
| void | addIntHeader (String name, int value) |
| void | setDateHeader (String name, long date) |
| Adds a field to the response header with the given name and date-valued field. | |
| void | addDateHeader (String name, long date) |
| void | sendError (int scode, String msg) throws IOException |
| Sends an error response to the client using the specified status code and descriptive message. | |
| void | sendError (int scode) throws IOException |
| Sends an error response to the client using the specified status code and a default message. | |
| void | sendRedirect (String location) throws IOException |
| Sends a temporary redirect response to the client using the specified redirect location URL. | |
| 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. | |
| String | encodeURL (String url) |
| String | encodeRedirectUrl (String url) |
Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged. | |
| String | encodeRedirectURL (String url) |
| void | flushBuffer () throws IOException |
| void | setBufferSize (int size) throws IllegalStateException |
| int | getBufferSize () |
| boolean | isCommitted () |
| void | reset () throws IllegalStateException |
| void | setLocale (Locale locale) |
| Locale | getLocale () |
Public Attributes | |
| boolean | getWriterCalled = false |
| boolean | getOutputStreamCalled = false |
Package Functions | |
| void | setProtocol (String p) |
| void | setKeepAlive (boolean v) |
| final void | writeHeader (WorkerOutputStream out, String name, String val) throws IOException |
| final void | writeDateHeader (WorkerOutputStream out) throws IOException |
| void | writeAttr (WorkerOutputStream out, String name, String val) throws IOException |
| void | writeCookies (WorkerOutputStream out) throws IOException |
| final void | setFixedHeader (String name, String val) |
| final void | maybeSetContentLength (int len) |
| int | getContentLength () |
| final void | appendHeader (String name, String value) |
| void | flush () throws IOException |
| Flush the underlying output stream. | |
Static Package Functions | |
| [static initializer] | |
| final void | write (OutputStream out, String s) throws IOException |
Package Attributes | |
| WebWorker | w |
| Hashtable | headers = new Hashtable() |
| String | protocol |
| int | sc = SC_OK |
| String | sm = "Request Completed" |
| boolean | changedCode = false |
| Locale | defaultLocale = Locale.getDefault() |
| Locale | locale = defaultLocale |
| int | contentLength = -1 |
| String | contentType = null |
| StringBuffer | headerBuf = new StringBuffer() |
| boolean | headerBufValid = true |
| boolean | anyHeaders = false |
| boolean | keepAlive = false |
| byte[] | fixedHeaders = null |
| ByteArrayOutputStream | fixedH = new ByteArrayOutputStream() |
| HttpOutputStream | os |
| PrintWriter | writer = null |
| JspWriter | jWriter = new JspWriter(8192, true) |
| boolean | jWriterInit = false |
| Vector | cookies = null |
| long | calbase = -1 |
| byte[] | curTime = null |
Static Package Attributes | |
| DateFormat | cookieDateFormat |
| TimeZone | GMT |
| SimpleDateFormat | df |
| SimpleDateFormat | df2 |
| final byte[] | headerSep = { (byte)':', (byte) } |
| final byte[] | CRLF = { (byte)'\r', (byte)'\n' } |
| final byte[] | OKRESPONSE |
| final byte[] | CONTENT_TYPE = "Content-Type: ".getBytes() |
| final byte[] | CONTENT_LENGTH = "Content-Length: ".getBytes() |
| final byte[] | CONNECTION_KEEPALIVE |
| final byte[] | CONNECTION_CLOSE |
| final byte[] | DEFAULT_CONTENT_TYPE |
| byte[] | digits = "0123456789".getBytes() |
| byte[] | GMTString = " GMT\r\n".getBytes() |
Private Member Functions | |
| final void | writeTok (WorkerOutputStream out, String val, int v) throws IOException |
Static Private Member Functions | |
| boolean | isToken (String value) |
| Return true iff the string counts as an HTTP/1.1 "token". | |
Static Private Attributes | |
| final String | tspecials = "()<>@,;:\\\"/[]?={} \t" |
|
|
Construct a new HttpResponse for the specified worker.
Definition at line 125 of file HttpResponse.java. |
|
|
|
|
|
Adds the specified cookie to the response. It can be called multiple times to set more than one cookie.
Definition at line 507 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.addCookie(), and com.quadcap.http.server22.HttpResponse.cookies. Referenced by com.quadcap.http.server22.HttpResponse.addCookie(), and com.quadcap.http.server22.HttpRequest.getSession(). |
|
||||||||||||
|
Definition at line 667 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.addDateHeader(), and com.quadcap.http.server22.HttpResponse.df2. Referenced by com.quadcap.http.server22.HttpResponse.addDateHeader(). |
|
||||||||||||
|
Add a new header value -- this method allows multiple headers with the same name.
Definition at line 608 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.addHeader(), com.quadcap.http.server22.HttpResponse.anyHeaders, and com.quadcap.http.server22.HttpResponse.headers. Referenced by com.quadcap.http.server22.HttpResponse.addHeader(). |
|
||||||||||||
|
Definition at line 645 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.addIntHeader(). Referenced by com.quadcap.http.server22.HttpResponse.addIntHeader(). |
|
||||||||||||
|
Definition at line 597 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.appendHeader(), and com.quadcap.http.server22.HttpResponse.headerBuf. Referenced by com.quadcap.http.server22.HttpResponse.appendHeader(), and com.quadcap.http.server22.HttpResponse.setHeader(). |
|
|
Checks whether the response message header has a field with the specified name.
Definition at line 527 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.containsHeader(), and com.quadcap.http.server22.HttpResponse.headers. Referenced by com.quadcap.http.server22.HttpResponse.containsHeader(). |
|
|
Definition at line 794 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.encodeRedirectURL(). Referenced by com.quadcap.http.server22.HttpResponse.encodeRedirectURL(). |
|
|
Encodes the specified URL for use in the
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 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.
Definition at line 791 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.encodeRedirectUrl(). Referenced by com.quadcap.http.server22.HttpResponse.encodeRedirectUrl(). |
|
|
Definition at line 767 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.encodeURL(). Referenced by com.quadcap.http.server22.HttpResponse.encodeURL(). |
|
|
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.
Definition at line 764 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.encodeUrl(). Referenced by com.quadcap.http.server22.HttpResponse.encodeUrl(). |
|
|
Flush the underlying output stream.
Definition at line 728 of file HttpResponse.java. References com.quadcap.http.server22.HttpOutputStream.flush(), com.quadcap.http.server22.HttpResponse.os, and com.quadcap.http.server22.HttpResponse.writer. Referenced by com.quadcap.http.server22.WebWorker.doSession(), and com.quadcap.http.server22.HttpResponse.sendError(). |
|
|
Definition at line 798 of file HttpResponse.java. References com.quadcap.http.server22.HttpOutputStream.flushBuffered(), com.quadcap.http.server22.HttpResponse.os, and com.quadcap.http.server22.HttpResponse.writer. |
|
|
Definition at line 807 of file HttpResponse.java. References com.quadcap.http.server22.HttpOutputStream.getBufferSize(), and com.quadcap.http.server22.HttpResponse.os. |
|
|
Returns the character set encoding used for this MIME body. The character encoding is either the one specified in the assigned content type, or one which the client understands. If no content type has yet been assigned, it is implicitly set to text/plain Definition at line 477 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.contentType. Referenced by com.quadcap.http.server22.HttpResponse.getWriter(). |
|
|
Definition at line 388 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.contentLength. Referenced by com.quadcap.http.server22.WebWorker.doSession(). |
|
||||||||||||
|
|
Definition at line 845 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.locale. |
|
|
Returns an output stream for writing binary response data.
Definition at line 416 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.getOutputStreamCalled, com.quadcap.http.server22.HttpResponse.getWriterCalled, and com.quadcap.http.server22.HttpResponse.os. Referenced by com.quadcap.http.server22.HttpResponse.getWriter(), and com.quadcap.http.server22.WebWorker.showException(). |
|
|
Returns a print writer for writing formatted text responses. The MIME type of the response will be modified, if necessary, to reflect the character encoding used, through the charset=... property. This means that the content type must be set before calling this method.
Definition at line 438 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.getCharacterEncoding(), com.quadcap.http.server22.HttpResponse.getOutputStream(), com.quadcap.http.server22.HttpResponse.getOutputStreamCalled, com.quadcap.http.server22.HttpResponse.getWriterCalled, com.quadcap.http.server22.HttpResponse.os, and com.quadcap.http.server22.HttpResponse.writer. Referenced by com.quadcap.http.server22.HttpResponse.sendError(), and com.quadcap.http.server22.WebWorker.showException(). |
|
|
Definition at line 811 of file HttpResponse.java. References com.quadcap.http.server22.HttpOutputStream.isCommitted(), and com.quadcap.http.server22.HttpResponse.os. |
|
|
Return true iff the string counts as an HTTP/1.1 "token".
Definition at line 298 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.isToken(), and com.quadcap.http.server22.HttpResponse.tspecials. Referenced by com.quadcap.http.server22.HttpResponse.isToken(). |
|
|
Definition at line 382 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.contentLength, and com.quadcap.http.server22.HttpResponse.maybeSetContentLength(). Referenced by com.quadcap.http.server22.HttpOutputStream.flushBuffered(), and com.quadcap.http.server22.HttpResponse.maybeSetContentLength(). |
|
|
|
|
Sends an error response to the client using the specified status code and a default message.
Definition at line 710 of file HttpResponse.java. References com.quadcap.http.server22.HttpOutputStream.discard(), com.quadcap.http.server22.HttpResponse.flush(), com.quadcap.http.server22.HttpResponse.getOutputStreamCalled, com.quadcap.http.server22.HttpResponse.getWriter(), com.quadcap.http.server22.HttpResponse.getWriterCalled, com.quadcap.http.server22.HttpResponse.os, com.quadcap.http.server22.HttpResponse.sm, and com.quadcap.http.server22.HttpResponse.writer. |
|
||||||||||||
|
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 (<body></body>).
Definition at line 684 of file HttpResponse.java. References com.quadcap.http.server22.HttpOutputStream.discard(), com.quadcap.http.server22.HttpResponse.flush(), com.quadcap.http.server22.HttpResponse.getOutputStreamCalled, com.quadcap.http.server22.HttpResponse.getWriter(), com.quadcap.http.server22.HttpResponse.getWriterCalled, com.quadcap.http.server22.HttpResponse.os, com.quadcap.http.server22.HttpResponse.sendError(), and com.quadcap.http.server22.HttpResponse.writer. Referenced by com.quadcap.http.server22.WebWorker.doSession(), and com.quadcap.http.server22.HttpResponse.sendError(). |
|
|
Sends a temporary redirect response to the client using the specified redirect location URL.
The URL must be absolute (for example,
Definition at line 742 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.sendRedirect(). Referenced by com.quadcap.http.server22.HttpResponse.sendRedirect(). |
|
|
Definition at line 803 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.os, com.quadcap.http.server22.HttpOutputStream.setBufferSize(), and com.quadcap.http.server22.HttpResponse.setBufferSize(). Referenced by com.quadcap.http.server22.HttpResponse.setBufferSize(). |
|
|
Sets the content length for this response.
Definition at line 378 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.contentLength, and com.quadcap.http.server22.HttpResponse.setContentLength(). Referenced by com.quadcap.http.server22.HttpResponse.setContentLength(). |
|
|
Sets the content type for this response. This type may later be implicitly modified by addition of properties such as the MIME charset=<value> 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
Definition at line 405 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.contentType, and com.quadcap.http.server22.HttpResponse.setContentType(). Referenced by com.quadcap.http.server22.HttpResponse.setContentType(), and com.quadcap.http.server22.WebWorker.showException(). |
|
||||||||||||
|
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
Definition at line 662 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.df2, and com.quadcap.http.server22.HttpResponse.setDateHeader(). Referenced by com.quadcap.http.server22.HttpResponse.setDateHeader(). |
|
||||||||||||
|
Definition at line 360 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.CRLF, com.quadcap.http.server22.HttpResponse.fixedH, and com.quadcap.http.server22.HttpResponse.setFixedHeader(). Referenced by com.quadcap.http.server22.WebWorker.init(), and com.quadcap.http.server22.HttpResponse.setFixedHeader(). |
|
||||||||||||
|
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
Definition at line 576 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.anyHeaders, com.quadcap.http.server22.HttpResponse.appendHeader(), com.quadcap.http.server22.HttpResponse.contentLength, com.quadcap.http.server22.HttpResponse.contentType, com.quadcap.http.server22.HttpResponse.headerBufValid, com.quadcap.http.server22.HttpResponse.headers, and com.quadcap.http.server22.HttpResponse.setHeader(). Referenced by com.quadcap.http.server22.HttpResponse.setHeader(). |
|
||||||||||||
|
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
Definition at line 641 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.setIntHeader(). Referenced by com.quadcap.http.server22.HttpResponse.setIntHeader(). |
|
|
Definition at line 153 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.setKeepAlive(). Referenced by com.quadcap.http.server22.WebWorker.doSession(), and com.quadcap.http.server22.HttpResponse.setKeepAlive(). |
|
|
Definition at line 834 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.setLocale(). Referenced by com.quadcap.http.server22.HttpResponse.setLocale(). |
|
|
Definition at line 149 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.setProtocol(). Referenced by com.quadcap.http.server22.WebWorker.doSession(), and com.quadcap.http.server22.HttpResponse.setProtocol(). |
|
|
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
Definition at line 558 of file HttpResponse.java. |
|
||||||||||||
|
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 (<body></body>).
Definition at line 542 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.setStatus(). Referenced by com.quadcap.http.server22.HttpResponse.setStatus(). |
|
||||||||||||
|
Definition at line 157 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.write(). Referenced by com.quadcap.http.server22.HttpResponse.write(). |
|
||||||||||||||||
|
Definition at line 281 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.writeAttr(). Referenced by com.quadcap.http.server22.HttpResponse.writeAttr(). |
|
|
|
||||||||||||||||
|
Definition at line 176 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.CRLF, com.quadcap.http.server22.HttpResponse.headerSep, and com.quadcap.http.server22.HttpResponse.writeHeader(). Referenced by com.quadcap.http.server22.HttpResponse.writeHeader(). |
|
|
||||||||||||||||
|
Definition at line 309 of file HttpResponse.java. References com.quadcap.http.server22.HttpResponse.writeTok(). Referenced by com.quadcap.http.server22.HttpResponse.writeTok(). |
|
|
Definition at line 88 of file HttpResponse.java. Referenced by com.quadcap.http.server22.HttpResponse.addHeader(), com.quadcap.http.server22.HttpResponse.reset(), com.quadcap.http.server22.HttpResponse.setHeader(), and com.quadcap.http.server22.HttpResponse.writeHeaders(). |
|
|
Definition at line 102 of file HttpResponse.java. Referenced by com.quadcap.http.server22.HttpResponse.writeDateHeader(). |
|
|
Definition at line 80 of file HttpResponse.java. Referenced by com.quadcap.http.server22.HttpResponse.reset(), and com.quadcap.http.server22.HttpResponse.writeHeaders(). |
|