How to indentify context root of url?

Discussion in 'Java' started by jlc488, Dec 5, 2009.

  1. jlc488

    jlc488 Guest

    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.
     
    jlc488, Dec 5, 2009
    #1
    1. Advertising

  2. jlc488

    markspace Guest

    jlc488 wrote:

    > 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?
     
    markspace, Dec 5, 2009
    #2
    1. Advertising

  3. jlc488

    jlc488 Guest

    On Dec 6, 1:50 am, markspace <> wrote:
    > jlc488wrote:
    > > I am using cookies to manage session and if I have a given url of
    > >http://www.test.com/aorhttp://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?


    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
     
    jlc488, Dec 8, 2009
    #3
  4. jlc488 wrote:
    > On Dec 6, 1:50 am, markspace <> wrote:
    >> jlc488wrote:
    >>> I am using cookies to manage session and if I have a given url of
    >>> http://www.test.com/aorhttp://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?

    >
    > 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
     
    Jeffrey H. Coffield, Dec 8, 2009
    #4
  5. jlc488

    jlc488 Guest

    On Dec 8, 3:26 pm, "Jeffrey H. Coffield"
    <> wrote:
    > jlc488wrote:
    > > On Dec 6, 1:50 am, markspace <> wrote:
    > >> jlc488wrote:
    > >>> I am using cookies to manage session and if I have a given url of
    > >>>http://www.test.com/aorhttp://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?

    >
    > > 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 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.
     
    jlc488, Dec 14, 2009
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,279
  2. Rick Osborn
    Replies:
    10
    Views:
    3,989
    Jon A. Cruz
    Feb 8, 2004
  3. MattC
    Replies:
    1
    Views:
    506
    Manish Pandit
    Feb 8, 2007
  4. Replies:
    34
    Views:
    781
  5. Replies:
    7
    Views:
    403
    red floyd
    Dec 9, 2005
Loading...

Share This Page