List of usage examples for com.liferay.portal.kernel.util JavaConstants JAVAX_PORTLET_REQUEST
String JAVAX_PORTLET_REQUEST
To view the source code for com.liferay.portal.kernel.util JavaConstants JAVAX_PORTLET_REQUEST.
Click Source Link
From source file:com.liferay.dynamic.data.lists.web.internal.display.context.util.DDLRequestHelper.java
License:Open Source License
public DDLRequestHelper(HttpServletRequest request) { super(request); _renderRequest = (RenderRequest) request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST); _portletPreferences = _renderRequest.getPreferences(); }
From source file:com.liferay.exportimport.web.internal.portlet.action.ActionUtil.java
License:Open Source License
public static RenderRequest getWrappedRenderRequest(RenderRequest renderRequest, PortletPreferences portletPreferences) throws PortalException { HttpServletRequest request = PortalUtil.getHttpServletRequest(renderRequest); portletPreferences = getPortletPreferences(request, renderRequest.getPreferences(), portletPreferences); renderRequest = new ConfigurationRenderRequest(renderRequest, portletPreferences); request.setAttribute(JavaConstants.JAVAX_PORTLET_REQUEST, renderRequest); return renderRequest; }
From source file:com.liferay.faces.bridge.ext.scope.internal.RequestAttributeInspectorLiferayImpl.java
License:Open Source License
/** * This is a method-override that provides specific behavior for Liferay Portal. Specifically, since Liferay Portal * does not implement the POST-REDIRECT-GET design pattern, not all instance types listed in Section 5.1.2 of the * Spec can be candidates for exclusion. *///from w ww .j a va2s . c om @Override public boolean isExcludedByType(String name, Object value) { boolean excluded = false; if (value != null) { if ((value instanceof ExternalContext) || (value instanceof FacesContext)) { // Always safe to exclude when running under Liferay Portal. excluded = true; } else if (value instanceof PortletConfig) { // Liferay Portal includes request attribute named "javax.portlet.config" that must not be excluded. It // also includes an attribute named "javax.portlet.portlet" that is the current GenericFacesPortlet // (which extends GenericPortlet). But since GenericPortlet implements the PortletConfig interface, need // to prevent it from being excluded as well. if (!JavaConstants.JAVAX_PORTLET_CONFIG.equals(name) && !JavaConstants.JAVAX_PORTLET_PORTLET.equals(name)) { excluded = true; } } else if (value instanceof PortletRequest) { // Liferay Portal includes request attribute named "javax.portlet.request" that must not be excluded. if (!JavaConstants.JAVAX_PORTLET_REQUEST.equals(name)) { excluded = true; } } else if (value instanceof PortletResponse) { // Liferay Portal includes request attribute named "javax.portlet.response" that must not be excluded. if (!JavaConstants.JAVAX_PORTLET_RESPONSE.equals(name)) { excluded = true; } } else if ((value instanceof PortalContext) || (value instanceof PortletContext) || (value instanceof PortletPreferences) || (value instanceof PortletSession)) { excluded = true; } else if ((value instanceof HttpSession) || (value instanceof ServletConfig) || (value instanceof ServletContext) || (value instanceof ServletRequest) || (value instanceof ServletResponse)) { // Can only exclude attributes that are not Liferay objects. For example, Liferay Portal includes // a request attribute named "com.liferay.portal.kernel.servlet.PortletServletRequest" that must not be // excluded. if (!value.getClass().getName().startsWith("com.liferay")) { excluded = true; } } } return excluded; }
From source file:com.liferay.faces.bridge.scope.BridgeRequestScopeLiferayImpl.java
License:Open Source License
/** * This is a method-override that provides specific behavior for Liferay Portal. Specifically, since Liferay Portal * does not implement the POST-REDIRECT-GET design pattern, not all instance types listed in Section 5.1.2 of the * Spec can be candidates for exclusion. */// w w w . j a v a 2s.c o m @Override protected boolean isExcludedRequestAttributeByInstance(String attributeName, Object attributeValue) { boolean excluded = false; if (attributeValue != null) { if ((attributeValue instanceof ExternalContext) || (attributeValue instanceof FacesContext)) { // Always safe to exclude when running under Liferay Portal. excluded = true; } else if (attributeValue instanceof PortletConfig) { // Liferay Portal includes request attribute named "javax.portlet.config" that must not be excluded. It // also includes an attribute named "javax.portlet.portlet" that is the current GenericFacesPortlet // (which extends GenericPortlet). But since GenericPortlet implements the PortletConfig interface, need // to prevent it from being excluded as well. if (!JavaConstants.JAVAX_PORTLET_CONFIG.equals(attributeName) && !JavaConstants.JAVAX_PORTLET_PORTLET.equals(attributeName)) { excluded = true; } } else if (attributeValue instanceof PortletRequest) { // Liferay Portal includes request attribute named "javax.portlet.request" that must not be excluded. if (!JavaConstants.JAVAX_PORTLET_REQUEST.equals(attributeName)) { excluded = true; } } else if (attributeValue instanceof PortletResponse) { // Liferay Portal includes request attribute named "javax.portlet.response" that must not be excluded. if (!JavaConstants.JAVAX_PORTLET_RESPONSE.equals(attributeName)) { excluded = true; } } else if ((attributeValue instanceof PortalContext) || (attributeValue instanceof PortletContext) || (attributeValue instanceof PortletPreferences) || (attributeValue instanceof PortletSession)) { excluded = true; } else if ((attributeValue instanceof HttpSession) || (attributeValue instanceof ServletConfig) || (attributeValue instanceof ServletContext) || (attributeValue instanceof ServletRequest) || (attributeValue instanceof ServletResponse)) { // Can only exclude attributes that are not Liferay objects. For example, Liferay Portal includes // a request attribute named "com.liferay.portal.kernel.servlet.PortletServletRequest" that must not be // excluded. if (!attributeValue.getClass().getName().startsWith(LiferayConstants.PACKAGE_NAMESPACE)) { excluded = true; } } } return excluded; }
From source file:com.liferay.faces.bridge.scope.internal.BridgeRequestScopeLiferayImpl.java
License:Open Source License
/** * This is a method-override that provides specific behavior for Liferay Portal. Specifically, since Liferay Portal * does not implement the POST-REDIRECT-GET design pattern, not all instance types listed in Section 5.1.2 of the * Spec can be candidates for exclusion. *///from ww w .j ava 2 s . c o m @Override protected boolean isExcludedRequestAttributeByInstance(String attributeName, Object attributeValue) { boolean excluded = false; if (attributeValue != null) { if ((attributeValue instanceof ExternalContext) || (attributeValue instanceof FacesContext)) { // Always safe to exclude when running under Liferay Portal. excluded = true; } else if (attributeValue instanceof PortletConfig) { // Liferay Portal includes request attribute named "javax.portlet.config" that must not be excluded. It // also includes an attribute named "javax.portlet.portlet" that is the current GenericFacesPortlet // (which extends GenericPortlet). But since GenericPortlet implements the PortletConfig interface, need // to prevent it from being excluded as well. if (!JavaConstants.JAVAX_PORTLET_CONFIG.equals(attributeName) && !JavaConstants.JAVAX_PORTLET_PORTLET.equals(attributeName)) { excluded = true; } } else if (attributeValue instanceof PortletRequest) { // Liferay Portal includes request attribute named "javax.portlet.request" that must not be excluded. if (!JavaConstants.JAVAX_PORTLET_REQUEST.equals(attributeName)) { excluded = true; } } else if (attributeValue instanceof PortletResponse) { // Liferay Portal includes request attribute named "javax.portlet.response" that must not be excluded. if (!JavaConstants.JAVAX_PORTLET_RESPONSE.equals(attributeName)) { excluded = true; } } else if ((attributeValue instanceof PortalContext) || (attributeValue instanceof PortletContext) || (attributeValue instanceof PortletPreferences) || (attributeValue instanceof PortletSession)) { excluded = true; } else if ((attributeValue instanceof HttpSession) || (attributeValue instanceof ServletConfig) || (attributeValue instanceof ServletContext) || (attributeValue instanceof ServletRequest) || (attributeValue instanceof ServletResponse)) { // Can only exclude attributes that are not Liferay objects. For example, Liferay Portal includes // a request attribute named "com.liferay.portal.kernel.servlet.PortletServletRequest" that must not be // excluded. if (!attributeValue.getClass().getName().startsWith("com.liferay")) { excluded = true; } } } return excluded; }
From source file:com.liferay.flags.taglib.servlet.taglib.soy.FlagsTag.java
License:Open Source License
private String _getCurrentURL() { PortletRequest portletRequest = (PortletRequest) request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST); PortletResponse portletResponse = (PortletResponse) request .getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE); String currentURL;//from w w w . j ava 2 s .c o m if ((portletRequest != null) && (portletResponse != null)) { PortletURL currentURLObj = PortletURLUtil.getCurrent( PortalUtil.getLiferayPortletRequest(portletRequest), PortalUtil.getLiferayPortletResponse(portletResponse)); currentURL = currentURLObj.toString(); } else { currentURL = PortalUtil.getCurrentURL(request); } return currentURL; }
From source file:com.liferay.frontend.taglib.servlet.taglib.DefineObjectsTag.java
License:Open Source License
@Override public int doStartTag() throws JspException { HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); PortletRequest portletRequest = (PortletRequest) request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST); if (portletRequest != null) { LiferayPortletRequest liferayPortletRequest = PortalUtil.getLiferayPortletRequest(portletRequest); PortletResponse portletResponse = (PortletResponse) request .getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE); if (portletResponse != null) { LiferayPortletResponse liferayPortletResponse = PortalUtil .getLiferayPortletResponse(portletResponse); PortletURL currentURLObj = PortletURLUtil.getCurrent(liferayPortletRequest, liferayPortletResponse); pageContext.setAttribute("currentURL", currentURLObj.toString()); pageContext.setAttribute("currentURLObj", currentURLObj); }//from w w w . ja v a 2 s .c om pageContext.setAttribute("windowState", liferayPortletRequest.getWindowState()); } if (_overrideResourceBundle != null) { pageContext.setAttribute("resourceBundle", _overrideResourceBundle); } else { Locale locale = PortalUtil.getLocale(request); pageContext.setAttribute("resourceBundle", TagResourceBundleUtil.getResourceBundle(request, locale)); } return SKIP_BODY; }
From source file:com.liferay.frontend.taglib.servlet.taglib.DefineObjectsTag.java
License:Open Source License
/** * @deprecated As of 2.1.0, with no direct replacement *//* ww w .j a v a 2 s .c om*/ @Deprecated protected LiferayPortletRequest getLiferayPortletRequest() { HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); PortletRequest portletRequest = (PortletRequest) request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST); if (portletRequest == null) { return null; } return PortalUtil.getLiferayPortletRequest(portletRequest); }
From source file:com.liferay.journal.search.test.JournalArticleIndexerSummaryTest.java
License:Open Source License
protected HttpServletRequest createHttpServletRequest(PortletRequest portletRequest) { HttpServletRequest httpServletRequest = new MockHttpServletRequest(); httpServletRequest.setAttribute(JavaConstants.JAVAX_PORTLET_REQUEST, portletRequest); return httpServletRequest; }
From source file:com.liferay.journal.taglib.servlet.taglib.JournalArticleTag.java
License:Open Source License
@Override public int doStartTag() throws JspException { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); PortletRequest portletRequest = (PortletRequest) request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST); PortletResponse portletResponse = (PortletResponse) request .getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE); PortletRequestModel portletRequestModel = new PortletRequestModel(portletRequest, portletResponse); _article = JournalArticleLocalServiceUtil.fetchLatestArticle(_groupId, _articleId, WorkflowConstants.STATUS_APPROVED); try {/*from www. java 2 s . co m*/ _articleDisplay = JournalArticleLocalServiceUtil.getArticleDisplay(_article.getGroupId(), _article.getArticleId(), _article.getVersion(), _ddmTemplateKey, Constants.VIEW, getLanguageId(), 1, portletRequestModel, themeDisplay); } catch (PortalException pe) { if (_log.isDebugEnabled()) { _log.debug("Unable to get journal article display", pe); } return SKIP_BODY; } return super.doStartTag(); }