Home » openejb-3.1.2-src » org.apache » openejb » webadmin » httpd » [javadoc | source]
public class: HttpResponseImpl [javadoc | source]

All Implemented Interfaces:

This class takes care of HTTP Responses. It sends data back to the browser.
Field Summary
public static final  String HTTP_VERSION    the HTTP version 
public static final  String CRLF    a line feed character 
public static final  String SP    a space character 
public static final  String CSP    a colon and space 
public static  String server    the server to send data from 
 protected HttpResponseImpl() 
 protected HttpResponseImpl(int code,
    String responseString,
    String contentType) 
    Creates a new HttpResponseImpl with user provided parameters
    code - the HTTP Response code, see http://www.ietf.org/rfc/rfc2616.txt for these codes
    responseString - the response string to be sent back
    contentType - the content type to be sent back
Method from org.apache.openejb.webadmin.httpd.HttpResponseImpl Summary:
createError,   createError,   createForbidden,   getCode,   getContentType,   getHeader,   getOutputStream,   getPrintWriter,   getResponseString,   getServerName,   reset,   reset,   setCode,   setContent,   setContentType,   setHeader,   setRequest,   setResponseString,   toString,   writeMessage
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.openejb.webadmin.httpd.HttpResponseImpl Detail:
 protected static HttpResponseImpl createError(String message) 
    This could be improved at some day in the future to also include a stack trace of the exceptions
 protected static HttpResponseImpl createError(String message,
    Throwable t) 
    creates an error with user defined variables
 protected static HttpResponseImpl createForbidden(String ip) 
    Creates a forbidden response to be sent to the browser using IP authentication
 public int getCode() 
    gets the HTTP response code
 public String getContentType() 
    gets the content type that will be sent to the browser
 public String getHeader(String name) 
    Gets a header based on the name passed in
 public OutputStream getOutputStream() 
    gets the OutputStream to send data to the browser
 public PrintWriter getPrintWriter() 
    Gets the PrintWriter to send data to the browser
 public String getResponseString() 
    Sets the response string to be sent to the browser
 public String getServerName() 
    gets the name of the server being used
 public  void reset() 
    resets the data to be sent to the browser
 public  void reset(int code,
    String responseString) 
    resets the data to be sent to the browser with the response code and response string
 public  void setCode(int code) 
    sets the HTTP response code to be sent to the browser. These codes are: OPTIONS = 0 GET = 1 HEAD = 2 POST = 3 PUT = 4 DELETE = 5 TRACE = 6 CONNECT = 7 UNSUPPORTED = 8
 public  void setContent(URLConnection content) 
 public  void setContentType(String type) 
    sets the content type to be sent back to the browser
 public  void setHeader(String name,
    String value) 
    sets a header to be sent back to the browser
 protected  void setRequest(HttpRequestImpl request) 
 public  void setResponseString(String responseString) 
    Sets the response string to be sent to the browser
 public String toString() 
    Creates a string version of the response similar to: HTTP/1.1 200 OK
 protected  void writeMessage(OutputStream output) throws IOException 
    Takes care of sending the response line, headers and body HTTP/1.1 200 OK Server: Netscape-Enterprise/3.6 SP3 Date: Thu, 07 Jun 2001 17:30:42 GMT Content-Type: text/html Connection: close