[jboss-user] [JBoss Portal] - Re: Injecting PortalObjectContainer into servlet

jkoek do-not-reply at jboss.com
Sat Jul 22 08:12:11 EDT 2006


Julien,

I tried it. 
I'm getting now a PortalObjectContainer object but I'm not able to retrieve  the context. This context makes it possible for me to createPages and Windows.

Underneath the code that I have used and the jboss-portlet.xml that is part of my servlet deployment.


Can you give me a new hint?

Thanks,

jeroen.

try
{
        MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
        container = (PortalObjectContainer)  
                          MBeanProxy.get(PortalObjectContainer.class, 
                          new ObjectName("portal:container=PortalObject"),
                          mbeanServer);
}
catch (Exception e)
{
        log.error("Cannot get interceptor stack", e);
        throw new IllegalStateException("Cannot get interceptor stack");
}	
if (container == null) {
			System.out.println("No portal object container");
}
else
{
	System.out.println( "We got the portal object container" );
	Context ctx = null;
	 try {
		ctx = container.getContext();
	 } 
	 catch ( Exception ex )  {
	  	System.out.println( "Failed to get context" );
	  }	
	  if ( ctx == null ) {
 	      System.out.println( "PortalObjectContainer context is empty!" );
	 }
}

<portlet-app>
    <!-- Service injected in the portlet context. -->
    
      <service-name>PortalObjectContainer</service-name>
      <service-class>org.jboss.portal.core.model.portal.PortalObjectContainer</service-class>
      <service-ref>portal:container=PortalObject</service-ref>
   
       
</portlet-app>


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960103#3960103

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960103



More information about the jboss-user mailing list