KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openejb > server > httpd > HttpResponse


1 /**
2  * Redistribution and use of this software and associated documentation
3  * ("Software"), with or without modification, are permitted provided
4  * that the following conditions are met:
5  *
6  * 1. Redistributions of source code must retain copyright
7  * statements and notices. Redistributions must also contain a
8  * copy of this document.
9  *
10  * 2. Redistributions in binary form must reproduce the
11  * above copyright notice, this list of conditions and the
12  * following disclaimer in the documentation and/or other
13  * materials provided with the distribution.
14  *
15  * 3. The name "OpenEJB" must not be used to endorse or promote
16  * products derived from this Software without prior written
17  * permission of The OpenEJB Group. For written permission,
18  * please contact openejb@openejb.org.
19  *
20  * 4. Products derived from this Software may not be called "OpenEJB"
21  * nor may "OpenEJB" appear in their names without prior written
22  * permission of The OpenEJB Group. OpenEJB is a registered
23  * trademark of The OpenEJB Group.
24  *
25  * 5. Due credit should be given to the OpenEJB Project
26  * (http://openejb.org/).
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
29  * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
30  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
31  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
32  * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
39  * OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
42  *
43  * $Id: HttpResponse.java,v 1.1 2004/12/17 05:10:23 dblevins Exp $
44  */

45 package org.openejb.server.httpd;
46
47 import java.io.OutputStream JavaDoc;
48
49 /**This interface takes care of HTTP Responses. It sends data back to the browser.
50  *
51  */

52 public interface HttpResponse extends java.io.Serializable JavaDoc{
53     /** sets a header to be sent back to the browser
54      * @param name the name of the header
55      * @param value the value of the header
56      */

57     public void setHeader(String JavaDoc name, String JavaDoc value);
58
59     /** Gets a header based on the name passed in
60      * @param name The name of the header
61      * @return the value of the header
62      */

63     public String JavaDoc getHeader(String JavaDoc name);
64
65     /** Gets the PrintWriter to send data to the browser
66      * @return the PrintWriter to send data to the browser
67      */

68     public java.io.PrintWriter JavaDoc getPrintWriter();
69
70     /** gets the OutputStream to send data to the browser
71      * @return the OutputStream to send data to the browser
72      */

73     public java.io.OutputStream JavaDoc getOutputStream();
74
75     /** sets the content type to be sent back to the browser
76      * @param type the type to be sent to the browser (i.e. "text/html")
77      */

78     public void setContentType(String JavaDoc type);
79
80     /** gets the content type that will be sent to the browser
81      * @return the content type (i.e. "text/html")
82      */

83     public String JavaDoc getContentType();
84
85     /** sets the HTTP response code to be sent to the browser. These codes are:
86      *
87      * OPTIONS = 0
88      * GET = 1
89      * HEAD = 2
90      * POST = 3
91      * PUT = 4
92      * DELETE = 5
93      * TRACE = 6
94      * CONNECT = 7
95      * UNSUPPORTED = 8
96      * @param code the code to be sent to the browser
97      */

98     void setStatusCode(int code);
99
100     /** gets the HTTP response code
101      * @return the HTTP response code
102      */

103     int getStatusCode();
104
105     /** Sets the response string to be sent to the browser
106      * @param responseString the response string
107      */

108     void setStatusMessage(String JavaDoc responseString);
109
110 }
111
Popular Tags