1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet;
24  
25  import com.liferay.portal.kernel.portlet.LiferayRenderResponse;
26  import com.liferay.portal.theme.PortletDisplay;
27  import com.liferay.portal.theme.ThemeDisplay;
28  import com.liferay.portal.util.WebKeys;
29  
30  import java.util.Collection;
31  
32  import javax.portlet.PortletMode;
33  import javax.portlet.PortletRequest;
34  
35  import javax.servlet.http.HttpServletResponse;
36  
37  /**
38   * <a href="RenderResponseImpl.java.html"><b><i>View Source</i></b></a>
39   *
40   * @author Brian Wing Shun Chan
41   * @author Eduardo Lundgren
42   */
43  public class RenderResponseImpl
44      extends MimeResponseImpl implements LiferayRenderResponse {
45  
46      public String getLifecycle() {
47          return PortletRequest.RENDER_PHASE;
48      }
49  
50      public String getResourceName() {
51          return _resourceName;
52      }
53  
54      public String getTitle() {
55          return _title;
56      }
57  
58      public Boolean getUseDefaultTemplate() {
59          return _useDefaultTemplate;
60      }
61  
62      public void setResourceName(String resourceName) {
63          _resourceName = resourceName;
64      }
65  
66      public void setNextPossiblePortletModes(
67          Collection<PortletMode> portletModes) {
68      }
69  
70      public void setTitle(String title) {
71          _title = title;
72  
73          // See LEP-2188
74  
75          ThemeDisplay themeDisplay =
76              (ThemeDisplay)_portletRequestImpl.getAttribute(
77                  WebKeys.THEME_DISPLAY);
78  
79          PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
80  
81          portletDisplay.setTitle(_title);
82      }
83  
84      public void setUseDefaultTemplate(Boolean useDefaultTemplate) {
85          _useDefaultTemplate = useDefaultTemplate;
86      }
87  
88      protected void init(
89          PortletRequestImpl portletRequestImpl, HttpServletResponse response,
90          String portletName, long companyId, long plid) {
91  
92          super.init(portletRequestImpl, response, portletName, companyId, plid);
93  
94          _portletRequestImpl = portletRequestImpl;
95      }
96  
97      private PortletRequestImpl _portletRequestImpl;
98      private String _title;
99      private Boolean _useDefaultTemplate;
100     private String _resourceName;
101 
102 }