2 Replies Latest reply on Apr 22, 2008 11:13 AM by biglou214

    Portlet Header Injection

    biglou214

      I have been trying to get portlet header injection to work via jboss-portlet.xml without any luck. I am running on Jboss Portal 2.6. My jboss-portlet.xml contains the following:

      <portlet-app>
       <portlet>
       <portlet-name>welcome</portlet-name>
       <header-content>
       <link rel="stylesheet" type="text/css" href="/css/welcome.css" />
       </header-content>
       </portlet>
      </portlet-app>


      In the head for my theme I have the <p:headerContent /> tag, but when the page loads there is no link tag injected. Anyone seen this issue and know what could be going on?




        • 1. Re: Portlet Header Injection
          esmith1

          I am injecting both link and script this way without problem. One thought might be if your portlet-name (welcome) did not match the same value in portlet.xml?

          Also check your jboss log file after you deploy -- I've had silent failures when the parsing of the jboss-portlet.xml fails due to a syntax error. After the INFO
          [TomcatDeployer] deploy line in the log you should see an INFO [PortletAppDeployment] Parsing /xyz/jboss-portlet.xml line.


          File ideally would now use DTD at top, although shouldnt matter.

          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE portlet-app PUBLIC
           "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
           "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
          <portlet-app>
          ...
          


          • 2. Re: Portlet Header Injection
            biglou214

            Thanks for the response. Turns out everything was fine in my jboss-portlet.xml. I ended up grabbing the jboss source and walking through the code in the debugger. Turns out that the HeaderInterceptor was never being called. At some point it looks like my Interceptor declarations were messed up. Just in case anyone else gets into this state there are two lines that need to be in your jboss-service.xml /server/default/deploy/jboss-portal/sar/META-INF/jboss-service.xml.

            The first is:

            <mbean
             code="org.jboss.portal.core.aspects.portlet.HeaderInterceptor"
             name="portal:service=Interceptor,type=Portlet,name=Header"
             xmbean-dd=""
             xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
             <xmbean/>
             </mbean>


            The second, and the one that had been removed in my deployment is in the depends-list for the JbossInterceptorStackFactory:
            <depends-list-element>portal:service=Interceptor,type=Portlet,name=Header</depends-list-element>


            After adding that in, everything works like a charm!