Examples of RenderRequest


Examples of javax.portlet.RenderRequest

          getFacesContextFactory().getFacesContext(mPortletConfig, request, response, lifecycle);
      ExternalContext extCtx = context.getExternalContext();

      // Use request from ExternalContext in case its been wrapped by an
      // extension
      RenderRequest extRequest = (RenderRequest) extCtx.getRequest();

      scopeId = extRequest.getParameter(REQUEST_SCOPE_ID_RENDER_PARAM);

      if (restoreBridgeRequestScopeData(context, scopeId))
      {
        // Because the Bridge is required to always save/restore the
        // VIEW_STATE
        // parameter -- always attempt a restore
        extRequest = restoreActionParams(context);

        // only restores if first render after action
        // afterwards not restored from Bridge request scope
        // rather its saved/restored by Faces.
        restoreFacesView(context, scopeId);
      }

      // Ensure the ContentType is set before rendering
      if (extCtx.getResponseContentType() == null)
      {
        response.setContentType(extRequest.getResponseContentType());
      }

      // ensure that isPostback attribute set if VIEW_STATE param exists
      if (extCtx.getRequestParameterValuesMap().containsKey(ResponseStateManager.VIEW_STATE_PARAM))
      {
View Full Code Here

Examples of javax.portlet.RenderRequest

    ExternalContext ec = context.getExternalContext();
    // Note: only available/restored if this scope was restored.
    Map<String, String[]> m = (Map<String, String[]>) ec.getRequestMap().get(REQUEST_PARAMETERS);

    // ensures current request returned if nothing to restore/wrap
    RenderRequest wrapped = (RenderRequest) ec.getRequest();
    if (m != null && !m.isEmpty())
    {
      wrapped = new BridgeRenderRequestWrapper(wrapped, m);
      ec.setRequest(wrapped);
    }
View Full Code Here

Examples of javax.portlet.RenderRequest

  public void testRenderRequestWithViewNameSet() throws Exception {
    ParameterizableViewController controller = new ParameterizableViewController();
    String viewName = "testView";
    controller.setViewName(viewName);
    RenderRequest request = new MockRenderRequest();
    RenderResponse response = new MockRenderResponse();
    ModelAndView mav = controller.handleRenderRequest(request, response);
    assertEquals(viewName, mav.getViewName());
  }
View Full Code Here

Examples of javax.portlet.RenderRequest

    if (logger.isDebugEnabled()) {
      logger.debug("Bound render request context to thread: " + request);
    }

    RenderRequest processedRequest = request;
    HandlerExecutionChain mappedHandler = null;
    int interceptorIndex = -1;

    try {
      ModelAndView mv = null;
View Full Code Here

Examples of javax.portlet.RenderRequest

  protected void doRender(Map model) throws Exception {
    RequestContext context = getRequestContext();
    ExternalContext externalContext = context.getExternalContext();
    View view = getView();
    PortletContext portletContext = (PortletContext) externalContext.getNativeContext();
    RenderRequest request = (RenderRequest) externalContext.getNativeRequest();
    RenderResponse response = (RenderResponse) externalContext.getNativeResponse();
    if (response.getContentType() == null) {
      // No Portlet content type specified yet -> use the view-determined type.
      // (The Portlet spec requires the content type to be set on the RenderResponse)
      String contentType = view.getContentType();
      if (contentType != null) {
        response.setContentType(contentType);
      }
    }
    request.setAttribute(ViewRendererServlet.VIEW_ATTRIBUTE, view);
    request.setAttribute(ViewRendererServlet.MODEL_ATTRIBUTE, model);
    request.setAttribute(org.springframework.web.servlet.support.RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE,
        context.getActiveFlow().getApplicationContext());
    portletContext.getRequestDispatcher(DispatcherPortlet.DEFAULT_VIEW_RENDERER_URL).include(request, response);
  }
View Full Code Here

Examples of javax.portlet.RenderRequest

     */
    @Test
    public void testRenderPortletRequest() throws NoSuchFieldException, IllegalAccessException {
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        PortletContext portletContext = createMock(PortletContext.class);
        RenderRequest request = createMock(RenderRequest.class);
        RenderResponse response = createMock(RenderResponse.class);

        replay(applicationContext, portletContext, request, response);
        RenderPortletRequest req = new RenderPortletRequest(applicationContext,
                portletContext, request, response);
View Full Code Here

Examples of javax.portlet.RenderRequest

        // add the cocoon header timestamp
        res.setProperty("X-Cocoon-Version", Constants.VERSION);

        // get the request (wrapped if contains multipart-form data)
        RenderRequest request = req;

        // Get the cocoon engine instance
        getCocoon(request.getParameter(Constants.RELOAD_PARAM));

        // Check if cocoon was initialized
        if (this.cocoon == null) {
            manageException(request, res, null, null,
                            "Initialization Problem",
                            null /* "Cocoon was not initialized" */,
                            null /* "Cocoon was not initialized, cannot process request" */,
                            this.exception);
            return;
        }

        // We got it... Process the request
        String servletPath = this.servletPath;
        if (servletPath == null) {
            servletPath = "portlets/" + getPortletConfig().getPortletName() + '/';
        }

        String uri = servletPath;
        String pathInfo = request.getParameter(PortletEnvironment.PARAMETER_PATH_INFO);
        if (pathInfo != null) {
            if (pathInfo.length() > 0 && pathInfo.charAt(0) == '/') {
                pathInfo = pathInfo.substring(1);
            }
            uri += pathInfo;
        }

        String contentType = null;
        ContextMap ctxMap = null;

        Environment env;
        try {
            env = getEnvironment(servletPath, uri, request, res);
        } catch (Exception e) {
            if (getLogger().isErrorEnabled()) {
                getLogger().error("Problem with Cocoon portlet", e);
            }

            manageException(request, res, null, uri,
                            "Problem in creating the Environment", null, null, e);
            return;
        }

        try {
            try {
                // Initialize a fresh log context containing the object model: it
                // will be used by the CocoonLogFormatter
                ctxMap = ContextMap.getCurrentContext();
                // Add thread name (default content for empty context)
                String threadName = Thread.currentThread().getName();
                ctxMap.set("threadName", threadName);
                // Add the object model
                ctxMap.set("objectModel", env.getObjectModel());
                // Add a unique request id (threadName + currentTime
                ctxMap.set("request-id", threadName + System.currentTimeMillis());

                if (this.cocoon.process(env)) {
                    contentType = env.getContentType();
                } else {
                    // We reach this when there is nothing in the processing change that matches
                    // the request. For example, no matcher matches.
                    getLogger().fatalError("The Cocoon engine failed to process the request.");
                    manageException(request, res, env, uri,
                                    "Request Processing Failed",
                                    "Cocoon engine failed in process the request",
                                    "The processing engine failed to process the request. This could be due to lack of matching or bugs in the pipeline engine.",
                                    null);
                    return;
                }
            } catch (ResourceNotFoundException rse) {
                if (getLogger().isWarnEnabled()) {
                    getLogger().warn("The resource was not found", rse);
                }

                manageException(request, res, env, uri,
                                "Resource Not Found",
                                "Resource Not Found",
                                "The requested portlet could not be found",
                                rse);
                return;

            } catch (ConnectionResetException cre) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug(cre.getMessage(), cre);
                } else if (getLogger().isWarnEnabled()) {
                    getLogger().warn(cre.getMessage());
                }

            } catch (SocketException se) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug(se.getMessage(), se);
                } else if (getLogger().isWarnEnabled()) {
                    getLogger().warn(se.getMessage());
                }

            } catch (Exception e) {
                if (getLogger().isErrorEnabled()) {
                    getLogger().error("Internal Cocoon Problem", e);
                }

                manageException(request, res, env, uri,
                                "Internal Server Error", null, null, e);
                return;
            }

            long end = System.currentTimeMillis();
            String timeString = processTime(end - start);
            if (getLogger().isInfoEnabled()) {
                getLogger().info("'" + uri + "' " + timeString);
            }
            res.setProperty("X-Cocoon-Time", timeString);

            if (contentType != null && contentType.equals("text/html")) {
                String showTime = request.getParameter(Constants.SHOWTIME_PARAM);
                boolean show = this.showTime;
                if (showTime != null) {
                    show = !showTime.equalsIgnoreCase("no");
                }
                if (show) {
View Full Code Here

Examples of javax.portlet.RenderRequest

      context = getFacesContext(request, response, lifecycle, redirectParams);
      ExternalContext extCtx = context.getExternalContext();

      // Use request from ExternalContext in case its been wrapped by an
      // extension
      RenderRequest extRequest = (RenderRequest) extCtx.getRequest();

      if (restoredScope)
      {
        // Because the Bridge is required to always save/restore the
        // VIEW_STATE
View Full Code Here

Examples of javax.portlet.RenderRequest

    ExternalContext ec = context.getExternalContext();
    // Note: only available/restored if this scope was restored.
    Map<String, String[]> m = (Map<String, String[]>) ec.getRequestMap().get(REQUEST_PARAMETERS);

    // ensures current request returned if nothing to restore/wrap
    RenderRequest wrapped = (RenderRequest) ec.getRequest();
    if (m != null && !m.isEmpty())
    {
      wrapped = new BridgeRenderRequestWrapper(wrapped, m);
      ec.setRequest(wrapped);
    }
View Full Code Here

Examples of javax.portlet.RenderRequest

                defaultVelocityEngine = initVelocity((TemplateDescriptor)null);
            }
            return defaultVelocityEngine;           
        }               
        // get render request and request context from Context
        RenderRequest renderRequest = (RenderRequest) ctx.get("renderRequest");
        JetspeedVelocityPowerTool jpt = (JetspeedVelocityPowerTool) ctx.get("jetspeed");
        if ((renderRequest != null) && (requestContext != null))
        {
            // get layout type and decoration, fallback to
            // page default decorations
            ContentFragment layout = (ContentFragment) renderRequest.getAttribute(JetspeedVelocityPowerTool.LAYOUT_ATTR);
            if (layout == null)
            {
               // layout = (Fragment) renderRequest.getAttribute(JetspeedPowerTool.FRAGMENT_ATTR);
                layout = jpt.getCurrentFragment();
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.