KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opencms > core > I_CmsRequest


1 /*
2 * File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/core/I_CmsRequest.java,v $
3 * Date : $Date: 2005/05/17 13:47:28 $
4 * Version: $Revision: 1.1 $
5 *
6 * This library is part of OpenCms -
7 * the Open Source Content Mananagement System
8 *
9 * Copyright (C) 2001 The OpenCms Group
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * For further information about OpenCms, please see the
22 * OpenCms Website: http://www.opencms.org
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 */

28
29 package com.opencms.core;
30
31 import java.util.Enumeration JavaDoc;
32
33 import javax.servlet.http.HttpServletRequest JavaDoc;
34
35 /**
36  * This interface defines an OpenCms request, a generic request object that is used
37  * by OpenCms and provides methods to read the data included in the request.<p>
38  *
39  * Implementations of this interface use an existing request
40  * (e.g. HttpServletRequest) to
41  * initialize an I_CmsRequest.
42  *
43  * @author Michael Emmerich
44  * @author Alexander Kandzior
45  *
46  * @version $Revision: 1.1 $ $Date: 2005/05/17 13:47:28 $
47  *
48  * @deprecated Will not be supported past the OpenCms 6 release.
49  */

50 public interface I_CmsRequest {
51
52     /** Request context attribute name. */
53     String JavaDoc C_CMS_REQUEST = "__I_CmsRequest";
54     
55     /**
56      * Returns the content of an uploaded file.
57      * Returns null if no file with this name has been uploaded with this request.
58      * Returns an empty byte[] if a file without content has been uploaded.
59      *
60      * @param name The name of the uploaded file.
61      * @return The selected uploaded file content.
62      */

63     byte[] getFile(String JavaDoc name);
64
65     /**
66      * Returns the names of all uploaded files in this request.
67      * Returns an empty eumeration if no files were included in the request.
68      *
69      * @return An Enumeration of file names.
70      */

71     Enumeration JavaDoc getFileNames();
72
73     /**
74      * Returns the original request that was used to create the CmsRequest.
75      *
76      * @return The original request of the CmsRequest.
77      */

78     HttpServletRequest JavaDoc getOriginalRequest();
79     
80     /**
81      * Sets the original request to another value.
82      *
83      * @param request the request
84      */

85     void setOriginalRequest(HttpServletRequest JavaDoc request);
86
87     /**
88      * Returns the type of the request that was used to create the CmsRequest.
89      * The returned int must be one of the constants defined above in this interface.
90      *
91      * @return The type of the CmsRequest.
92      */

93     int getOriginalRequestType();
94
95     /**
96      * Returns the value of a named parameter as a String.
97      * Returns null if the parameter does not exist or an empty string if the parameter
98      * exists but without a value.
99      *
100      * @param name The name of the parameter.
101      * @return The value of the parameter.
102      */

103     String JavaDoc getParameter(String JavaDoc name);
104
105     /**
106      * Returns all parameter names as an Enumeration of String objects.
107      * Returns an empty Enumeratrion if no parameters were included in the request.
108      *
109      * @return Enumeration of parameter names.
110      */

111     Enumeration JavaDoc getParameterNames();
112
113     /**
114      * Returns all parameter values of a parameter key.
115      *
116      * @param key the parameter key
117      * @return Aarray of String containing the parameter values.
118      */

119     String JavaDoc[] getParameterValues(String JavaDoc key);
120
121     /**
122      * This funtion returns the name of the requested resource.
123      * <P>
124      * For a http request, the name of the resource is extracted as follows:
125      * <CODE>http://{servername}/{servletpath}/{path to the cms resource}</CODE>
126      * In the following example:
127      * <CODE>http://my.work.server/servlet/opencms/system/def/explorer</CODE>
128      * the requested resource is <CODE>/system/def/explorer</CODE>.
129      * </P>
130      *
131      * @return The path to the requested resource.
132      */

133     String JavaDoc getRequestedResource();
134     
135     /**
136      * Set the name returned by getRequestedResource().
137      * This is required in case there was a folder name requested and
138      * a default file (e.g. index.html) has to be used instead of the folder.
139      *
140      * @param resourceName The name to set the requested resource name to
141      */

142     void setRequestedResource(String JavaDoc resourceName);
143
144     /**
145      * Returns the part of the Url that descibes the Web-Application.
146      *
147      * E.g: http://www.myserver.com/opencms/engine/index.html returns
148      * http://www.myserver.com/opencms
149      *
150      * @return the webapp url
151      */

152     String JavaDoc getWebAppUrl();
153
154     /**
155      * Gets the part of the Url that describes the current servlet of this
156      * Web-Application.
157      *
158      * @return the servlet url
159      */

160     String JavaDoc getServletUrl();
161
162     /**
163      * Methods to get the data from the original request.
164      *
165      * @return the server name
166      */

167     String JavaDoc getServerName();
168     
169     /**
170      * Methods to get the data from the original request.
171      *
172      * @return the scheme
173      */

174     String JavaDoc getScheme();
175     
176     /**
177      * Methods to get the data from the original request.
178      *
179      * @return the server port
180      */

181     int getServerPort();
182 }
183
Popular Tags