View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.engine.servlet;
18  
19  import java.io.IOException;
20  import java.util.Locale;
21  
22  import javax.servlet.http.Cookie;
23  import javax.servlet.http.HttpServletResponse;
24  import javax.servlet.http.HttpServletResponseWrapper;
25  
26  import org.apache.jetspeed.container.PortletDispatcherIncludeAware;
27  
28  /***
29   * Factory implementation for creating HTTP Response Wrappers
30   *
31   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
32   * @version $Id: ServletResponseImpl.java 516448 2007-03-09 16:25:47Z ate $
33   */
34  public class ServletResponseImpl extends HttpServletResponseWrapper implements PortletDispatcherIncludeAware
35  {
36      private boolean included;
37      
38      public ServletResponseImpl(HttpServletResponse response)
39      {
40          super(response);
41      }
42  
43      public void setResponse(HttpServletResponse response) 
44      {
45          super.setResponse(response);
46      }   
47  
48      /***
49       * @param included when true, JSR-168 PLT.16.3.3 rules need to be enforced
50       */
51      public void setPortletDispatcherIncluded(boolean included)
52      {
53          this.included = included;
54      }
55      
56      /*
57       * JSR-168 PLT.16.3.3 .cxxxviii
58       * @deprecated use encodeRedirectURL instead
59       */
60      public String encodeRedirectUrl(String url)
61      {
62          return (included ? null : super.encodeRedirectUrl(url));
63      }
64  
65      /*
66       * JSR-168 PLT.16.3.3 .cxxxviii
67       */
68      public String encodeRedirectURL(String url)
69      {
70          return (included ? null : super.encodeRedirectURL(url));
71      }
72  
73      /*
74       * JSR-168 PLT.16.3.3 .cxl
75       */
76      public void addCookie(Cookie arg0)
77      {
78          if (!included)
79          {
80              super.addCookie(arg0);
81          }
82      }
83  
84      /*
85       * JSR-168 PLT.16.3.3 .cxl
86       */
87      public void addDateHeader(String arg0, long arg1)
88      {
89          if (!included)
90          {
91              super.addDateHeader(arg0, arg1);
92          }
93      }
94  
95      /*
96       * JSR-168 PLT.16.3.3 .cxl
97       */
98      public void addHeader(String arg0, String arg1)
99      {
100         if (!included)
101         {
102             super.addHeader(arg0, arg1);
103         }
104     }
105 
106     /*
107      * JSR-168 PLT.16.3.3 .cxl
108      */
109     public void addIntHeader(String arg0, int arg1)
110     {
111         if (!included)
112         {
113             super.addIntHeader(arg0, arg1);
114         }
115     }
116 
117     /*
118      * JSR-168 PLT.16.3.3 .cxl
119      */
120     public boolean containsHeader(String arg0)
121     {
122         return (included ? false : super.containsHeader(arg0));
123     }
124 
125     /*
126      * JSR-168 PLT.16.3.3 .cxl
127      */
128     public void sendError(int arg0, String arg1) throws IOException
129     {
130         if (!included)
131         {
132             super.sendError(arg0, arg1);
133         }
134     }
135 
136     /*
137      * JSR-168 PLT.16.3.3 .cxl
138      */
139     public void sendRedirect(String arg0) throws IOException
140     {
141         if (!included)
142         {
143             super.sendRedirect(arg0);
144         }
145     }
146 
147     /*
148      * JSR-168 PLT.16.3.3 .cxl
149      */
150     public void setDateHeader(String arg0, long arg1)
151     {
152         if (!included)
153         {
154             super.setDateHeader(arg0, arg1);
155         }
156     }
157 
158     /*
159      * JSR-168 PLT.16.3.3 .cxl
160      */
161     public void setHeader(String arg0, String arg1)
162     {
163         if (!included)
164         {
165             super.setHeader(arg0, arg1);
166         }
167     }
168 
169     /*
170      * JSR-168 PLT.16.3.3 .cxl
171      */
172     public void setIntHeader(String arg0, int arg1)
173     {
174         if (!included)
175         {
176             super.setIntHeader(arg0, arg1);
177         }
178     }
179 
180     /*
181      * JSR-168 PLT.16.3.3 .cxl
182      */
183     public void setStatus(int arg0, String arg1)
184     {
185         if (!included)
186         {
187             super.setStatus(arg0, arg1);
188         }
189     }
190 
191     /*
192      * JSR-168 PLT.16.3.3 .cxl
193      */
194     public void setStatus(int arg0)
195     {
196         if (!included)
197         {
198             super.setStatus(arg0);
199         }
200     }
201 
202     /*
203      * JSR-168 PLT.16.3.3 .cxl
204      */
205     public void setContentLength(int arg0)
206     {
207         if (!included)
208         {
209             super.setContentLength(arg0);
210         }
211     }
212 
213     /*
214      * JSR-168 PLT.16.3.3 .cxl
215      */
216     public void setContentType(String arg0)
217     {
218         if (!included)
219         {
220             super.setContentType(arg0);
221         }
222     }
223 
224     /*
225      * JSR-168 PLT.16.3.3 .cxl
226      */
227     public void setLocale(Locale arg0)
228     {
229         if (!included)
230         {
231             super.setLocale(arg0);
232         }
233     }
234 }