HttpService: ServletContext not shared across filters

2012-12-11 Thread Reto Bachmann-Gmür
Helo I'm trying to integrate an application that makes extensive use of ServletContext for communication between components via attributes. Unfortunately it seems that different Filters have different servletContexts so that the attributes set to the context of one filter cannot be accessed from t

Re: HttpService: ServletContext not shared across filters

2012-12-11 Thread Rob Walker
One thing you don't mention is your bundle and alias usage structure. Also, Filters (to my knowledge) weren't ever really a part of the OSGi HttpService spec - so you should be prepared for some digging and experimentation! Are you registering the servlets used yourself within your own code

Re: HttpService: ServletContext not shared across filters

2012-12-12 Thread Reto Bachmann-Gmür
On Dec 12, 2012 6:13 AM, "Rob Walker" wrote: > > One thing you don't mention is your bundle and alias usage structure. Both filters are registered using the whiteboard extension and with the identical pattern. Cheers, Reto > Also, Filters (to my knowledge) weren't ever really a part of the OSGi

Re: HttpService: ServletContext not shared across filters

2012-12-12 Thread Rob Walker
I would definitely double check that both filters use the same HttpContext and aren't having their own default ones created. Can't say for sure it will solve your problem, but I know that not using the same HttpContext across servlets will pretty much guarantee they won't share anything. - Ro

Re: HttpService: ServletContext not shared across filters

2012-12-12 Thread Reto Bachmann-Gmür
Both Filter have annotations like this: @Service(value = javax.servlet.Filter.class) @Properties({ @Property(name ="pattern", value=".*") }) The filters are provided from different bundles. I'm not setting any HttpContext explicitely. Cheers, Reto On Wed, Dec 12, 2012 at 1:09 PM, Rob Walker

Re: HttpService: ServletContext not shared across filters

2012-12-12 Thread Rob Walker
Unfortunately I haven't used the HttpService in this manner (or with Filters) so I don't think I'll be able to offer much more help. I know in explicit, hard coded cases, if you create servlets in separate bundles even if they are of the same class, and you register them without making sure th

Re: HttpService: ServletContext not shared across filters

2012-12-13 Thread Chetan Mehrotra
Have a look at HttpWhiteboardConstants#CONTEXT_ID [1]. From that it appears that to share the context you need to 1. Register a HttpContext as a service with service property 'contextId' set to some shared name say foo 2. Register your filter with property contextId to 'foo' 3. Also set property '

Re: HttpService: ServletContext not shared across filters

2012-12-13 Thread Rob Walker
Cheers for helping out here Chetan. I was pretty sure the trick needed was to get them to share their HttpContext, but I couldn't advise on how that needed to be done with this usage of the whiteboard pattern - Rob On 13/12/2012 11:47 AM, Chetan Mehrotra wrote: Have a look at HttpWhiteboardCo

Re: HttpService: ServletContext not shared across filters

2012-12-14 Thread Reto Bachmann-Gmür
Thanks Rob and Cetan It seems that sharing a context is a trade-off between security and functionality. As for sharing properties and services OSGi has better means than servlet context attributes I should convince the developers no longer to use this path. Reto On Thu, Dec 13, 2012 at 11:08 AM,