Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
MutableServletRequest | 33 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software 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 GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.wysiwyg.server.filter; | |
21 | ||
22 | import java.io.IOException; | |
23 | ||
24 | import javax.servlet.ServletRequest; | |
25 | import javax.servlet.ServletResponse; | |
26 | ||
27 | /** | |
28 | * A servlet request that can be modified. It is very useful, for instance, when you need to change the values of some | |
29 | * request parameters, inside a filter. | |
30 | * | |
31 | * @version $Id: e4e159ea815f3c466668b3f77436bdba8285d7ee $ | |
32 | */ | |
33 | public interface MutableServletRequest extends ServletRequest | |
34 | { | |
35 | /** | |
36 | * Sets the value of a request parameter. | |
37 | * | |
38 | * @param name the name of the request parameter | |
39 | * @param value the new value of the request parameter | |
40 | * @return the old value of the specified request parameter, or {@code null} if this is the first time we set its | |
41 | * value | |
42 | */ | |
43 | String setParameter(String name, String value); | |
44 | ||
45 | /** | |
46 | * Sets the values of a request parameter. | |
47 | * | |
48 | * @param name the name of the request parameter | |
49 | * @param values the new array of values for the specified request parameter | |
50 | * @return the old values of the specified request parameter, or {@code null} if this is the first time we set its | |
51 | * values | |
52 | */ | |
53 | String[] setParameterValues(String name, String[] values); | |
54 | ||
55 | /** | |
56 | * Removes the request parameter with the specified name. | |
57 | * | |
58 | * @param name a string representing the name of the request parameter to be removed | |
59 | * @return the old value of the specified request parameter, or {@code null} if it wasn't set | |
60 | */ | |
61 | String removeParameter(String name); | |
62 | ||
63 | /** | |
64 | * Redirects this request to the specified URL. We had to add this method since there's no generic way to redirect a | |
65 | * {@link ServletRequest}. | |
66 | * | |
67 | * @param response the response object used to redirect | |
68 | * @param url the location where to redirect | |
69 | * @throws IOException if the redirect fails | |
70 | */ | |
71 | void sendRedirect(ServletResponse response, String url) throws IOException; | |
72 | ||
73 | /** | |
74 | * @return the URL of the requester | |
75 | */ | |
76 | String getReferer(); | |
77 | ||
78 | /** | |
79 | * @param attrName the name of the session attribute whose value should be retrieved | |
80 | * @return the value of the specified session attribute | |
81 | */ | |
82 | Object getSessionAttribute(String attrName); | |
83 | ||
84 | /** | |
85 | * Sets the value of a session attribute. | |
86 | * | |
87 | * @param attrName the name of the session attribute | |
88 | * @param attrValue the value to be set | |
89 | * @return the previous value of the specified session attribute | |
90 | */ | |
91 | Object setSessionAttribute(String attrName, Object attrValue); | |
92 | ||
93 | /** | |
94 | * @return the request object wrapped by this object | |
95 | */ | |
96 | ServletRequest getRequest(); | |
97 | } |