felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Walker <r...@ascert.com>
Subject Re: HttpService: ServletContext not shared across filters
Date Wed, 12 Dec 2012 13:57:14 GMT
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 they use the same HttpContext, they won't share any 
ServletContext. I suspect that could be a cause of the problem you are 
seeing - although I don't know how you'd change it with the model you 
are using (which seems to be based form of dependency injection from 
config type approach)

- Rob

On 12/12/2012 3:48 PM, Reto Bachmann-Gmür wrote:
> 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 <robw@ascert.com> wrote:
>
>> 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.
>>
>> - Rob
>>
>>
>> On 12/12/2012 1:49 PM, Reto Bachmann-Gmür wrote:
>>
>>> On Dec 12, 2012 6:13 AM, "Rob Walker" <robw@ascert.com> 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
>>> HttpService spec - so you should be prepared for some digging and
>>> experimentation!
>>>
>>>> Are you registering the servlets used yourself within your own code (i.e.
>>>>
>>> using the HttpService registerServlet call? If so, then one thing you
>>> could
>>> try is to make sure you create your own HttpContext for the register
>>> servlet call, and use the same instance of that object for every servlet
>>> you register. I'm not 100% sure that will cure your case, but worth a try.
>>>
>>>> Also possible you might need both the above and the
>>>>
>>> shared_servlet_context_**attributes flag set
>>>
>>>> -- Rob
>>>>
>>>>
>>>> On 11/12/2012 10:19 PM, Reto Bachmann-Gmür wrote:
>>>>
>>>>> 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 the context of another filter. I also tries
>>>>>
>>>> setting
>>>> org.apache.felix.http.shared_**servlet_context_attributes to "true" but
>>>> this
>>>> didn't make any difference.
>>>>> Any idea how to have a shared ServletContext?
>>>>>
>>>>> Cheers,
>>>>> Reto
>>>>>
>>>>>   --
>>>>
>>>> Ascert - Taking systems to the edge
>>>> robw@ascert.com
>>>> +27 21 300 2028 ext 5119
>>>> www.ascert.com
>>>>
>>>>
>>>> ------------------------------**------------------------------**
>>>> ---------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.**apache.org<users-unsubscribe@felix.apache.org>
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>>
>> --
>>
>>
>> Ascert - Taking systems to the edge
>> robw@ascert.com
>> +27 21 300 2028 ext 5119
>> www.ascert.com
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@felix.**apache.org<users-unsubscribe@felix.apache.org>
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>

-- 


Ascert - Taking systems to the edge
robw@ascert.com
+27 21 300 2028 ext 5119
www.ascert.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message