001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet;
016    
017    import com.liferay.portal.kernel.portlet.LiferayRenderResponse;
018    import com.liferay.portal.theme.PortletDisplay;
019    import com.liferay.portal.theme.ThemeDisplay;
020    import com.liferay.portal.util.WebKeys;
021    
022    import java.util.Collection;
023    
024    import javax.portlet.PortletMode;
025    import javax.portlet.PortletRequest;
026    
027    import javax.servlet.http.HttpServletResponse;
028    
029    /**
030     * @author Brian Wing Shun Chan
031     * @author Eduardo Lundgren
032     */
033    public class RenderResponseImpl
034            extends MimeResponseImpl implements LiferayRenderResponse {
035    
036            @Override
037            public String getLifecycle() {
038                    return PortletRequest.RENDER_PHASE;
039            }
040    
041            public String getResourceName() {
042                    return _resourceName;
043            }
044    
045            public String getTitle() {
046                    return _title;
047            }
048    
049            public Boolean getUseDefaultTemplate() {
050                    return _useDefaultTemplate;
051            }
052    
053            public void setResourceName(String resourceName) {
054                    _resourceName = resourceName;
055            }
056    
057            public void setNextPossiblePortletModes(
058                    Collection<PortletMode> portletModes) {
059            }
060    
061            public void setTitle(String title) {
062                    _title = title;
063    
064                    // See LEP-2188
065    
066                    ThemeDisplay themeDisplay =
067                            (ThemeDisplay)_portletRequestImpl.getAttribute(
068                                    WebKeys.THEME_DISPLAY);
069    
070                    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
071    
072                    portletDisplay.setTitle(_title);
073            }
074    
075            public void setUseDefaultTemplate(Boolean useDefaultTemplate) {
076                    _useDefaultTemplate = useDefaultTemplate;
077            }
078    
079            @Override
080            protected void init(
081                    PortletRequestImpl portletRequestImpl, HttpServletResponse response,
082                    String portletName, long companyId, long plid) {
083    
084                    super.init(portletRequestImpl, response, portletName, companyId, plid);
085    
086                    _portletRequestImpl = portletRequestImpl;
087            }
088    
089            private PortletRequestImpl _portletRequestImpl;
090            private String _title;
091            private Boolean _useDefaultTemplate;
092            private String _resourceName;
093    
094    }