You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by Dennis Dam <d....@hippo.nl> on 2007/12/17 23:22:59 UTC

NULL servletcontext for local portlet apps

Hi all,

Does anybody know why the context root of local portlet applications is 
set to "<portal>" in PortletApplicationManager ? I ran into the problem 
when I got a NPE for the local servletcontext when I deployed a portlet 
app in the local deploy dir, by accident :) My portlets do cross-context 
includes and use the ServletContextProviderImpl to fetch the portlet 
app's servlet context, and use that context to get the other webapp's 
context.  Can we safely change <portal> to jetspeed's context root ? 
Even better, since we know that the portlet app is running locally, why 
not use Jetspeed's servletcontext when creating portlet instances in 
JetspeedPortletFactory.getPortletInstance() ? For example:

PortletContext portletContext;
if (pa.getApplicationType()==MutablePortletApplication.LOCAL){
  portletContext = 
PortalAccessor.createPortletContext(jetspeedServletContext, pa);      // 
use jetspeed's servlet context    
} else {
  portletContext = PortalAccessor.createPortletContext(servletContext, 
pa);     // default 
}

the only thing left to do is inject the Jetspeed servletcontext Spring 
bean in the JetspeedPortletFactory to set the jetspeedServletContext var.

WDYT?

Dennis

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: NULL servletcontext for local portlet apps

Posted by Dennis Dam <d....@hippo.nl>.
There is one problem though: there's no way of getting the context root 
outside of the scope of the request, is that right? That's probably why 
the local portlet app's context root is set to <portal> :)


David Sean Taylor wrote:
>
> On Dec 17, 2007, at 2:22 PM, Dennis Dam wrote:
>
>> Hi all,
>>
>> Does anybody know why the context root of local portlet applications 
>> is set to "<portal>" in PortletApplicationManager ? I ran into the 
>> problem when I got a NPE for the local servletcontext when I deployed 
>> a portlet app in the local deploy dir, by accident :) My portlets do 
>> cross-context includes and use the ServletContextProviderImpl to 
>> fetch the portlet app's servlet context, and use that context to get 
>> the other webapp's context.  Can we safely change <portal> to 
>> jetspeed's context root ? Even better, since we know that the portlet 
>> app is running locally, why not use Jetspeed's servletcontext when 
>> creating portlet instances in 
>> JetspeedPortletFactory.getPortletInstance() ? For example:
>>
>> PortletContext portletContext;
>> if (pa.getApplicationType()==MutablePortletApplication.LOCAL){
>>  portletContext = 
>> PortalAccessor.createPortletContext(jetspeedServletContext, pa);      
>> // use jetspeed's servlet context    } else {
>>  portletContext = PortalAccessor.createPortletContext(servletContext, 
>> pa);     // default }
>>
>> the only thing left to do is inject the Jetspeed servletcontext 
>> Spring bean in the JetspeedPortletFactory to set the 
>> jetspeedServletContext var.
>>
>> WDYT?
>>
> Im not sure why its set to <portal>, doesn't seem to have any 
> significance
> Im OK with changing this to the /jetspeed context
> When local PA's were first implemented, I felt like it fell short 
> since we the servlet container could not retrieve resources from the 
> local portlet app
> When I say resources I mean html, css, javascript kind of files
> So even though we solve the class loader nicely, this solution 
> requires all local PAs to share their resources (like the layout 
> portltets do) directly out of the parent /jetspeed context
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: NULL servletcontext for local portlet apps

Posted by David Sean Taylor <da...@bluesunrise.com>.
On Dec 17, 2007, at 2:22 PM, Dennis Dam wrote:

> Hi all,
>
> Does anybody know why the context root of local portlet  
> applications is set to "<portal>" in PortletApplicationManager ? I  
> ran into the problem when I got a NPE for the local servletcontext  
> when I deployed a portlet app in the local deploy dir, by  
> accident :) My portlets do cross-context includes and use the  
> ServletContextProviderImpl to fetch the portlet app's servlet  
> context, and use that context to get the other webapp's context.   
> Can we safely change <portal> to jetspeed's context root ? Even  
> better, since we know that the portlet app is running locally, why  
> not use Jetspeed's servletcontext when creating portlet instances  
> in JetspeedPortletFactory.getPortletInstance() ? For example:
>
> PortletContext portletContext;
> if (pa.getApplicationType()==MutablePortletApplication.LOCAL){
>  portletContext = PortalAccessor.createPortletContext 
> (jetspeedServletContext, pa);      // use jetspeed's servlet  
> context    } else {
>  portletContext = PortalAccessor.createPortletContext 
> (servletContext, pa);     // default }
>
> the only thing left to do is inject the Jetspeed servletcontext  
> Spring bean in the JetspeedPortletFactory to set the  
> jetspeedServletContext var.
>
> WDYT?
>
Im not sure why its set to <portal>, doesn't seem to have any  
significance
Im OK with changing this to the /jetspeed context
When local PA's were first implemented, I felt like it fell short  
since we the servlet container could not retrieve resources from the  
local portlet app
When I say resources I mean html, css, javascript kind of files
So even though we solve the class loader nicely, this solution  
requires all local PAs to share their resources (like the layout  
portltets do) directly out of the parent /jetspeed context



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org