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.pluto.driver.services.container;
18  
19  import javax.servlet.http.HttpServletRequest;
20  import javax.servlet.http.HttpServletResponse;
21  
22  import org.apache.pluto.container.PortletActionResponseContext;
23  import org.apache.pluto.container.PortletContainer;
24  import org.apache.pluto.container.PortletEventResponseContext;
25  import org.apache.pluto.container.PortletRenderResponseContext;
26  import org.apache.pluto.container.PortletRequestContext;
27  import org.apache.pluto.container.PortletRequestContextService;
28  import org.apache.pluto.container.PortletResourceRequestContext;
29  import org.apache.pluto.container.PortletResourceResponseContext;
30  import org.apache.pluto.container.PortletWindow;
31  
32  /**
33   * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
34   * @version $Id: PortletRequestContextServiceImpl.java 759866 2009-03-30 08:22:50Z cziegeler $
35   */
36  public class PortletRequestContextServiceImpl implements PortletRequestContextService
37  {
38      public PortletRequestContext getPortletActionRequestContext(PortletContainer container, HttpServletRequest containerRequest,
39                                                                  HttpServletResponse containerResponse, PortletWindow window)
40      {
41          return new PortletRequestContextImpl(container, containerRequest, containerResponse, window, true);
42      }
43  
44      public PortletActionResponseContext getPortletActionResponseContext(PortletContainer container,
45                                                                          HttpServletRequest containerRequest,
46                                                                          HttpServletResponse containerResponse,
47                                                                          PortletWindow window)
48      {
49          return new PortletActionResponseContextImpl(container, containerRequest, containerResponse, window);
50      }
51  
52      public PortletRequestContext getPortletEventRequestContext(PortletContainer container, HttpServletRequest containerRequest,
53                                                                 HttpServletResponse containerResponse, PortletWindow window)
54      {
55      	return new PortletRequestContextImpl(container, containerRequest, containerResponse, window, true);
56          //return new PortletRequestContextImpl(container, containerRequest, containerResponse, window, false);
57      }
58  
59      public PortletEventResponseContext getPortletEventResponseContext(PortletContainer container,
60                                                                        HttpServletRequest containerRequest,
61                                                                        HttpServletResponse containerResponse, PortletWindow window)
62      {
63          return new PortletEventResponseContextImpl(container, containerRequest, containerResponse, window);
64      }
65  
66      public PortletRequestContext getPortletRenderRequestContext(PortletContainer container, HttpServletRequest containerRequest,
67                                                                  HttpServletResponse containerResponse, PortletWindow window)
68      {
69      	//return new PortletRequestContextImpl(container, containerRequest, containerResponse, window, false);
70          return new PortletRequestContextImpl(container, containerRequest, containerResponse, window, true);
71      }
72  
73      public PortletRenderResponseContext getPortletRenderResponseContext(PortletContainer container,
74                                                                          HttpServletRequest containerRequest,
75                                                                          HttpServletResponse containerResponse,
76                                                                          PortletWindow window)
77      {
78          return new PortletRenderResponseContextImpl(container, containerRequest, containerResponse, window);
79      }
80  
81      public PortletResourceRequestContext getPortletResourceRequestContext(PortletContainer container,
82                                                                            HttpServletRequest containerRequest,
83                                                                            HttpServletResponse containerResponse,
84                                                                            PortletWindow window)
85      {
86          return new PortletResourceRequestContextImpl(container, containerRequest, containerResponse, window);
87      }
88  
89      public PortletResourceResponseContext getPortletResourceResponseContext(PortletContainer container,
90                                                                              HttpServletRequest containerRequest,
91                                                                              HttpServletResponse containerResponse,
92                                                                              PortletWindow window)
93      {
94          return new PortletResourceResponseContextImpl(container, containerRequest, containerResponse, window);
95      }
96  }