This project has retired. For details please refer to its Attic page.
DefaultRequestWrapper xref
View Javadoc

1   /*
2    * $Id: DefaultRequestWrapper.java 1332134 2012-04-30 09:23:19Z mck $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  package org.apache.tiles.request;
23  
24  import java.io.IOException;
25  import java.io.OutputStream;
26  import java.io.PrintWriter;
27  import java.io.Writer;
28  import java.util.Collections;
29  import java.util.List;
30  import java.util.Locale;
31  import java.util.Map;
32  
33  import org.apache.tiles.request.attribute.Addable;
34  
35  /**
36   * Delegate for ease of customization.
37   *
38   * @version $Rev: 1215009 $ $Date: 2011-12-16 01:32:31 +0100 (Fri, 16 Dec 2011) $
39   */
40  public class DefaultRequestWrapper implements RequestWrapper {
41  
42      /**
43       * The wrapper request context object.
44       */
45      private Request context;
46  
47      /**
48       * Constructor.
49       *
50       * @param context
51       *            The request context to wrap.
52       */
53      public DefaultRequestWrapper(Request context) {
54          this.context = context;
55      }
56  
57      /** {@inheritDoc} */
58      public Request getWrappedRequest() {
59          return context;
60      }
61  
62      /** {@inheritDoc} */
63      public Map<String, String> getHeader() {
64          return context.getHeader();
65      }
66  
67      /** {@inheritDoc} */
68      public Map<String, String[]> getHeaderValues() {
69          return context.getHeaderValues();
70      }
71  
72      /** {@inheritDoc} */
73      public Addable<String> getResponseHeaders() {
74          return context.getResponseHeaders();
75      }
76  
77      /** {@inheritDoc} */
78      public ApplicationContext getApplicationContext() {
79          return context.getApplicationContext();
80      }
81  
82      /** {@inheritDoc} */
83      public OutputStream getOutputStream() throws IOException {
84          return context.getOutputStream();
85      }
86  
87      /** {@inheritDoc} */
88      public Writer getWriter() throws IOException {
89          return context.getWriter();
90      }
91  
92      /** {@inheritDoc} */
93      public PrintWriter getPrintWriter() throws IOException {
94          return context.getPrintWriter();
95      }
96  
97      /** {@inheritDoc} */
98      public boolean isResponseCommitted() {
99          return context.isResponseCommitted();
100     }
101 
102     /** {@inheritDoc} */
103     public Map<String, String> getParam() {
104         return context.getParam();
105     }
106 
107     /** {@inheritDoc} */
108     public Map<String, String[]> getParamValues() {
109         return context.getParamValues();
110     }
111 
112     /** {@inheritDoc} */
113     public Locale getRequestLocale() {
114         return context.getRequestLocale();
115     }
116 
117     /** {@inheritDoc} */
118     public boolean isUserInRole(String role) {
119         return context.isUserInRole(role);
120     }
121 
122     /** {@inheritDoc} */
123     public Map<String, Object> getContext(String scope) {
124         return context.getContext(scope);
125     }
126 
127     /** {@inheritDoc} */
128     public List<String> getAvailableScopes() {
129         return context.getAvailableScopes();
130     }
131 }