Example usage for com.liferay.portal.kernel.util WebKeys CTX

List of usage examples for com.liferay.portal.kernel.util WebKeys CTX

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util WebKeys CTX.

Prototype

String CTX

To view the source code for com.liferay.portal.kernel.util WebKeys CTX.

Click Source Link

Usage

From source file:com.liferay.exportimport.web.internal.portlet.action.ActionUtil.java

License:Open Source License

public static String getTitle(Portlet portlet, RenderRequest renderRequest) throws Exception {

    ServletContext servletContext = (ServletContext) renderRequest.getAttribute(WebKeys.CTX);

    ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);

    HttpServletRequest request = PortalUtil.getHttpServletRequest(renderRequest);

    PortletPreferences portletSetup = getLayoutPortletSetup(renderRequest, portlet);

    portletSetup = getPortletSetup(request, renderRequest.getPreferences(), portletSetup);

    String title = PortletConfigurationUtil.getPortletTitle(portletSetup, themeDisplay.getLanguageId());

    if (Validator.isNull(title)) {
        title = PortalUtil.getPortletTitle(portlet, servletContext, themeDisplay.getLocale());
    }//from w ww. j  a  v  a  2 s .  c o m

    return title;
}

From source file:com.liferay.portlet.configuration.web.internal.portlet.PortletConfigurationPortlet.java

License:Open Source License

protected String getPortletTitle(PortletRequest portletRequest, Portlet portlet,
        PortletPreferences portletPreferences) {

    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    String portletTitle = PortletConfigurationUtil.getPortletTitle(portletPreferences,
            themeDisplay.getLanguageId());

    if (Validator.isNull(portletTitle)) {
        ServletContext servletContext = (ServletContext) portletRequest.getAttribute(WebKeys.CTX);

        portletTitle = _portal.getPortletTitle(portlet, servletContext, themeDisplay.getLocale());
    }//w w  w  .j  a v a  2s.  c  om

    return portletTitle;
}

From source file:com.liferay.taglib.portletext.RuntimeTag.java

License:Open Source License

@Override
public int doEndTag() throws JspException {
    try {/*www. ja  v  a 2  s . c  o  m*/
        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

        Layout layout = (Layout) request.getAttribute(WebKeys.LAYOUT);

        if (layout == null) {
            return EVAL_PAGE;
        }

        ServletContext servletContext = (ServletContext) request.getAttribute(WebKeys.CTX);

        HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();

        doTag(_portletName, _queryString, _defaultPreferences, pageContext, servletContext, request, response);

        return EVAL_PAGE;
    } catch (Exception e) {
        _log.error(e, e);

        throw new JspException(e);
    }
}

From source file:com.liferay.taglib.util.ParamAndPropertyAncestorTagImpl.java

License:Open Source License

public ServletContext getServletContext() {
    if (_servletContext != null) {
        return _servletContext;
    }/* w ww. java 2 s .  c om*/

    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    ServletContext servletContext = (ServletContext) request.getAttribute(WebKeys.CTX);

    if (servletContext == null) {
        servletContext = pageContext.getServletContext();
    }

    return servletContext;
}