Search in sources :

Example 1 with PortletResponse

use of javax.portlet.PortletResponse in project acs-community-packaging by Alfresco.

the class AlfrescoFacesPortlet method getFacesContext.

/**
 * Initializes a new faces context using the portlet objects from a 'wrapped' servlet request.
 *
 * @param request
 *            the servlet request
 * @return the faces context
 */
public static FacesContext getFacesContext(ServletRequest request) {
    PortletRequest portletReq = (PortletRequest) request.getAttribute("javax.portlet.request");
    PortletResponse portletRes = (PortletResponse) request.getAttribute("javax.portlet.response");
    PortletConfig portletConfig = (PortletConfig) request.getAttribute("javax.portlet.config");
    return FacesHelper.getFacesContext(portletReq, portletRes, portletConfig.getPortletContext());
}
Also used : PortletRequest(javax.portlet.PortletRequest) PortletResponse(javax.portlet.PortletResponse) PortletConfig(javax.portlet.PortletConfig)

Example 2 with PortletResponse

use of javax.portlet.PortletResponse in project sw360portal by sw360.

the class NameSpaceAwareTag method getNamespace.

protected String getNamespace() throws JspException {
    try {
        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
        PortletResponse portletResponse = (PortletResponse) request.getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE);
        if (portletResponse != null) {
            return portletResponse.getNamespace();
        } else {
            throw new JspException("Not in a portlet?");
        }
    } catch (Exception e) {
        throw new JspException(e);
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) JspException(javax.servlet.jsp.JspException) PortletResponse(javax.portlet.PortletResponse) JspException(javax.servlet.jsp.JspException) TException(org.apache.thrift.TException)

Example 3 with PortletResponse

use of javax.portlet.PortletResponse in project uPortal by Jasig.

the class PortletDelegationView method render.

/* (non-Javadoc)
     * @see org.springframework.web.servlet.View#render(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
@Override
public void render(Map<String, ?> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
    final IPortletWindowId portletWindowId = (IPortletWindowId) model.get(DELEGATE_PORTLET_WINDOW_ID);
    final DelegationRequest delegationRequest = (DelegationRequest) model.get(DELEGATE_REQUEST);
    final PortletRequest portletRequest = (PortletRequest) request.getAttribute(Constants.PORTLET_REQUEST);
    final PortletResponse portletResponse = (PortletResponse) request.getAttribute(Constants.PORTLET_RESPONSE);
    final PortletDelegationDispatcher requestDispatcher = portletDelegationLocator.getRequestDispatcher(portletRequest, portletWindowId);
    if (requestDispatcher == null) {
        throw new IllegalArgumentException("No PortletDelegationDispatcher exists for portlet window id: " + portletWindowId);
    }
    this.logger.debug("Found delegation dispatcher for portlet window id {} - {}", portletWindowId, requestDispatcher);
    final DelegationResponse delegationResponse;
    final String phase = (String) request.getAttribute(PortletRequest.LIFECYCLE_PHASE);
    if (PortletRequest.RENDER_PHASE.equals(phase)) {
        final PortletOutputHandler portletOutputHandler = (PortletOutputHandler) model.get(DELEGATE_RENDER_OUTPUT_HANDLER);
        if (portletOutputHandler != null) {
            this.logger.debug("Delegating RenderRequest with custom Writer and {}", delegationRequest);
            delegationResponse = requestDispatcher.doRender((RenderRequest) portletRequest, (RenderResponse) portletResponse, delegationRequest, portletOutputHandler);
        } else {
            this.logger.debug("Delegating RenderRequest with default Writer and {}", delegationRequest);
            delegationResponse = requestDispatcher.doRender((RenderRequest) portletRequest, (RenderResponse) portletResponse, delegationRequest);
        }
    } else if (PortletRequest.RESOURCE_PHASE.equals(phase)) {
        this.logger.debug("Delegating ResourceRequest and {}", delegationRequest);
        delegationResponse = requestDispatcher.doServeResource((ResourceRequest) portletRequest, (ResourceResponse) portletResponse, delegationRequest);
    } else {
        throw new UnsupportedOperationException("Portlet lifecycle phase " + phase + " is not supported by the delegation view");
    }
    this.logger.debug("{}", delegationResponse);
}
Also used : PortletRequest(javax.portlet.PortletRequest) PortletResponse(javax.portlet.PortletResponse) DelegationResponse(org.apereo.portal.api.portlet.DelegationResponse) RenderRequest(javax.portlet.RenderRequest) PortletDelegationDispatcher(org.apereo.portal.api.portlet.PortletDelegationDispatcher) RenderResponse(javax.portlet.RenderResponse) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) DelegationRequest(org.apereo.portal.api.portlet.DelegationRequest) PortletOutputHandler(org.apereo.portal.portlet.rendering.PortletOutputHandler)

Aggregations

PortletResponse (javax.portlet.PortletResponse)3 PortletRequest (javax.portlet.PortletRequest)2 PortletConfig (javax.portlet.PortletConfig)1 RenderRequest (javax.portlet.RenderRequest)1 RenderResponse (javax.portlet.RenderResponse)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 JspException (javax.servlet.jsp.JspException)1 TException (org.apache.thrift.TException)1 DelegationRequest (org.apereo.portal.api.portlet.DelegationRequest)1 DelegationResponse (org.apereo.portal.api.portlet.DelegationResponse)1 PortletDelegationDispatcher (org.apereo.portal.api.portlet.PortletDelegationDispatcher)1 IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)1 PortletOutputHandler (org.apereo.portal.portlet.rendering.PortletOutputHandler)1