List of usage examples for com.liferay.portal.kernel.util JavaConstants JAVAX_PORTLET_RESPONSE
String JAVAX_PORTLET_RESPONSE
To view the source code for com.liferay.portal.kernel.util JavaConstants JAVAX_PORTLET_RESPONSE.
Click Source Link
From source file:com.liferay.alloy.mvc.BaseAlloyControllerImpl.java
License:Open Source License
protected void initPortletVariables() { liferayPortletConfig = (LiferayPortletConfig) request.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG); portletContext = liferayPortletConfig.getPortletContext(); portlet = liferayPortletConfig.getPortlet(); alloyPortlet = (AlloyPortlet) request.getAttribute(JavaConstants.JAVAX_PORTLET_PORTLET); portletRequest = (PortletRequest) request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST); portletResponse = (PortletResponse) request.getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE); liferayPortletResponse = (LiferayPortletResponse) portletResponse; lifecycle = GetterUtil.getString((String) request.getAttribute(PortletRequest.LIFECYCLE_PHASE)); if (log.isDebugEnabled()) { log.debug("Lifecycle " + lifecycle); }/*ww w . ja v a 2 s . c o m*/ if (lifecycle.equals(PortletRequest.ACTION_PHASE)) { actionRequest = (ActionRequest) portletRequest; actionResponse = (ActionResponse) portletResponse; } else if (lifecycle.equals(PortletRequest.EVENT_PHASE)) { eventRequest = (EventRequest) portletRequest; eventResponse = (EventResponse) portletResponse; } else if (lifecycle.equals(PortletRequest.RENDER_PHASE)) { mimeResponse = (MimeResponse) portletResponse; renderRequest = (RenderRequest) portletRequest; renderResponse = (RenderResponse) portletResponse; } else if (lifecycle.equals(PortletRequest.RESOURCE_PHASE)) { mimeResponse = (MimeResponse) portletResponse; resourceRequest = (ResourceRequest) portletRequest; resourceResponse = (ResourceResponse) portletResponse; } }
From source file:com.liferay.alloy.mvc.jsonwebservice.BaseAlloyControllerInvokerImpl.java
License:Open Source License
protected DynamicServletRequest createRequest(String lifecycle, Object... parameters) throws Exception { if ((parameters.length % 2) != 0) { throw new IllegalArgumentException("Parameters length is not an even number"); }/*from www . j ava 2s. com*/ HttpServletRequestWrapper requestWrapper = new HttpServletRequestWrapper( new AlloyMockUtil.MockHttpServletRequest()); DynamicServletRequest request = new DynamicServletRequest(requestWrapper, false); for (int i = 0; i < parameters.length; i += 2) { request.appendParameter(String.valueOf(parameters[i]), String.valueOf(parameters[i + 1])); } request.appendParameter("controller", _controller); request.appendParameter("format", "json"); ThemeDisplay themeDisplay = (ThemeDisplay) _themeDisplay.clone(); PermissionChecker permissionChecker = PermissionThreadLocal.getPermissionChecker(); User user = UserLocalServiceUtil.getUser(permissionChecker.getUserId()); themeDisplay.setUser(user); request.setAttribute(WebKeys.THEME_DISPLAY, themeDisplay); request.setAttribute(WebKeys.LAYOUT, themeDisplay.getLayout()); LiferayPortletConfig liferayPortletConfig = (LiferayPortletConfig) PortletConfigFactoryUtil.create(_portlet, null); request.setAttribute(JavaConstants.JAVAX_PORTLET_CONFIG, liferayPortletConfig); request.setAttribute(JavaConstants.JAVAX_PORTLET_PORTLET, _alloyPortlet); PortletRequest portletRequest = null; PortletResponse portletResponse = null; if (lifecycle.equals(PortletRequest.ACTION_PHASE)) { portletRequest = createActionRequest(); portletResponse = createActionResponse(); } else { portletRequest = createRenderRequest(); portletResponse = createRenderResponse(request, _portlet.getRootPortletId(), themeDisplay.getPlid(), lifecycle); } request.setAttribute(JavaConstants.JAVAX_PORTLET_REQUEST, portletRequest); request.setAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE, portletResponse); request.setAttribute(PortletRequest.LIFECYCLE_PHASE, lifecycle); request.setAttribute(BaseAlloyControllerImpl.VIEW_PATH, StringPool.BLANK); return request; }
From source file:com.liferay.asset.publisher.web.display.context.BaseItemSelectorViewDisplayContext.java
License:Open Source License
@Override public PortletResponse getPortletResponse() { return (PortletResponse) request.getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE); }
From source file:com.liferay.document.library.web.internal.display.context.logic.UIItemsBuilder.java
License:Open Source License
private LiferayPortletResponse _getLiferayPortletResponse() { PortletResponse portletResponse = (PortletResponse) _request .getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE); return PortalUtil.getLiferayPortletResponse(portletResponse); }
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 w w .j a v a 2 s . 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. *//* ww w . j av a 2 s .com*/ @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 w ww. j av a 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 ww . j a va 2 s.c om*/ 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 va 2s .c o m 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 */// w w w . j a v a 2 s . c o m @Deprecated protected LiferayPortletResponse getLiferayPortletResponse() { HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); PortletResponse portletResponse = (PortletResponse) request .getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE); if (portletResponse == null) { return null; } return PortalUtil.getLiferayPortletResponse(portletResponse); }