KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > boot > RequestHandlerRequest


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.boot;
21
22 import java.io.InputStream JavaDoc;
23 import java.io.UnsupportedEncodingException JavaDoc;
24 import java.util.Enumeration JavaDoc;
25 import java.util.Map JavaDoc;
26
27 import javax.servlet.http.Cookie JavaDoc;
28
29 /**
30  * Encapsulates a request received by the server implementation and passed on to
31  * all registered {@link com.sslexplorer.boot.RequestHandler} implementations.
32  *
33  *
34  * @author Brett Smith <a HREF="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
35  * @see com.sslexplorer.boot.RequestHandler
36  */

37 public interface RequestHandlerRequest {
38
39
40     static final int REQUEST_SCOPE = 1;
41     static final int SESSION_SCOPE = 2;
42     /**
43      * Get the URI for the request
44      *
45      * @return uri
46      */

47
48     public String JavaDoc getURIEncoded();
49
50     /**
51      * Get if the request was made securely (i.e. HTTPS).
52      *
53      * @return is secure
54      */

55     public boolean isSecure();
56
57     /**
58      * Get the value of an HTTP header field sent by the client given its name.
59      * If more than one header exists then the first value will be returned.
60      * <p>
61      * <code>null</code> will be returned if no such header was sent.
62      *
63      * @param name
64      * name of header
65      * @return header value
66      */

67     public String JavaDoc getField(String JavaDoc name);
68
69     /**
70      * Get an enumeration of values for all HTTP header fields sent by the
71      * client that have the given name.
72      *
73      * @param name
74      * name of
75      * @return enumeration of header names
76      */

77     public Enumeration JavaDoc getFieldValues(String JavaDoc name);
78
79     /**
80      * Get the request method. E.g. GET, POST etc
81      *
82      * @return request method
83      */

84     public String JavaDoc getMethod();
85
86     /**
87      * Get an enumeration of all HTTP header field names
88      *
89      * @return enumeration of all HTTP header field names
90      */

91     public Enumeration JavaDoc getFieldNames();
92
93     /**
94      * Get the request path
95      *
96      * @return get request path
97      */

98     public String JavaDoc getPath();
99
100     /**
101      * Return all request parameters as a map.
102      *
103      * @return request parameters as map
104      */

105     public Map JavaDoc getParameters();
106
107     /**
108      * Get the request host name. The host is obtained either from an absolute
109      * URI, the <i>Host</i> request header, the connection or the local host
110      * name.
111      *
112      * @return host
113      */

114     public String JavaDoc getHost();
115
116     /**
117      * Get the request input stream
118      *
119      * @return request input stream
120      */

121     public InputStream JavaDoc getInputStream();
122
123     /**
124      * Get the request port. The port is obtained either from an absolute URI,
125      * the <i>Host</i> request header, the connection or the default.
126      * <p>
127      * A value of 0 should be interpreted as the default port for the type of
128      * connection
129      *
130      * @return port
131      */

132     public int getPort();
133
134     /**
135      * Configure a tunnel for this request. See {@link RequestHandlerTunnel} for
136      * more details.
137      *
138      * @param tunnel
139      * tunnel
140      */

141     public void setTunnel(RequestHandlerTunnel tunnel);
142     
143     
144     /**
145      * Configure a tunnel with a socket timeout.
146      * @param tunnel
147      * @param timeoutMs
148      */

149     public void setTunnel(RequestHandlerTunnel tunnel, int timeoutMs);
150     
151
152     /**
153      * Get the IP address of the client that made the request
154      *
155      * @return remote address
156      */

157     public String JavaDoc getRemoteAddr();
158
159     /**
160      * Get the host name of the client that made the request. If the IP address
161      * could not be resolved the IP address will be returned.
162      *
163      * @return remote host name or address
164      */

165     public String JavaDoc getRemoteHost();
166
167     /**
168      * Get an array of all the cookies sent with this request.
169      *
170      * @return array of cookies
171      */

172     public Cookie JavaDoc[] getCookies();
173     
174     
175     /**
176      * Set an arbitrary attribute on the request.
177      *
178      * @param name name
179      * @param value value
180      */

181     public void setAttribute(String JavaDoc name, Object JavaDoc value);
182     
183     /**
184      * Get the value of a previously set request attribute.
185      *
186      * @param name name
187      * @return value or <code>null</code> if no such attribute exists
188      */

189     public Object JavaDoc getAttribute(String JavaDoc name);
190     
191     /**
192      * Set the character encoding of the request. This is used to decode string parameters
193      * in POST methods.
194      * @param charset
195      * @throws UnsupportedEncodingException
196      */

197     public void setCharacterEncoding(String JavaDoc charset) throws UnsupportedEncodingException JavaDoc;
198     
199     /**
200      * Get the content type for this request. This is retrieved from
201      * the <i>Content-Type</i> header.
202      *
203      * @return content type
204      */

205     public String JavaDoc getContentType();
206     
207     /**
208      * Get the content length for this request. This is retrieved from
209      * the <i>Content-Length</i> header.
210      *
211      * @return content length
212      */

213     public int getContentLength();
214
215 }
216
Popular Tags