8 Replies Latest reply on Aug 26, 2005 2:59 PM by venkat rao

    Bridge Interceptor

    Sven Schulz Newbie

      I wonder how to activate the bridge interceptor in org.jboss.portal.bridge. I think I have to add a line to jboss-container.xml. Is this true? Is there any meaning associated with the order of the interceptor elements therein?

        • 1. Re: Bridge Interceptor
          Viet Master

          you can download the example uing struts and look at the configuration.

          the struts mail demo is what interest you on this page : http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossPortalSamples

          • 2. Re: Bridge Interceptor
            Sven Schulz Newbie

            Hi Julien,

            I am trying to integrate my own bridge for Oracle ADF Faces. Even with your hint I am not able to figure out how to get the bridge interceptor working. When I invoke

            <JBossServletContextProvider>.getServletContext(null)
            an IllegalStateException is thrown, indicating that no bridge is set. I think this results from the fact, that the interceptor is not in position. If I modify the jboss-container-xml of the portal to include an entry for the interceptor a NullPointerException is thrown, that originates from the BridgeInterceptor accessing an object that is not available.

            Any idea?

            • 3. Re: Bridge Interceptor
              Viet Master

              it is because you need to change the invocation stack on your portlet and activate the one specific to bridged configuration :

              in jboss-portal.xml add the line <config-name>Struts</config-name> like :

              <portlet-app>
               <portlet>
               <portlet-name>StrutsPortletDemo</portlet-name>
               <!-- Use the specific struts container configuration -->
               <config-name>StrutsPortlet</config-name>
               </portlet>
              </portlet-app>
              


              then the ServletContextProvider should work and give you what you expect.

              • 4. Re: Bridge Interceptor
                Sherman Wood Apprentice

                I am trying to use the bridge to create a portlet around an existing application (JPivot). I have got the portlet WAR set up, and it deploys without errors.

                The init method on my portlet is called. It sets up a ServletContextProvider like the StrutsPortlet does.

                I have no security set up.

                On login, the portlet appears on the Page menu with a URL of http://localhost:8080/portal/auth/index.html?ctrl:id=page.default.JPivotDemo.

                When I select it, I get a screen back that just has the nodesk look and feel without any content. In the log, I have:


                [org.jboss.portal.server.impl.invocation.InvocationImpl] Incoming request with id page.default.JPivotDemo
                [org.jboss.portal.core.invocation.ContentTypeInterceptor] Found markup=html_web_4_0, ua=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4, devicedID=netscape7_1_nt_us
                [org.jboss.portal.core.invocation.ContentTypeInterceptor] Found mimeType type text/html for markup=html_web_4_0
                [org.jboss.portal.core.invocation.StrategyInterceptor] analyzing layout strategy....
                [org.jboss.portal.server.impl.LayoutServerImpl] get nodesk...
                [org.jboss.portal.server.impl.LayoutServerImpl] found nodesk
                [org.jboss.portal.core.invocation.StrategyInterceptor] looking for a layout strategy [default] [JPivotDemo] [nodesk] [text/html]
                [org.jboss.portal.core.invocation.StrategyInterceptor] got a layout: trying to get the strategy from it...
                [org.jboss.portal.core.invocation.StrategyInterceptor] no strategy from the layoutlayout: trying to get named strategy...
                [org.jboss.portal.core.invocation.StrategyInterceptor] looking for strategy with name: default
                [org.jboss.portal.core.invocation.StrategyInterceptor] found strategy to use: org.jboss.portal.core.theme.strategy.impl.DefaultStrategyImpl
                [org.jboss.portal.core.invocation.StrategyInterceptor] adding region: center
                [org.jboss.portal.core.theme.strategy.StrategyFactory] creating strategy context for: nodesk default JPivotDemo
                [org.jboss.portal.core.theme.strategy.impl.DefaultStrategyImpl] evaluating strategy for: org.jboss.portal.core.theme.impl.PortalLayoutImpl@1df3082
                [org.jboss.portal.core.invocation.StrategyInterceptor] setting layout URI: /nodesk/index.jsp
                [org.jboss.portal.core.invocation.StrategyInterceptor] done analyzing layout strategy
                [org.jboss.portal.core.servlet.CoreServlet] requesting theme: null
                [org.jboss.portal.core.servlet.CoreServlet] using layout returned from the strategy: nodesk uri: /nodesk/index.jsp
                [org.jboss.portal.core.servlet.CoreServlet] got layout to use [nodesk] in app [portal] uri [/nodesk/index.jsp]
                [org.jboss.portal.server.theme.LayoutDispatcher] got request dispatcher for layout resource: true
                [org.jboss.portal.server.theme.LayoutDispatcher] done with the layout


                The doView method of my portlet is not being called.

                Configs:

                portlet.xml

                
                <?xml version="1.0" encoding="UTF-8"?>
                <portlet-app id="JPivot-Demo" version="1.0">
                 <portlet id="JPivotPortletDemo">
                 <portlet-name>JPivotPortletDemo</portlet-name>
                 <portlet-class>com.semanticworks.lumena.portal.JPivotPortlet</portlet-class>
                 <supports>
                 <mime-type>text/html</mime-type>
                 <portlet-mode>VIEW</portlet-mode>
                 </supports>
                 <init-param>
                 <name>ServletContextProvider</name>
                 <value>org.jboss.portal.bridge.JBossServletContextProvider</value>
                 </init-param>
                 <portlet-info>
                 <title>JPivot portlet</title>
                 </portlet-info>
                 </portlet>
                </portlet-app>
                


                jboss-portlet.xml:

                <portlet-app>
                 <portlet>
                 <portlet-name>JPivotPortletDemo</portlet-name>
                 <config-name>JPivotPortlet</config-name>
                 <security></security>
                 </portlet>
                </portlet-app>
                



                JPivotDemo-pages.xml:

                
                <pages>
                 <portal-name>default</portal-name>
                 <page>
                 <page-name>JPivotDemo</page-name>
                 <window>
                 <window-name>JPivotDemoPortletWindow</window-name>
                 <instance-ref>JPivotDemo.JPivotPortlet.JPivotPortletDemoInstance</instance-ref>
                 <region>center</region>
                 <height>0</height>
                 </window>
                 </page>
                </pages>
                


                Any pointers?

                Thanks in advance,


                Sherman

                • 5. Re: Bridge Interceptor
                  Sherman Wood Apprentice

                  Ahhh, I see the following when the portlet deploys:

                  ERROR [org.jboss.portal.core.deployment.jboss.PortletAppDeployment] No config for the name JPivotPortlet will use the default configuration


                  After some digging around in the code, this is caused by a reference to the config-name element in jboss-portlet.xml.

                  In org.jboss.portal.portlet.deployment.jboss.PortletAppDeployment.buildComponentConfiguration(String portletName), the value of the config-element is being looked for in the configurations variable.

                  Th configurations variable is set up in create(). The data is loaded from /standardjboss-portlet.xml in the portal-core.sar.

                  The StrutsPortlet configuration in standardjboss-portlet.xml does not have anything specific to Struts in it. The only difference from the default one is the inclusion of the BridgeInterceptor, which sets up the ServletContextProvider. Maybe this configuration should be called BridgedPortlet?

                  So I put the line
                  <config-name>StrutsPortlet</config-name>

                  into jboss-portlet.xml. Now there is no error like above in the log when I deploy.



                  Sherman

                  • 6. Re: Bridge Interceptor
                    Sherman Wood Apprentice

                    But I am still getting the same behavior when I access the portlet: a theme only screen and the doView method on my portlet class is not called. I put some logging in to see what invocations were happening

                    [org.jboss.portal.server.impl.invocation.InvocationImpl] Incoming request with id page.default.JPivotDemo
                    [org.jboss.portal.server.impl.invocation.InvocationImpl] Invoking org.jboss.portal.core.invocation.UserContextInterceptor
                    [org.jboss.portal.server.impl.invocation.InvocationImpl] Invoking org.jboss.portal.core.invocation.ContentTypeInterceptor
                    [org.jboss.portal.core.invocation.ContentTypeInterceptor] Found markup=html_web_4_0, ua=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4, devicedID=netscape7_1_nt_
                    [org.jboss.portal.core.invocation.ContentTypeInterceptor] Found mimeType type text/html for markup=html_web_4_0
                    [org.jboss.portal.server.impl.invocation.InvocationImpl] Invoking org.jboss.portal.server.invocation.portal.TargetInterceptor
                    [org.jboss.portal.server.impl.invocation.InvocationImpl] Invoking org.jboss.portal.core.invocation.ViewInterceptor
                    [org.jboss.portal.server.impl.invocation.InvocationImpl] Invoking org.jboss.portal.core.invocation.StrategyInterceptor
                    [org.jboss.portal.core.invocation.StrategyInterceptor] analyzing layout strategy....
                    [org.jboss.portal.server.impl.LayoutServerImpl] get nodesk...
                    [org.jboss.portal.server.impl.LayoutServerImpl] found nodesk
                    [org.jboss.portal.core.invocation.StrategyInterceptor] looking for a layout strategy [default] [JPivotDemo] [nodesk] [text/html]
                    [org.jboss.portal.core.invocation.StrategyInterceptor] got a layout: trying to get the strategy from it...
                    [org.jboss.portal.core.invocation.StrategyInterceptor] no strategy from the layoutlayout: trying to get named strategy...
                    [org.jboss.portal.core.invocation.StrategyInterceptor] looking for strategy with name: default
                    [org.jboss.portal.core.invocation.StrategyInterceptor] found strategy to use: org.jboss.portal.core.theme.strategy.impl.DefaultStrategyImpl
                    [org.jboss.portal.core.invocation.StrategyInterceptor] adding region: center
                    [org.jboss.portal.core.theme.strategy.StrategyFactory] creating strategy context for: nodesk default JPivotDemo
                    [org.jboss.portal.core.theme.strategy.impl.DefaultStrategyImpl] evaluating strategy for: org.jboss.portal.core.theme.impl.PortalLayoutImpl@9ced84
                    [org.jboss.portal.core.invocation.StrategyInterceptor] setting layout URI: /nodesk/index.jsp
                    [org.jboss.portal.core.invocation.StrategyInterceptor] done analyzing layout strategy
                    [org.jboss.portal.server.impl.invocation.InvocationImpl] Invoking org.jboss.portal.server.invocation.portal.MainDispatcherInterceptor
                    [org.jboss.portal.core.servlet.CoreServlet] requesting theme: null
                    [org.jboss.portal.core.servlet.CoreServlet] using layout returned from the strategy: nodesk uri: /nodesk/index.jsp
                    [org.jboss.portal.core.servlet.CoreServlet] got layout to use [nodesk] in app [portal] uri [/nodesk/index.jsp]
                    [org.jboss.portal.server.theme.LayoutDispatcher] got request dispatcher for layout resource: true
                    [org.jboss.portal.server.theme.LayoutDispatcher] done with the layout
                    


                    The behavior above where my portlet was not being called indicated that no page was found in *-pages.xml. Should this throw an exception?

                    After much comparison of my config files to helloworld, and looking at the Reference Guide, I realized that my instance-ref in *-pages.xml was wrong. It needs to be:

                    [<app-name> from jboss-app.xml].[<portlet-name> from portlet.xml].[<instance-name> from portlet-instances.xml]

                    Note that the Reference Guide is wrong about the <app-name> in section 2.6. It is in jboss-app.xml, not jboss-portlet.xml.



                    Sherman

                    • 7. Re: Bridge Interceptor
                      Martin Giljohann Newbie

                      THANKS! I wasn't aware of the jboss-app.xml, was just wondering why my own portlet suddenly did not show up any more with the portal sources from cvs head.

                      Martin

                      • 8. Re: Bridge Interceptor
                        venkat rao Newbie

                        When I try to get the servletcontext (servletContextProvider.getServletContext(this)) I get a IllegalStateException

                        java.lang.IllegalStateException: No bridge set
                        at org.jboss.portal.bridge.JBossServletContextProvider.getServletContext(JBossServletContextProvider.java:53)
                        

                        I have this in my portlet.xml and jboss-portlet.xml
                        <init-param>
                         <name>ServletContextProvider</name>
                         <value>org.jboss.portal.bridge.JBossServletContextProvider</value>
                        </init-param>
                        

                        <portlet>
                         <portlet-name>StrutsPortletDemo</portlet-name>
                         <config-name>StrutsPortlet</config-name>
                         </portlet>
                        

                        The init method in my portlet sets up a ServletContextProvider like the StrutsPortlet does. Also struts-demo is running fine.
                        Any help would be much appreciated.