org.locomotive.loco
Class HTTPResponse
java.lang.Object
|
+--org.locomotive.loco.Response
|
+--org.locomotive.loco.servlet.LocoServletResponse
|
+--org.locomotive.loco.HTTPResponse
- public class HTTPResponse
- extends LocoServletResponse
The response class for regular HTTP requests.
It uses the Response outputStream for its HTTPOutputStream,
and its own internal printwriter for the printWriter
Constructor Summary |
HTTPResponse(java.io.OutputStream os,
int request_id)
|
Method Summary |
void |
addHTTPHeader(java.lang.String name,
java.lang.String value)
adds an HTTP protocol header to the response. |
boolean |
containsHeader(java.lang.String name)
Returns true if a header with the specified name has been set. |
int |
getHeaderCount()
returns the number of items currently scheduled to be sent in the
HTTP header |
void |
writeHeader(Log server_log)
This writes the headers to the OutputStream in correct protocol. |
Methods inherited from class org.locomotive.loco.servlet.LocoServletResponse |
addStatusToHeaders,
encodeRedirectUrl,
encodeRedirectURL,
encodeUrl,
encodeURL,
generateInclude,
getOutputStream,
getWriter,
sendError,
sendError,
sendRedirect,
setContentLength,
setDateHeader,
setHeader,
setIntHeader,
setStatus,
setStatus |
Methods inherited from class org.locomotive.loco.Response |
addBytes,
addCookie,
addString,
clearBody,
clearHeaders,
flush,
flush,
getCharacterEncoding,
getCurrentResponseLength,
setAutoflush,
setContentType |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
used_writer
protected boolean used_writer
used_os
protected boolean used_os
resw
protected java.io.PrintWriter resw
HTTPResponse
public HTTPResponse(java.io.OutputStream os,
int request_id)
addHTTPHeader
public void addHTTPHeader(java.lang.String name,
java.lang.String value)
- adds an HTTP protocol header to the response. Adding any headers
after the first flush() will be ineffective, since the HTTP
header has already been sent off to the webserver/client.
The values will be formatted in a manner appropriate for
HTTP - similar to RFC 822 - " Name: Value "
An example might be "Pragma: no-cache"
- Overrides:
- addHTTPHeader in class Response
- Parameters:
name
- - the namevalue
- - the value associated with name.
getHeaderCount
public int getHeaderCount()
- returns the number of items currently scheduled to be sent in the
HTTP header
- Overrides:
- getHeaderCount in class Response
containsHeader
public boolean containsHeader(java.lang.String name)
- Returns true if a header with the specified name has been set.
- Overrides:
- containsHeader in class Response
writeHeader
public void writeHeader(Log server_log)
throws java.io.IOException
- This writes the headers to the OutputStream in correct protocol.
This get's called automatically when either of the two
inner stream flush, so we don't have to worry about calling it
explicitly.
- Overrides:
- writeHeader in class LocoServletResponse