KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > appserver > server > httpPresentation > HttpPresentationRequest


1
2 /*
3  * Enhydra Java Application Server Project
4  *
5  * The contents of this file are subject to the Enhydra Public License
6  * Version 1.1 (the "License"); you may not use this file except in
7  * compliance with the License. You may obtain a copy of the License on
8  * the Enhydra web site ( http://www.enhydra.org/ ).
9  *
10  * Software distributed under the License is distributed on an "AS IS"
11  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
12  * the License for the specific terms governing rights and limitations
13  * under the License.
14  *
15  * The Initial Developer of the Enhydra Application Server is Lutris
16  * Technologies, Inc. The Enhydra Application Server and portions created
17  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
18  * All Rights Reserved.
19  *
20  * Contributor(s):
21  *
22  * $Id: HttpPresentationRequest.java,v 1.1 2005/07/13 11:09:06 slobodan Exp $
23  */

24
25
26
27
28
29 package com.lutris.appserver.server.httpPresentation;
30
31 import java.util.Enumeration JavaDoc;
32
33 import javax.servlet.http.Cookie JavaDoc;
34 import javax.servlet.http.HttpServletRequest JavaDoc;
35
36
37 /**
38  * Object passed to presentation objects that is used to access HTTP request
39  * data.
40  */

41 public interface HttpPresentationRequest {
42     /**
43      * Returns the original HttpServletRequest.
44      */

45     public HttpServletRequest JavaDoc getHttpServletRequest();
46
47     /**
48      * Returns the size of the request entity data, or -1 if not known. Same
49      * as the CGI variable CONTENT_LENGTH.
50      */

51     public int getContentLength()
52     throws HttpPresentationException;
53
54     /**
55      * Returns the Internet Media Type of the request entity data, or null if
56      * not known. Same as the CGI variable CONTENT_TYPE.
57      */

58     public String JavaDoc getContentType()
59     throws HttpPresentationException;
60
61     /**
62      * Returns the protocol and version of the request as a string of
63      * the form <code>&lt;protocol&gt;/&lt;major version&gt;.&lt;minor
64      * version&gt</code>. Same as the CGI variable SERVER_PROTOCOL.
65      */

66     public String JavaDoc getProtocol()
67     throws HttpPresentationException;
68
69     /**
70      * Returns the scheme of the URL used in this request, for example
71      * "http", "https", or "ftp". Different schemes have different
72      * rules for constructing URLs, as noted in RFC 1738. The URL used
73      * to create a request may be reconstructed using this scheme, the
74      * server name and port, and additional information such as URIs.
75      */

76     public String JavaDoc getScheme();
77
78     /**
79      * Returns the host name of the server that received the request.
80      * Same as the CGI variable SERVER_NAME.
81      */

82     public String JavaDoc getServerName();
83
84     /**
85      * Returns the port number on which this request was received.
86      * Same as the CGI variable SERVER_PORT.
87      */

88     public int getServerPort();
89
90     /**
91      * Returns the IP address of the agent that sent the request. Same as the
92      * CGI variable REMOTE_ADDR.
93      */

94     public String JavaDoc getRemoteAddr()
95     throws HttpPresentationException;
96
97     /**
98      * Returns the fully qualified host name of the agent that sent the
99      * request. Same as the CGI variable REMOTE_HOST.
100      */

101     public String JavaDoc getRemoteHost()
102     throws HttpPresentationException;
103
104     /**
105      * Returns an input stream for reading the request body.
106      */

107     public HttpPresentationInputStream getInputStream()
108     throws HttpPresentationException;
109
110     /**
111      * Returns a string containing the lone value of the specified query
112      * parameter, or null if the parameter does not exist. Presentation
113      * writers should use this method only when they are sure that there is
114      * only one value for the parameter. If the parameter has (or could have)
115      * multiple values, then use getParameterValues. If a multiple valued
116      * parameter name is passed as an argument, the return value is
117      * implementation dependent.
118      *
119      * @param name the name of the parameter whose value is required.
120      * @see HttpPresentationRequest#getParameterValues
121      */

122     public String JavaDoc getParameter(String JavaDoc name)
123     throws HttpPresentationException;
124
125     /**
126      * Returns the values of the specified query parameter for the request as
127      * an array of strings, or a 0 length array if the named parameter does
128      * not exist.
129      *
130      * @param name the name of the parameter whose value is required.
131      */

132     public String JavaDoc[] getParameterValues(String JavaDoc name)
133     throws HttpPresentationException;
134
135     /**
136      * Returns the parameter names for this request as an enumeration
137      * of strings, or an empty enumeration if there are no parameters.
138      */

139     public Enumeration JavaDoc getParameterNames()
140     throws HttpPresentationException;
141
142     //Omitted: public Object getAttribute(String name);
143

144     /**
145      * Returns the method with which the request was made. The returned
146      * value can be "GET", "HEAD", "POST", or an extension method. Same
147      * as the CGI variable REQUEST_METHOD.
148      */

149     public String JavaDoc getMethod()
150     throws HttpPresentationException;
151
152     /**
153      * Returns the request URI as a URL.
154      */

155     public String JavaDoc getRequestURI()
156     throws HttpPresentationException;
157
158     /**
159      * Returns the presentation URI.
160      */

161     public String JavaDoc getPresentationURI()
162         throws HttpPresentationException;
163
164     /**
165      * Returns the part of the request URI that refers to the application
166      * object being invoked. Analogous to the CGI variable SCRIPT_NAME.
167      *
168      * @deprecated This method was named in a confusing manner; it
169      * returns the application, not presentation object path. Use
170      * <A HREF="getApplicationPath.html">getApplicationPath()</A>.
171      */

172     public String JavaDoc getPresentationPath()
173     throws HttpPresentationException;
174
175     /**
176      * Returns the part of the request URI that refers to the presentation
177      * object being invoked.
178      */

179     public String JavaDoc getPresentationObjectPath()
180         throws HttpPresentationException;
181
182     /**
183      * Returns the part of the request URI after the presentation
184      * manager servlet, upto and including the presentation object .po,
185      * but not any path info.
186      */

187     public String JavaDoc getPresentationObjectRelativePath()
188         throws HttpPresentationException;
189
190     /**
191      * Returns the part of the request URI that refers to the application.
192      * Analogous to the CGI variable SCRIPT_NAME.
193      */

194     public String JavaDoc getApplicationPath()
195     throws HttpPresentationException;
196
197     /**
198      * Returns optional extra path information following the presentation
199      * path, but immediately preceding the query string. Returns null if
200      * not specified. Same as the CGI variable PATH_INFO.
201      */

202     public String JavaDoc getPathInfo()
203     throws HttpPresentationException;
204
205     /**
206      * Returns extra path information translated to a real path. Returns
207      * null if no extra path information specified. Same as the CGI variable
208      * PATH_TRANSLATED.
209      */

210     public String JavaDoc getPathTranslated()
211     throws HttpPresentationException;
212
213     /**
214      * Returns the query string part of the presentation URI, or null if none.
215      * Same as the CGI variable QUERY_STRING.
216      */

217     public String JavaDoc getQueryString()
218     throws HttpPresentationException;
219
220     /**
221      * Returns the name of the user making this request, or null if not
222      * known. The user name is set with HTTP authentication. Whether
223      * the user name will continue to be sent with each subsequent
224      * communication is browser-dependent. Same as the CGI variable
225      * REMOTE_USER.
226      */

227     public String JavaDoc getRemoteUser()
228     throws HttpPresentationException;
229
230     /**
231      * Returns the authentication scheme of the request, or null if none.
232      * Same as the CGI variable AUTH_TYPE.
233      */

234     public String JavaDoc getAuthType()
235     throws HttpPresentationException;
236
237     /**
238      * Gets the array of cookies found in this request.
239      *
240      * @return The array of cookies found in this request.
241      */

242     public Cookie JavaDoc[] getCookies()
243     throws HttpPresentationException;
244
245     /**
246      * Indicates whether client submitted their session id through a cookie
247      * @return true if client submitted their sessionId via a cookie,
248      * false otherwise
249      */

250     public boolean isRequestedSessionIdFromCookie()
251     throws HttpPresentationException;
252
253     /*
254      * set the flag indicating whether the sessionId came from a cookie
255      * @param isFromCookie boolean indicating whether sessionId came
256      * from cookie
257      */

258     public void setRequestedSessionIdFromCookie(boolean isFromCookie)
259     throws HttpPresentationException;
260
261     /**
262      * Indicates whether client submitted their sessionId through a
263      * rewritten url
264      * @return true if client submitted their sessionId via a rewritten url,
265      * false otherwise
266      */

267     public boolean isRequestedSessionIdFromUrl()
268     throws HttpPresentationException;
269
270    
271     /*
272      * set the flag indicating whether the sessionId came from a url
273      * @param isFromUrl boolean indicating whether sessionId came from url
274      */

275     public void setRequestedSessionIdFromUrl(boolean isFromUrl)
276     throws HttpPresentationException;
277
278     /**
279      * Returns the value of a header field, or null if not known.
280      * The case of the header field name is ignored.
281      * @param name the case-insensitive header field name
282      */

283     public String JavaDoc getHeader(String JavaDoc name)
284     throws HttpPresentationException;
285
286     /**
287      * Returns the value of an integer header field, or -1 if not found.
288      * The case of the header field name is ignored.
289      * @param name the case-insensitive header field name
290      */

291     public int getIntHeader(String JavaDoc name)
292     throws HttpPresentationException;
293
294     /**
295      * Returns the value of a date header field, or -1 if not found.
296      * The case of the header field name is ignored.
297      * @param name the case-insensitive header field name
298      */

299     public long getDateHeader(String JavaDoc name)
300     throws HttpPresentationException;
301
302     /**
303      * Returns an enumeration of strings representing the header names
304      * for this request. Some server implementations do not allow headers
305      * to be accessed in this way, in which case this method will return null.
306      */

307     public Enumeration JavaDoc getHeaderNames()
308     throws HttpPresentationException;
309
310     /**
311      * Get the URI path for a file in the application. This converts a path
312      * to the file part of the URL. It adds in the reference to application
313      * servlet.
314      *
315      * @param file File with in the application. Currently this must
316      * be a path relative to the presentation prefix.
317      * @return The file path portion of the URL, starting with
318      * a <CODE>/</CODE>.
319      */

320     public String JavaDoc getAppFileURIPath(String JavaDoc file)
321     throws HttpPresentationException;
322 }
323
Popular Tags