3 Replies Latest reply on Jun 24, 2009 1:54 AM by sambit_dixit

    Creating dummy ServletRequest and ServletResponse objects fr

      Hi,

      I'm trying to expose Report delivered by a reporting solution through a Portlet.

      Unfortunately, the API of the Reporting solution which generates a HTML snippet accepts HttpServletRequest, HttpServletResponse and ServletContext.

      Wondering how do I create a dummy set of these above mentioned objects from the PortletRequest (either Render or Action).

      Any idea/pointer is appreciated.

      Regards,
      Sourav

        • 1. Re: Creating dummy ServletRequest and ServletResponse object
          hilmer

          You can use:

          org.jboss.portal.portlet.bridge.JBossServletContextProvider

          It gives you access to the objects you need, it is located in the jar:
          portal-portlet-bridge-lib.jar

          As I am looking into the same things, I am curious to know which reporting solution you are integrating.

          Best
          Søren

          • 2. Re: Creating dummy ServletRequest and ServletResponse object

            Hi Sourav,
            You can try this.

            JbossActionRequest acReq = new JbossActionRequest(actionRequest);
             Here the actionRequest is of type ActionRequest
            
             HttpRequest httpReq = acReq.getControllerContext().getServerInvocation().getServerContext().getClientRequest();
            
            
            Similarly you can get handle to HttpServletResponse.
            
            If can get the handle from RenderRequest as well. Instead of ActionRequest just use RenderRequest in the above code.
            
            


            • 3. Re: Creating dummy ServletRequest and ServletResponse object

              Alternatively if you are using a Portlet Bridge like Struts or JSF, You can even directly get the handle from the available interceptors provided by the portlet bridge. In that case it would be an implicit object under the portlet. These are injected to portlets by the bridge.

              Regards
              -Sambit