KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openejb > webadmin > 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 dev@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://www.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 1912 2005-06-16 22:29:56Z jlaskowski $
44  */

45 package org.openejb.webadmin;
46
47 /**This interface takes care of HTTP Responses. It sends data back to the browser.
48  *
49  * @author <a HREF="mailto:david.blevins@visi.com">David Blevins</a>
50  */

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

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

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

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

72     public java.io.OutputStream JavaDoc getOutputStream();
73
74     /** sets the HTTP response code to be sent to the browser. These codes are:
75      *
76      * OPTIONS = 0
77      * GET = 1
78      * HEAD = 2
79      * POST = 3
80      * PUT = 4
81      * DELETE = 5
82      * TRACE = 6
83      * CONNECT = 7
84      * UNSUPPORTED = 8
85      * @param code the code to be sent to the browser
86      */

87     public void setCode(int code);
88
89     /** gets the HTTP response code
90      * @return the HTTP response code
91      */

92     public int getCode();
93
94     /** sets the content type to be sent back to the browser
95      * @param type the type to be sent to the browser (i.e. "text/html")
96      */

97     public void setContentType(String JavaDoc type);
98
99     /** gets the content type that will be sent to the browser
100      * @return the content type (i.e. "text/html")
101      */

102     public String JavaDoc getContentType();
103
104     /** Sets the response string to be sent to the browser
105      * @param responseString the response string
106      */

107     public void setResponseString(String JavaDoc responseString);
108
109     /** resets the data to be sent to the browser */
110     public void reset();
111
112     /** resets the data to be sent to the browser with the response code and response
113      * string
114      * @param code the code to be sent to the browser
115      * @param responseString the response string to be sent to the browser
116      */

117     public void reset(int code, String JavaDoc responseString);
118
119     /** gets the name of the server being used
120      * @return the name of the server
121      */

122     public String JavaDoc getServerName();
123 }
124
Popular Tags