You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Ivanhoe Abrahams <iv...@gmail.com> on 2012/02/09 10:38:28 UTC

Http Service context path

Hi all

I have been playing around with the httpservice.
In my playpen want to get OSGI (Felix) and Vaadin to play nicely together
(which it does).
However at this point I am facing a problem whereby I register two servlets
with different aliases (these servlets extend Vaadin's
AbstractApplicationServlet).
My problem is that these two servlets(actually vaadin applications), seem
to be sharing the same session and what I would like to know is, Is there a
way to register
servlets under different context-paths? because the context path for both
servlets is "/" which is what is causing the servlets to share the same
session, i think.
I want to be able to do this programmatically as well.

The way I am testing this is simply to fire up chrome and open 2 url's eg:

http://localhost:8080/testapp1/
and then another tab
http://localhost:8080/testapp2/

However when I access the second url, it seems like the httprequest
contains the first app's session. Hence my question about context-paths and
how to
seperate the two app's (in terms of session management).

Any advice would be helpful.

By the way I am use the http service bundle (ExtHttpService) to register
servlets and filters and have jetty enabled in the config file.

Regards
Ivanhoe

Re: Http Service context path

Posted by Sahoo <sa...@oracle.com>.
You don't have to implement HttpContext yourself. Just call 
HttpService.createDefaultHttpContext() to get a new instance of 
HttpContext which you can use to create your own ServletContext 
boundary. At least this is how we have implemented the OSGi/Http spec in 
GlassFish. If you want to try out GlassFish Http Service and have 
questions around that, then don't ask here; please use GlassFish forum.

Sahoo

On Thursday 09 February 2012 05:02 PM, Ivanhoe Abrahams wrote:
> Yes
>
> what I have also tried was to create a 
> org.osgi.service.http.HttpContext for each servlet but still the 
> context-path remains "/".
> What I do not understand how implementing the HttpContext which has 
> the following structure
>
>    java.lang.String getMimeType( java.lang.String name);
>    java.net.URL getMimeType( java.lang.String name);
>    boolean getResource java.lang.String name);
>
> would translate into the servletcontext's contextpath changing from 
> "/" to something else.
>
> Regards
> Ivanhoe
>
>
> ||On Thu, Feb 9, 2012 at 1:17 PM, Sahoo <sanjeeb.sahoo@oracle.com 
> <ma...@oracle.com>> wrote:
>
>     This is a bit odd or am I misunderstanding this discussion. OSGi
>     HttpService spec does talk about ServletContext which existed even
>     in Servlet 2.1. Each org.osgi.service.http.HttpContext should map
>     to its own ServletContext. Is that now how Felix HttpService
>     implemented?
>
>     Thanks,
>     Sahoo
>
>
>     On Thursday 09 February 2012 03:25 PM, Felix Meschberger wrote:
>
>         Hi,
>
>         This is a bit of a grey area at this point in time. AFAICT the
>         current Http Service spec is based on Servlet API 2.1 and
>         there was no Servlet Context at that time.
>
>         Thus all servlets deployed registered with a single Http
>         Service share the same Servlet Context and thus HttpSession.
>
>         Regards
>         Felix
>
>         Am 09.02.2012 um 10:38 schrieb Ivanhoe Abrahams:
>
>             Hi all
>
>             I have been playing around with the httpservice.
>             In my playpen want to get OSGI (Felix) and Vaadin to play
>             nicely together
>             (which it does).
>             However at this point I am facing a problem whereby I
>             register two servlets
>             with different aliases (these servlets extend Vaadin's
>             AbstractApplicationServlet).
>             My problem is that these two servlets(actually vaadin
>             applications), seem
>             to be sharing the same session and what I would like to
>             know is, Is there a
>             way to register
>             servlets under different context-paths? because the
>             context path for both
>             servlets is "/" which is what is causing the servlets to
>             share the same
>             session, i think.
>             I want to be able to do this programmatically as well.
>
>             The way I am testing this is simply to fire up chrome and
>             open 2 url's eg:
>
>             http://localhost:8080/testapp1/
>             and then another tab
>             http://localhost:8080/testapp2/
>
>             However when I access the second url, it seems like the
>             httprequest
>             contains the first app's session. Hence my question about
>             context-paths and
>             how to
>             seperate the two app's (in terms of session management).
>
>             Any advice would be helpful.
>
>             By the way I am use the http service bundle
>             (ExtHttpService) to register
>             servlets and filters and have jetty enabled in the config
>             file.
>
>             Regards
>             Ivanhoe
>
>
>         ---------------------------------------------------------------------
>         To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>         <ma...@felix.apache.org>
>         For additional commands, e-mail: users-help@felix.apache.org
>         <ma...@felix.apache.org>
>
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>     <ma...@felix.apache.org>
>     For additional commands, e-mail: users-help@felix.apache.org
>     <ma...@felix.apache.org>
>
>


Re: Http Service context path

Posted by Ivanhoe Abrahams <iv...@gmail.com>.
Yes

what I have also tried was to create a org.osgi.service.http.HttpContext
for each servlet but still the context-path remains "/".
What I do not understand how implementing the HttpContext which has the
following structure

   java.lang.String getMimeType( java.lang.String name);
   java.net.URL getMimeType( java.lang.String name);
   boolean getResource java.lang.String name);

would translate into the servletcontext's contextpath changing from "/" to
something else.

Regards
Ivanhoe


On Thu, Feb 9, 2012 at 1:17 PM, Sahoo <sa...@oracle.com> wrote:

> This is a bit odd or am I misunderstanding this discussion. OSGi
> HttpService spec does talk about ServletContext which existed even in
> Servlet 2.1. Each org.osgi.service.http.**HttpContext should map to its
> own ServletContext. Is that now how Felix HttpService implemented?
>
> Thanks,
> Sahoo
>
>
> On Thursday 09 February 2012 03:25 PM, Felix Meschberger wrote:
>
>> Hi,
>>
>> This is a bit of a grey area at this point in time. AFAICT the current
>> Http Service spec is based on Servlet API 2.1 and there was no Servlet
>> Context at that time.
>>
>> Thus all servlets deployed registered with a single Http Service share
>> the same Servlet Context and thus HttpSession.
>>
>> Regards
>> Felix
>>
>> Am 09.02.2012 um 10:38 schrieb Ivanhoe Abrahams:
>>
>>  Hi all
>>>
>>> I have been playing around with the httpservice.
>>> In my playpen want to get OSGI (Felix) and Vaadin to play nicely together
>>> (which it does).
>>> However at this point I am facing a problem whereby I register two
>>> servlets
>>> with different aliases (these servlets extend Vaadin's
>>> AbstractApplicationServlet).
>>> My problem is that these two servlets(actually vaadin applications), seem
>>> to be sharing the same session and what I would like to know is, Is
>>> there a
>>> way to register
>>> servlets under different context-paths? because the context path for both
>>> servlets is "/" which is what is causing the servlets to share the same
>>> session, i think.
>>> I want to be able to do this programmatically as well.
>>>
>>> The way I am testing this is simply to fire up chrome and open 2 url's
>>> eg:
>>>
>>> http://localhost:8080/**testapp1/ <http://localhost:8080/testapp1/>
>>> and then another tab
>>> http://localhost:8080/**testapp2/ <http://localhost:8080/testapp2/>
>>>
>>> However when I access the second url, it seems like the httprequest
>>> contains the first app's session. Hence my question about context-paths
>>> and
>>> how to
>>> seperate the two app's (in terms of session management).
>>>
>>> Any advice would be helpful.
>>>
>>> By the way I am use the http service bundle (ExtHttpService) to register
>>> servlets and filters and have jetty enabled in the config file.
>>>
>>> Regards
>>> Ivanhoe
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@felix.**apache.org<us...@felix.apache.org>
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@felix.**apache.org<us...@felix.apache.org>
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Http Service context path

Posted by Sahoo <sa...@oracle.com>.
This is a bit odd or am I misunderstanding this discussion. OSGi 
HttpService spec does talk about ServletContext which existed even in 
Servlet 2.1. Each org.osgi.service.http.HttpContext should map to its 
own ServletContext. Is that now how Felix HttpService implemented?

Thanks,
Sahoo

On Thursday 09 February 2012 03:25 PM, Felix Meschberger wrote:
> Hi,
>
> This is a bit of a grey area at this point in time. AFAICT the current Http Service spec is based on Servlet API 2.1 and there was no Servlet Context at that time.
>
> Thus all servlets deployed registered with a single Http Service share the same Servlet Context and thus HttpSession.
>
> Regards
> Felix
>
> Am 09.02.2012 um 10:38 schrieb Ivanhoe Abrahams:
>
>> Hi all
>>
>> I have been playing around with the httpservice.
>> In my playpen want to get OSGI (Felix) and Vaadin to play nicely together
>> (which it does).
>> However at this point I am facing a problem whereby I register two servlets
>> with different aliases (these servlets extend Vaadin's
>> AbstractApplicationServlet).
>> My problem is that these two servlets(actually vaadin applications), seem
>> to be sharing the same session and what I would like to know is, Is there a
>> way to register
>> servlets under different context-paths? because the context path for both
>> servlets is "/" which is what is causing the servlets to share the same
>> session, i think.
>> I want to be able to do this programmatically as well.
>>
>> The way I am testing this is simply to fire up chrome and open 2 url's eg:
>>
>> http://localhost:8080/testapp1/
>> and then another tab
>> http://localhost:8080/testapp2/
>>
>> However when I access the second url, it seems like the httprequest
>> contains the first app's session. Hence my question about context-paths and
>> how to
>> seperate the two app's (in terms of session management).
>>
>> Any advice would be helpful.
>>
>> By the way I am use the http service bundle (ExtHttpService) to register
>> servlets and filters and have jetty enabled in the config file.
>>
>> Regards
>> Ivanhoe
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>


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


Re: Http Service context path

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Ivanhoe,

unfortunately I don't have much time at hand right now and
by just "staring" at it I didn't see anything :)
So I just can give you some hints that might help you to get started.
Take a look at all those samples that are available at the pax-web 
project [1].
Another thing, I might suggest, you can also try with the http-whitboard 
extender.
There is a working example available at the samples [1] and also at the 
itest [2] module.

It might even be better for you to just deploying a wab (war with manifest)
Pax Web is capable of handling this. This might give you a better 
starting point.

regards, Achim

[1] - https://github.com/ops4j/org.ops4j.pax.web/tree/master/samples
[2] - https://github.com/ops4j/org.ops4j.pax.web/tree/master/itest

Am 09.02.2012 19:30, schrieb Ivanhoe Abrahams:
> Hi Achim
>
> I would like to use the pax-web service implementation,
> I want to register a servlet filter + servlet to the same context-path. I
> am assuming that I have to create a HttpContext object and set it on both.
> I want to do this so that different servlets have different sessions.
>
> The following is a snippet of my code.
>
> <START SNIPPET>
>
> String  contextString = "/webapp-poc";
>
> HttpContext httpContext = new DefaultHttpContext(referenceBundle);
> Hashtable<String, String>  dictionary = new Hashtable<String, String>();
> dictionary.put("widgetset", "x.y.z.Widgetset");
>
> MyFilter myFilter = new  MyFilter ();
> paxWebContainer.registerFilter( myFilter , new String[]{contextString +
> "/.*"} , new String[]{ "webapp-poc" }, dictionary, httpContext);
>
> MyWebServletImpl bpServlet =  new  MyWebServletImpl();
> paxWebContainer.registerServlet(bpServlet, "webapp-poc", new
> String[]{contextString} , dictionary, httpContext);
>
> <END SNIPPET>
>
> This code executes with no error, but now when I try to access
> http://localhost:8080/webapp-poc/ I get a 404
> Not sure what I am doing wrong here.
>
> If you see a glaring error...let me know please
>
> Regards
> Ivanhoe
>
>
>
> On Thu, Feb 9, 2012 at 12:40 PM, Achim Nierbeck<bc...@googlemail.com>wrote:
>
>> Hi Ivanhoe,
>>
>> yep pax-web does :)
>>
>> regards, Achim
>>
>> 2012/2/9 Ivanhoe Abrahams<iv...@gmail.com>
>>
>>> Hi Felix
>>>
>>> Thanks for your reply
>>> I think maybe  I will try the pax-web implementation? Wonder if they
>> offer
>>> this functionality, will look.
>>> thanks again.
>>>
>>> Regards
>>> Ivanhoe
>>>
>>> On Thu, Feb 9, 2012 at 11:55 AM, Felix Meschberger<fmeschbe@adobe.com
>>>> wrote:
>>>> Hi,
>>>>
>>>> This is a bit of a grey area at this point in time. AFAICT the current
>>>> Http Service spec is based on Servlet API 2.1 and there was no Servlet
>>>> Context at that time.
>>>>
>>>> Thus all servlets deployed registered with a single Http Service share
>>> the
>>>> same Servlet Context and thus HttpSession.
>>>>
>>>> Regards
>>>> Felix
>>>>
>>>> Am 09.02.2012 um 10:38 schrieb Ivanhoe Abrahams:
>>>>
>>>>> Hi all
>>>>>
>>>>> I have been playing around with the httpservice.
>>>>> In my playpen want to get OSGI (Felix) and Vaadin to play nicely
>>> together
>>>>> (which it does).
>>>>> However at this point I am facing a problem whereby I register two
>>>> servlets
>>>>> with different aliases (these servlets extend Vaadin's
>>>>> AbstractApplicationServlet).
>>>>> My problem is that these two servlets(actually vaadin applications),
>>> seem
>>>>> to be sharing the same session and what I would like to know is, Is
>>>> there a
>>>>> way to register
>>>>> servlets under different context-paths? because the context path for
>>> both
>>>>> servlets is "/" which is what is causing the servlets to share the
>> same
>>>>> session, i think.
>>>>> I want to be able to do this programmatically as well.
>>>>>
>>>>> The way I am testing this is simply to fire up chrome and open 2
>> url's
>>>> eg:
>>>>> http://localhost:8080/testapp1/
>>>>> and then another tab
>>>>> http://localhost:8080/testapp2/
>>>>>
>>>>> However when I access the second url, it seems like the httprequest
>>>>> contains the first app's session. Hence my question about
>> context-paths
>>>> and
>>>>> how to
>>>>> seperate the two app's (in terms of session management).
>>>>>
>>>>> Any advice would be helpful.
>>>>>
>>>>> By the way I am use the http service bundle (ExtHttpService) to
>>> register
>>>>> servlets and filters and have jetty enabled in the config file.
>>>>>
>>>>> Regards
>>>>> Ivanhoe
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>>
>>
>>
>> --
>>
>> Apache Karaf<http://karaf.apache.org/>  Committer&  PMC
>> OPS4J Pax Web<http://wiki.ops4j.org/display/paxweb/Pax+Web/>  Committer&
>> Project Lead
>> blog<http://notizblog.nierbeck.de/>
>>


-- 
- Apache Karaf<http://karaf.apache.org/>  Committer&  PMC
- OPS4J Pax Web<http://wiki.ops4j.org/display/paxweb/Pax+Web/>    Committer&  Project Lead
- Blog<http://notizblog.nierbeck.de/>


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


Re: Http Service context path

Posted by Ivanhoe Abrahams <iv...@gmail.com>.
Hi Achim

I would like to use the pax-web service implementation,
I want to register a servlet filter + servlet to the same context-path. I
am assuming that I have to create a HttpContext object and set it on both.
I want to do this so that different servlets have different sessions.

The following is a snippet of my code.

<START SNIPPET>

String  contextString = "/webapp-poc";

HttpContext httpContext = new DefaultHttpContext(referenceBundle);
Hashtable<String, String> dictionary = new Hashtable<String, String>();
dictionary.put("widgetset", "x.y.z.Widgetset");

MyFilter myFilter = new  MyFilter ();
paxWebContainer.registerFilter( myFilter , new String[]{contextString +
"/.*"} , new String[]{ "webapp-poc" }, dictionary, httpContext);

MyWebServletImpl bpServlet =  new  MyWebServletImpl();
paxWebContainer.registerServlet(bpServlet, "webapp-poc", new
String[]{contextString} , dictionary, httpContext);

<END SNIPPET>

This code executes with no error, but now when I try to access
http://localhost:8080/webapp-poc/ I get a 404
Not sure what I am doing wrong here.

If you see a glaring error...let me know please

Regards
Ivanhoe



On Thu, Feb 9, 2012 at 12:40 PM, Achim Nierbeck <bc...@googlemail.com>wrote:

> Hi Ivanhoe,
>
> yep pax-web does :)
>
> regards, Achim
>
> 2012/2/9 Ivanhoe Abrahams <iv...@gmail.com>
>
> > Hi Felix
> >
> > Thanks for your reply
> > I think maybe  I will try the pax-web implementation? Wonder if they
> offer
> > this functionality, will look.
> > thanks again.
> >
> > Regards
> > Ivanhoe
> >
> > On Thu, Feb 9, 2012 at 11:55 AM, Felix Meschberger <fmeschbe@adobe.com
> > >wrote:
> >
> > > Hi,
> > >
> > > This is a bit of a grey area at this point in time. AFAICT the current
> > > Http Service spec is based on Servlet API 2.1 and there was no Servlet
> > > Context at that time.
> > >
> > > Thus all servlets deployed registered with a single Http Service share
> > the
> > > same Servlet Context and thus HttpSession.
> > >
> > > Regards
> > > Felix
> > >
> > > Am 09.02.2012 um 10:38 schrieb Ivanhoe Abrahams:
> > >
> > > > Hi all
> > > >
> > > > I have been playing around with the httpservice.
> > > > In my playpen want to get OSGI (Felix) and Vaadin to play nicely
> > together
> > > > (which it does).
> > > > However at this point I am facing a problem whereby I register two
> > > servlets
> > > > with different aliases (these servlets extend Vaadin's
> > > > AbstractApplicationServlet).
> > > > My problem is that these two servlets(actually vaadin applications),
> > seem
> > > > to be sharing the same session and what I would like to know is, Is
> > > there a
> > > > way to register
> > > > servlets under different context-paths? because the context path for
> > both
> > > > servlets is "/" which is what is causing the servlets to share the
> same
> > > > session, i think.
> > > > I want to be able to do this programmatically as well.
> > > >
> > > > The way I am testing this is simply to fire up chrome and open 2
> url's
> > > eg:
> > > >
> > > > http://localhost:8080/testapp1/
> > > > and then another tab
> > > > http://localhost:8080/testapp2/
> > > >
> > > > However when I access the second url, it seems like the httprequest
> > > > contains the first app's session. Hence my question about
> context-paths
> > > and
> > > > how to
> > > > seperate the two app's (in terms of session management).
> > > >
> > > > Any advice would be helpful.
> > > >
> > > > By the way I am use the http service bundle (ExtHttpService) to
> > register
> > > > servlets and filters and have jetty enabled in the config file.
> > > >
> > > > Regards
> > > > Ivanhoe
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > > For additional commands, e-mail: users-help@felix.apache.org
> > >
> > >
> >
>
>
>
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> blog <http://notizblog.nierbeck.de/>
>

Re: Http Service context path

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Ivanhoe,

yep pax-web does :)

regards, Achim

2012/2/9 Ivanhoe Abrahams <iv...@gmail.com>

> Hi Felix
>
> Thanks for your reply
> I think maybe  I will try the pax-web implementation? Wonder if they offer
> this functionality, will look.
> thanks again.
>
> Regards
> Ivanhoe
>
> On Thu, Feb 9, 2012 at 11:55 AM, Felix Meschberger <fmeschbe@adobe.com
> >wrote:
>
> > Hi,
> >
> > This is a bit of a grey area at this point in time. AFAICT the current
> > Http Service spec is based on Servlet API 2.1 and there was no Servlet
> > Context at that time.
> >
> > Thus all servlets deployed registered with a single Http Service share
> the
> > same Servlet Context and thus HttpSession.
> >
> > Regards
> > Felix
> >
> > Am 09.02.2012 um 10:38 schrieb Ivanhoe Abrahams:
> >
> > > Hi all
> > >
> > > I have been playing around with the httpservice.
> > > In my playpen want to get OSGI (Felix) and Vaadin to play nicely
> together
> > > (which it does).
> > > However at this point I am facing a problem whereby I register two
> > servlets
> > > with different aliases (these servlets extend Vaadin's
> > > AbstractApplicationServlet).
> > > My problem is that these two servlets(actually vaadin applications),
> seem
> > > to be sharing the same session and what I would like to know is, Is
> > there a
> > > way to register
> > > servlets under different context-paths? because the context path for
> both
> > > servlets is "/" which is what is causing the servlets to share the same
> > > session, i think.
> > > I want to be able to do this programmatically as well.
> > >
> > > The way I am testing this is simply to fire up chrome and open 2 url's
> > eg:
> > >
> > > http://localhost:8080/testapp1/
> > > and then another tab
> > > http://localhost:8080/testapp2/
> > >
> > > However when I access the second url, it seems like the httprequest
> > > contains the first app's session. Hence my question about context-paths
> > and
> > > how to
> > > seperate the two app's (in terms of session management).
> > >
> > > Any advice would be helpful.
> > >
> > > By the way I am use the http service bundle (ExtHttpService) to
> register
> > > servlets and filters and have jetty enabled in the config file.
> > >
> > > Regards
> > > Ivanhoe
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>

Re: Http Service context path

Posted by Ivanhoe Abrahams <iv...@gmail.com>.
Hi Felix

Thanks for your reply
I think maybe  I will try the pax-web implementation? Wonder if they offer
this functionality, will look.
thanks again.

Regards
Ivanhoe

On Thu, Feb 9, 2012 at 11:55 AM, Felix Meschberger <fm...@adobe.com>wrote:

> Hi,
>
> This is a bit of a grey area at this point in time. AFAICT the current
> Http Service spec is based on Servlet API 2.1 and there was no Servlet
> Context at that time.
>
> Thus all servlets deployed registered with a single Http Service share the
> same Servlet Context and thus HttpSession.
>
> Regards
> Felix
>
> Am 09.02.2012 um 10:38 schrieb Ivanhoe Abrahams:
>
> > Hi all
> >
> > I have been playing around with the httpservice.
> > In my playpen want to get OSGI (Felix) and Vaadin to play nicely together
> > (which it does).
> > However at this point I am facing a problem whereby I register two
> servlets
> > with different aliases (these servlets extend Vaadin's
> > AbstractApplicationServlet).
> > My problem is that these two servlets(actually vaadin applications), seem
> > to be sharing the same session and what I would like to know is, Is
> there a
> > way to register
> > servlets under different context-paths? because the context path for both
> > servlets is "/" which is what is causing the servlets to share the same
> > session, i think.
> > I want to be able to do this programmatically as well.
> >
> > The way I am testing this is simply to fire up chrome and open 2 url's
> eg:
> >
> > http://localhost:8080/testapp1/
> > and then another tab
> > http://localhost:8080/testapp2/
> >
> > However when I access the second url, it seems like the httprequest
> > contains the first app's session. Hence my question about context-paths
> and
> > how to
> > seperate the two app's (in terms of session management).
> >
> > Any advice would be helpful.
> >
> > By the way I am use the http service bundle (ExtHttpService) to register
> > servlets and filters and have jetty enabled in the config file.
> >
> > Regards
> > Ivanhoe
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Http Service context path

Posted by Felix Meschberger <fm...@adobe.com>.
Hi,

This is a bit of a grey area at this point in time. AFAICT the current Http Service spec is based on Servlet API 2.1 and there was no Servlet Context at that time.

Thus all servlets deployed registered with a single Http Service share the same Servlet Context and thus HttpSession.

Regards
Felix

Am 09.02.2012 um 10:38 schrieb Ivanhoe Abrahams:

> Hi all
> 
> I have been playing around with the httpservice.
> In my playpen want to get OSGI (Felix) and Vaadin to play nicely together
> (which it does).
> However at this point I am facing a problem whereby I register two servlets
> with different aliases (these servlets extend Vaadin's
> AbstractApplicationServlet).
> My problem is that these two servlets(actually vaadin applications), seem
> to be sharing the same session and what I would like to know is, Is there a
> way to register
> servlets under different context-paths? because the context path for both
> servlets is "/" which is what is causing the servlets to share the same
> session, i think.
> I want to be able to do this programmatically as well.
> 
> The way I am testing this is simply to fire up chrome and open 2 url's eg:
> 
> http://localhost:8080/testapp1/
> and then another tab
> http://localhost:8080/testapp2/
> 
> However when I access the second url, it seems like the httprequest
> contains the first app's session. Hence my question about context-paths and
> how to
> seperate the two app's (in terms of session management).
> 
> Any advice would be helpful.
> 
> By the way I am use the http service bundle (ExtHttpService) to register
> servlets and filters and have jetty enabled in the config file.
> 
> Regards
> Ivanhoe


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