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

1   /*
2    * $Id: AbstractViewRequest.java 1229087 2012-01-09 10:35:14Z 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  package org.apache.tiles.request;
22  
23  import java.io.IOException;
24  
25  
26  /**
27   * Base class for "view" requests, i.e. requests created into view technologies,
28   * such as JSP, Velocity and Freemarker. In particular, all calls to
29   * {@link #dispatch(String)} will cause an inclusion and never a forward.
30   *
31   * @version $Rev: 1229087 $ $Date: 2012-01-09 21:35:14 +1100 (Mon, 09 Jan 2012) $
32   */
33  public class AbstractViewRequest extends DispatchRequestWrapper {
34  
35      /**
36       * Constructor.
37       *
38       * @param request The base request.
39       */
40      public AbstractViewRequest(DispatchRequest request) {
41          super(request);
42      }
43  
44      @Override
45      public void dispatch(String path) throws IOException {
46          setForceInclude(true);
47          doInclude(path);
48      }
49  
50      @Override
51      public void include(String path) throws IOException {
52          setForceInclude(true);
53          doInclude(path);
54      }
55  
56      /**
57       * Includes the result. By default, uses the wrapped request for the inclusion.
58       *
59       * @param path The path whose result will be included.
60       * @throws IOException If something goes wrong.
61       */
62      protected void doInclude(String path) throws IOException {
63          getWrappedRequest().include(path);
64      }
65  }