KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > portlet > PortletRequest


1 /* ====================================================================
2  * The Apache Software License, Version 1.1
3  *
4  * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
5  * reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in
16  * the documentation and/or other materials provided with the
17  * distribution.
18  *
19  * 3. The end-user documentation included with the redistribution,
20  * if any, must include the following acknowledgment:
21  * "This product includes software developed by the
22  * Apache Software Foundation (http://www.apache.org/)."
23  * Alternately, this acknowledgment may appear in the software itself,
24  * if and wherever such third-party acknowledgments normally appear.
25  *
26  * 4. The names "Apache" and "Apache Software Foundation" and
27  * "Apache Jetspeed" must not be used to endorse or promote products
28  * derived from this software without prior written permission. For
29  * written permission, please contact apache@apache.org.
30  *
31  * 5. Products derived from this software may not be called "Apache" or
32  * "Apache Jetspeed", nor may "Apache" appear in their name, without
33  * prior written permission of the Apache Software Foundation.
34  *
35  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46  * SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of the Apache Software Foundation. For more
51  * information on the Apache Software Foundation, please see
52  * <http://www.apache.org/>.
53  */

54
55 package org.apache.jetspeed.portlet;
56
57 import java.util.Locale JavaDoc;
58 import java.util.Map JavaDoc;
59 import java.util.Enumeration JavaDoc;
60
61 /**
62  ** The <CODE>PortletRequest</CODE> encapsulates the request sent by the
63  ** client to the portlet.
64  **
65  ** @see PortletResponse
66  **
67  ** @author <A HREF="mailto:tboehme@us.ibm.com">Thomas F. Boehme</A>
68  **/

69
70 public interface PortletRequest
71 {
72     /**
73      ** Returns the mode that the portlet is running in.
74      **
75      ** @return the portlet mode
76      **/

77
78     public Portlet.Mode getMode ();
79
80     /**
81      ** Returns the HTTP method of this request. The most commonly
82      ** used request methods are GET and POST.
83      **
84      ** @return the method
85      **/

86
87     public String JavaDoc getMethod ();
88
89     /**
90      ** Returns the locale of the preferred language. The preference
91      ** is based on the user's choice of language(s) and/or the
92      ** client's Accept-Language header.
93      ** <P>
94      ** If more than one language is preferred, the locale returned by
95      ** this method is the one with the highest preference.
96      **
97      ** @return the locale of the preferred language
98      **/

99
100     public Locale JavaDoc getLocale ();
101
102     /**
103      ** Returns an object representing the client device that the
104      ** user connects to the portal with.
105      **
106      ** @return the client
107      **/

108
109     public Client getClient ();
110
111     /**
112      ** Returns the value of the parameter with the given name,
113      ** or <CODE>null</CODE> if no such parameter exists.
114      **
115      ** <P>
116      ** You should only use this method when you are sure the
117      ** parameter has only one value. If not, use
118      ** <CODE>getParameterValues(String)</CODE>
119      **
120      ** @param name
121      ** the parameter name
122      **
123      ** @return the parameter value
124      **
125      ** @see #getParameterMap()
126      ** @see #getParameterValues(String)
127      **/

128
129     public String JavaDoc getParameter (String JavaDoc name);
130
131     /**
132      ** Returns a map of the parameters of this request.
133      **
134      ** @return a map of parameters
135      **
136      ** @see #getParameter(String)
137      ** @see #getParameterValues(String)
138      **/

139
140     public Map JavaDoc getParameterMap ();
141
142     /**
143      ** Returns an enumeration of all parameter names. If this
144      ** request
145      **
146      ** @return the enumeration
147      **/

148
149     public Enumeration JavaDoc getParameterNames ();
150
151     /**
152      ** Returns the values of all parameters with the
153      ** given name.
154      ** <P>
155      ** A request can carry more than one parameter with a
156      ** certain name. This method returns these parameters
157      ** in the order of appearance.
158      **
159      ** @param name
160      ** the parameter name
161      **
162      ** @return the array of parameter values
163      **
164      ** @see #getParameterMap()
165      ** @see #getParameter(String)
166      **/

167
168     public String JavaDoc [] getParameterValues (String JavaDoc name);
169
170     /**
171      ** Associates an attribute with the given name and value
172      ** with this request. If a portlet needs to communicate
173      ** information to embedded servlets or JSP, this methods
174      ** can used carry the information along.
175      **
176      ** <P>
177      ** The portlet provider should take care that the
178      ** the namespace of attribute names is not unnecessarily
179      ** polluted. It is recommended to prefix all attributes
180      ** the package and class name of the portlet that
181      ** makes use of this method.
182      **
183      ** @param name
184      ** the attribute name
185      ** @param value
186      ** the attribute value
187      **/

188
189     public void setAttribute (String JavaDoc name, Object JavaDoc value);
190
191     /**
192      ** Removes the attribute with the given name.
193      **
194      ** @param name
195      ** the name of attribute to be removed
196      **/

197
198     public void removeAttribute (String JavaDoc name);
199
200    /**
201      ** Returns the value of the attribute with the given name,
202      ** or <CODE>null</CODE> if no attribute with the given name exists.
203      **
204      ** @param name
205      ** the attribute name
206      **
207      ** @return the attribute value
208      **/

209
210     public Object JavaDoc getAttribute (String JavaDoc name);
211
212     /**
213      ** Returns an enumeration of names of all attributes available to
214      ** this request. This method returns an empty enumeration if the
215      ** request has no attributes available to it.
216      **
217      ** @return an enumeration of attribute names
218      **/

219
220     public Enumeration JavaDoc getAttributeNames ();
221
222     /**
223      ** Returns whether this request was made using a secure channel, such
224      ** as HTTPS.
225      **
226      ** @return <CODE>true</CODE> if channel is secure, <BR>
227      ** <CODE>false</CODE> otherwise
228      **/

229
230     public boolean isSecure ();
231
232     /**
233      ** Returns the window that the portlet is running in.
234      **
235      ** @return the portlet window
236      **/

237
238     public PortletWindow getWindow ();
239
240     /**
241      ** Returns the data of the virtual instance of this portlet
242      ** <P>
243      ** If the portlet is run in CONFIGURE mode, the
244      ** portlet data is not accessible and this method will
245      ** return <CODE>null</CODE>.
246      ** </P>
247      **
248      ** @return the portlet data
249      **/

250
251     public PortletData getData ();
252
253     /**
254      ** Returns the current session or, if there is no current session,
255      ** it creates one and returns it.
256      **
257      ** @return the portlet session
258      **/

259
260     public PortletSession getSession ();
261
262     /**
263      ** Returns the current session or, if there is no current session
264      ** and the given flag is <CODE>true</CODE>, it creates one and returns
265      ** it.
266      **
267      ** <P>
268      ** If the given flag is <CODE>false</CODE> and there is no current
269      ** portlet session, this method returns <CODE>null</CODE>.
270      **
271      ** @param create
272      ** <CODE>true</CODE> to create a news session, <BR>
273      ** <CODE>false</CODE> to return <CODE>null</CODE> of there
274      ** is no current session
275      **
276      ** @return the portlet session
277      **/

278
279     public PortletSession getSession (boolean create);
280 }
281
Popular Tags