How to indentify context root of url?

J

jlc488

I have a system which makes url connection to a remote server.

The thing is this method receive a url and make http connection to a
remote server.

And I need to differentiate each urls due to session management
problem.

I am using cookies to manage session and if I have a given url of
http://www.test.com/a or http://www.test.com/b.

These two urls have different context root wich is a and b However,
this domain-cookie reconize as only one.

Client side(the one receives the urls) is running on embeded machine
and compatible with only JDK 1.3

So, this is my questions, How am I suppose to solve this matter?

Any suggestions or ideas would be really appreciated.

Thanks in advance.
 
M

markspace

jlc488 said:
I am using cookies to manage session and if I have a given url of
http://www.test.com/a or http://www.test.com/b.

These two urls have different context root wich is a and b However,
this domain-cookie reconize as only one.


Can you explain what you mean by "context root" in this part?

Because I think you mean one thing, but something else keeps coming up
on Google when I take a look. Cookies only see the URL -- they don't
know anything about how your JEE app is configured. So that's my
question: Are you talking about a JEE context root, or something else?
And if so what?
 
J

jlc488

jlc488wrote:


Can you explain what you mean by "context root" in this part?

Because I think you mean one thing, but something else keeps coming up
on Google when I take a look.  Cookies only see the URL -- they don't
know anything about how your JEE app is configured.  So that's my
question:  Are you talking about a JEE context root, or something else?
  And if so what?

Yes, you are right about cookies. Cookies only have information of
domain address.

But the problem for me is that I need to distinguish each root path
from the given url address.

Let's say, http://localhost:8080/prj1/ <-- this is one context root
named prj1.

It means there is a project on eclipse named prj1.

http://localhost:8080/ <-- this one has a context root of /.

http://localhost:8080 & http://localhost:8080/prj1, they are different
project or web sites.

So, This is my questions. How am I suppose to distinguish those two
projects? If I use cookies, it will consider those two as same.

I hope my explanation helps.

Thanking you
 
J

Jeffrey H. Coffield

jlc488 said:
Yes, you are right about cookies. Cookies only have information of
domain address.

But the problem for me is that I need to distinguish each root path
from the given url address.

Let's say, http://localhost:8080/prj1/ <-- this is one context root
named prj1.

It means there is a project on eclipse named prj1.

http://localhost:8080/ <-- this one has a context root of /.

http://localhost:8080 & http://localhost:8080/prj1, they are different
project or web sites.

So, This is my questions. How am I suppose to distinguish those two
projects? If I use cookies, it will consider those two as same.

I hope my explanation helps.

Thanking you
Unless I totally misunderstand your question (which happens) see

http://www.quirksmode.org/js/cookies.html

Cookies have a "path" as well as a "domain" so you can set different
cookies for www.xyz.com/a and www.xyz.com/b by setting the path to "/a"
or "/b"

Jeff Coffield
www.digitalsynergyinc.com
www.keepmeuptodate.net
 
J

jlc488

jlc488wrote:










Unless I totally misunderstand your question (which happens) see

http://www.quirksmode.org/js/cookies.html

Cookies have a "path" as well as a "domain" so you can set different
cookies forwww.xyz.com/aandwww.xyz.com/bby setting the path to "/a"
or "/b"

Jeff Coffieldwww.digitalsynergyinc.comwww.keepmeuptodate.net

I appreciate your kind reply.

But I am not sure whether I am going to right direction or not.

Actually, I have a program which executes the http connection and
manage session from devices.

This method "execute" does all the property settings for connection
and fetch it.

But the problem here is that any of program can call execute method
and I can not change anything from server side to maintain the
session.

I am using the CookieManager from Ian Brown.

Another problem is,

This is quite confusing, when I send a connection with JSESSIONID with
certain value, It does not return which I've sent. It returns whatever
the server sends it.

Can anyone also explain to me why?

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top