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


Inner classes inherited from class org.locomotive.loco.Response
Response.ResponseOutputStream
 
Field Summary
protected  java.io.PrintWriter resw
           
protected  boolean used_os
           
protected  boolean used_writer
           
 
Fields inherited from class org.locomotive.loco.servlet.LocoServletResponse
resw, status, used_os, used_writer
 
Fields inherited from class org.locomotive.loco.Response
char_encoding, content_type, header_was_flushed, os, reply_type, REPLY_TYPE_CGI, REPLY_TYPE_ISAPI, REPLY_TYPE_NSAPI, request_id, resos
 
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
 

Field Detail

used_writer

protected boolean used_writer

used_os

protected boolean used_os

resw

protected java.io.PrintWriter resw
Constructor Detail

HTTPResponse

public HTTPResponse(java.io.OutputStream os,
                    int request_id)
Method Detail

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 name
value - - 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