KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > WebPageRequest


1 /*
2  * Created on Jul 28, 2003
3  *
4 /*
5
6 /*
7 Copyright (c) 2003 eInnovation Inc. All rights reserved
8
9 This library is free software; you can redistribute it and/or modify it under the terms
10 of the GNU Lesser General Public License as published by the Free Software Foundation;
11 either version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
14 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 See the GNU Lesser General Public License for more details.
16 */

17 package com.openedit;
18
19 import java.io.OutputStream JavaDoc;
20 import java.io.Writer JavaDoc;
21 import java.util.Map JavaDoc;
22
23 import javax.servlet.http.HttpServletRequest JavaDoc;
24 import javax.servlet.http.HttpServletResponse JavaDoc;
25 import javax.servlet.http.HttpSession JavaDoc;
26
27 import com.openedit.page.Page;
28 import com.openedit.page.PageAction;
29 import com.openedit.page.PageStreamer;
30 import com.openedit.users.User;
31
32 /**
33  * @author Matt Avery, mavery@einnovation.com
34  */

35 public interface WebPageRequest
36 {
37     HttpServletRequest JavaDoc getRequest();
38     
39     HttpServletResponse JavaDoc getResponse();
40     
41     HttpSession JavaDoc getSession();
42     
43     /**
44      * The redirect will send the browser to a new page
45      * This looses any parameters to the original page
46      * @param inInUrl can begin with http or be a path /index.html
47      */

48     void redirect( String JavaDoc inUrl );
49     
50     /**
51      * This is used to tell search engines to use the new links
52      * @param inPath
53      */

54     public void redirectPermanently( String JavaDoc inPath);
55
56     /**
57      * This will simply render a new page instead of the page the user
58      * was expecting
59      *
60      * @param inInUrl should be a path such as /index.html
61      */

62     void forward( String JavaDoc inUrl )throws OpenEditException;
63     
64     /**
65      * Convenience methods for managing Velocity context objects.
66      */

67     Object JavaDoc getPageValue( String JavaDoc inKey );
68     
69     String JavaDoc getPageProperty(String JavaDoc inKey );
70
71     String JavaDoc getContentProperty(String JavaDoc inKey );
72
73     void putPageValue( String JavaDoc inKey, Object JavaDoc inObject );
74     
75     /**
76      * <p>
77      * Add a protected page value to this page request. Protected values are
78      * reserved for use by OpenEdit itself and should not be overriden in
79      * general practice.
80      * </p>
81      * @param inKey
82      * @param inObject
83      */

84     void putProtectedPageValue(String JavaDoc inKey, Object JavaDoc inObject);
85     
86     void removePageValue( String JavaDoc inKey );
87     
88     Map JavaDoc getPageMap();
89     
90     /**
91      * Convenience methods for managing session objects.
92      */

93     Object JavaDoc getSessionValue( String JavaDoc inKey );
94     
95     void putSessionValue( String JavaDoc inKey, Object JavaDoc inObject );
96     
97     void removeSessionValue( String JavaDoc inKey );
98         
99     String JavaDoc getRequestParameter( String JavaDoc inKey );
100
101     String JavaDoc[] getRequestParameters( String JavaDoc inKey );
102         
103     void setRequestParameter( String JavaDoc inKey, String JavaDoc inValue );
104     
105     void setRequestParameter( String JavaDoc inKey, String JavaDoc[] inValue );
106
107     /**
108      *
109      * @return a mutable map of the request parameters
110      */

111     Map JavaDoc getParameterMap();
112     
113     // This may not be necessary
114
String JavaDoc getRequiredParameter( String JavaDoc inParameterName ) throws OpenEditException;
115
116     User getUser();
117
118     /**
119      * @param inObject
120      */

121     void setUser(User inUser);
122
123     /**
124      * This is the path to the content
125      */

126     String JavaDoc getPath();
127     
128     /**
129      * This is the page that this context refers to in the getPath() method
130      * @return
131      */

132     Page getPage();
133     /**
134      * Is the full path to the page you are on. This includes any arguments or parameters
135      * @return fullpath
136      */

137     String JavaDoc getPathUrl();
138     
139     OutputStream JavaDoc getOutputStream();
140     
141     Writer JavaDoc getWriter();
142     
143     PageStreamer getPageStreamer();
144     
145     void putPageStreamer( PageStreamer inStreamer );
146
147     /**
148      * @return
149      */

150     boolean hasRedirected();
151     boolean hasForwarded();
152     void setHasRedirected(boolean inB);
153     void setHasForwarded(boolean inB);
154
155     /**
156      * @return
157      */

158     Page getContentPage();
159     
160     /**
161      * Determine whether this page can be edited by the given user. The page is editable if:
162      *
163      * <ul>
164      * <li>
165      * the page's repository is not read-only;
166      * </li>
167      * <li>
168      * the "editable" property is not present or equal to "true"; and
169      * </li>
170      * <li>
171      * the edit filter is not present or passes the given user.
172      * </li>
173      * </ul>
174      *
175      *
176      * @param inUser The user to query
177      * @param inContext DOCME
178      *
179      * @return boolean <code>true</code> if the page is editable by the user, <code>false</code>
180      * if not
181      *
182      * @throws OpenEditException DOCME
183      */

184     public boolean isEditable();
185
186     public void setEditable(boolean inEdi);
187     
188     public String JavaDoc[] getRequestActions();
189
190     /**
191      * @return
192      */

193     WebPageRequest copy();
194
195     /**
196      * @param inPage
197      * @return
198      */

199     WebPageRequest copy(Page inPage);
200
201     /**
202      * @param inPage
203      */

204     void setPage(Page inPage);
205
206     WebPageRequest getParent();
207
208     /**
209      * @param inAction
210      */

211     void setCurrentAction(PageAction inAction);
212
213     PageAction getCurrentAction();
214
215     String JavaDoc getLocale();
216
217     String JavaDoc getLanguage();
218
219     String JavaDoc getUserName();
220
221 }
222
Popular Tags