2 Replies Latest reply on May 23, 2012 4:52 AM by abaudry

    PortletBridge 3.0.0.Beta3 + JSF2: how to have externalContext.getRequestPathInfo not null?

    abaudry

      Hello everybody,

       

      in my project we are trying to work with PortletBridge 3.0.0.Beta3, JSF 2.1.2 and OpenFaces 3.x (NightlyBuild, we use OpenFaces because RichFaces does not support IE6). We encounter an exception:

       

      java.lang.NullPointerException

              at org.openfaces.application.OpenFacesResourceHandler.isDynamicResourceRequest(OpenFacesResourceHandler.java:118)

              at org.openfaces.application.OpenFacesResourceHandler.isResourceRequest(OpenFacesResourceHandler.java:112)

              at javax.faces.application.ResourceHandlerWrapper.isResourceRequest(ResourceHandlerWrapper.java:137)

              at com.sun.faces.application.resource.ResourceImpl.isResourceRequest(ResourceImpl.java:429)

              at com.sun.faces.application.resource.ResourceImpl.getResponseHeaders(ResourceImpl.java:208)

              at javax.faces.application.ResourceWrapper.getResponseHeaders(ResourceWrapper.java:110)

              at javax.faces.application.ResourceWrapper.getResponseHeaders(ResourceWrapper.java:110)

              at org.jboss.portletbridge.application.resource.PortletResourceHandler.handleHeaders(PortletResourceHandler.java:199)

              at org.jboss.portletbridge.application.resource.PortletResourceHandler.handleResourceRequest(PortletResourceHandler.java:145)

              at org.jboss.portletbridge.application.resource.PortletResourceHandler.handleResourceRequest(PortletResourceHandler.java:110)

              at org.jboss.portletbridge.bridge.controller.Jsf20ControllerImpl.renderResource(Jsf20ControllerImpl.java:299)

              at org.jboss.portletbridge.PortletBridgeImpl.doFacesRequest(PortletBridgeImpl.java:272)

              at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:463)

       

       

      It appears that FacesContext.getExternalContext().getRequestPathInfo() is null

      In a debug view when I get the external context I have:

      pathInfo: null

      servletPath: "/pages/authnetifier.xhtml"

      viewId: "/pages/authentifier.xhtml"

       

      So I suppose the problems is due to a lack of configuration, but where and how?

      My researches lead me to think that my faces-config.xml should be including some more configuration like

       

      <factory>

          <external-context-factory>org.jboss.portletbridge.context.PortletExternalContextFactoryImpl</external-context-factory>

          <partial-view-context-factory>org.jboss.portletbridge.context.PortletPartialViewContextFactoryImpl</partial-view-context-factory>

      </factory>

       

       

      Could you help me please?

       

      Best regards,

      Alain BAUDRY

        • 1. Re: PortletBridge 3.0.0.Beta3 + JSF2: how to have externalContext.getRequestPathInfo not null?
          kenfinni

          Alain,

           

          That appears to be a bug in OpenFaces.

           

          As per section 6.1.3.1 of JSR 329, ExternalContext.getRequestPathInfo() follows the following rules:

           

          Return the extra path information (if any) included in the request URI; otherwise, return null.  This value must represent the path portion of the current target viewId.


          Because the portlet model doesn't support a (servlet) equivalent notion of pathInfo and servletPath, the bridge must manufacture these values based on the target viewId.  The bridge determines the target view from request parameter(s) it has previously encoded. If this information doesn't exist, the target view is the default viewId defined by the portlet.  The associated pathInfo and servletPath are constructed by determining the servlet mapping of the Faces servlet and constructing the appropriate paths such that they conform to the paths the servlet container generates when processing an http request which targets this view as defined in SRV .4.4 in the Servlet 2.5 specification[6.54].


          Examples:

          Faces servlet mappingviewIdservletPathpathInfo
          /faces/*  (prefix mapping)myView.jspx/facesmyView.jspx
          *.jsf     (suffix mapping)myView.jspxmyView.jsfnull


          Depending on the servlet mapping your portlet uses will determine whether pathInfo is null or not.

           

          As for the extra configuration in faces-config.xml, those factories are set within the faces-config.xml that JBoss Portlet Bridge 3 includes in the implementation jar and is picked up by JSF from there.  There is no need to add those into your application faces-config.xml

           

          Regards

          Ken

          1 of 1 people found this helpful
          • 2. Re: PortletBridge 3.0.0.Beta3 + JSF2: how to have externalContext.getRequestPathInfo not null?
            abaudry

            Ken,

             

            thank you for the answer, I'll check the web.xml conf and see with OpenFaces if they have any improvement to do on their side.

             

            Regards,

            Alain