You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Quan Zhou <be...@gmail.com> on 2009/01/06 18:14:19 UTC

how to remove jsessionid parameters in the url at the first time ppl visit the site?

Firstly, i should say i have already read about those past threads which are
concerned with the jsessionid appending in url problem. My experiment proved
the conclusion: the first time people visit the site, the application server
(tomcat) would append the jsessionid into the url no matter whether
your browser has enabled cookie.  then if you continue clicking other links
on the page ,or if you close the windows in your Firefox and reopen it
again, the jsessionid parameters would disappear because the cookie has been
set.
Now here is my scenario. My program should be integrated with other forums
or portal sites. Those sites send their account profiles to my server by
HTTP request with encrypted parameters.(but not HTTPS). Meanwhile, my
program mount a url (like loginx) for such requests which does
some authentication and throws new RestartResponseAtInterceptPageException
to  Home page if success.
Unfortunately, my Home page is constructed with some Frame Pages which means
users would NOT get browser url changing when they click links or submit
forms in the page. so the origin jsessionid set by tomcat like we mentioned
above remains forever.What's the worse, users would get into others account
if they could receive the url existing in the browser address bar by some
way. That's terrible for my system.

BTW, I'm using mod_proxy of Lighttpd to proxy the dynamic request to
the back end Tomcat server which does NOT have any load balance setting or
other cluster usage.

I've tried several methods which turn out to be useless
1) find out some configuration settings which may force the tomcat use
cookie rather than both set the cookie and rewrite the url at the first
time.
2) mount another page as a proxy connecting with my loginx page and Home
page, use setResponsePage at its constructor method.

So my question is : how could I avoid appending jsessionid parameters in the
url permanently even at the first time people visit my site?

Thanks in advance. Appreciate if any advices.

Re: how to remove jsessionid parameters in the url at the first time ppl visit the site?

Posted by Quan Zhou <be...@gmail.com>.
I tried to override void redirect(String url) method, and also strip out the
jsessionid in it. My problem solved.
But I'm not sure whether it would do something harmful to performance or
other functions. I would let you know after my fully test.
Thank you Johan. It's so kind of you!

On Wed, Jan 7, 2009 at 10:45 AM, Quan Zhou <be...@gmail.com> wrote:

>  Thanks for your reply.  This morning I create a new class extends
> BufferedWebResponse and override encodeURL method as you mentioned.
>  The result remains the same. I do print out the origin url passing in , It
> has already contains the substring of ";jsessionid=xxxx", so it won't help
> if I just    return the url. so I intend to cut the url whenever it contains
> "jsessionid" parameter, but I still get this appear even when I do erase it
> in my method body
>  and the return of it indeed doesNOT have that parmater anymore. It drives
> me crazy.
>   Here it is what I do in the final.
>
>     @Override
>     public CharSequence encodeURL(CharSequence url) {
>         final CharSequence encodeURL = super.encodeURL(url);
>         String s = encodeURL.toString();
>         int i = 0;
>         if (s.indexOf("jsessionid=") >= 0) {
>             i = s.indexOf("?");
>             if (i >= 0) {
>                 return encodeURL.subSequence(i, encodeURL.length());
>             } else {
>                 return encodeURL;
>             }
>         } else {
>             return encodeURL;
>         }
>     }
>
>    the encodeURL doesNOT have sessionid parameter, but my url in browser
> address bar is still like
>    "
> http://192.168.1.164:8080/test/do/;jsessionid=6oghp91zh4es?x=1e7mGct0E7Evt3ol1co31g
> "
>
>
> I'm not sure about where I have made a mistake. Please help me, thanks very
> much.
>
> On Wed, Jan 7, 2009 at 1:24 AM, Johan Compagner <jc...@gmail.com>wrote:
>
>> create your own BufferedWebResponse
>> and overwrite this method:
>>
>> public CharSequence encodeURL(CharSequence url)
>>
>> and do nothing, just return the url
>>
>> johan
>>
>>
>> On Tue, Jan 6, 2009 at 18:14, Quan Zhou <be...@gmail.com> wrote:
>>
>> > Firstly, i should say i have already read about those past threads which
>> > are
>> > concerned with the jsessionid appending in url problem. My experiment
>> > proved
>> > the conclusion: the first time people visit the site, the application
>> > server
>> > (tomcat) would append the jsessionid into the url no matter whether
>> > your browser has enabled cookie.  then if you continue clicking other
>> links
>> > on the page ,or if you close the windows in your Firefox and reopen it
>> > again, the jsessionid parameters would disappear because the cookie has
>> > been
>> > set.
>> > Now here is my scenario. My program should be integrated with other
>> forums
>> > or portal sites. Those sites send their account profiles to my server by
>> > HTTP request with encrypted parameters.(but not HTTPS). Meanwhile, my
>> > program mount a url (like loginx) for such requests which does
>> > some authentication and throws new
>> RestartResponseAtInterceptPageException
>> > to  Home page if success.
>> > Unfortunately, my Home page is constructed with some Frame Pages which
>> > means
>> > users would NOT get browser url changing when they click links or submit
>> > forms in the page. so the origin jsessionid set by tomcat like we
>> mentioned
>> > above remains forever.What's the worse, users would get into others
>> account
>> > if they could receive the url existing in the browser address bar by
>> some
>> > way. That's terrible for my system.
>> >
>> > BTW, I'm using mod_proxy of Lighttpd to proxy the dynamic request to
>> > the back end Tomcat server which does NOT have any load balance setting
>> or
>> > other cluster usage.
>> >
>> > I've tried several methods which turn out to be useless
>> > 1) find out some configuration settings which may force the tomcat use
>> > cookie rather than both set the cookie and rewrite the url at the first
>> > time.
>> > 2) mount another page as a proxy connecting with my loginx page and Home
>> > page, use setResponsePage at its constructor method.
>> >
>> > So my question is : how could I avoid appending jsessionid parameters in
>> > the
>> > url permanently even at the first time people visit my site?
>> >
>> > Thanks in advance. Appreciate if any advices.
>> >
>>
>
>

Re: how to remove jsessionid parameters in the url at the first time ppl visit the site?

Posted by Quan Zhou <be...@gmail.com>.
 Thanks for your reply.  This morning I create a new class extends
BufferedWebResponse and override encodeURL method as you mentioned.
 The result remains the same. I do print out the origin url passing in , It
has already contains the substring of ";jsessionid=xxxx", so it won't help
if I just    return the url. so I intend to cut the url whenever it contains
"jsessionid" parameter, but I still get this appear even when I do erase it
in my method body
 and the return of it indeed doesNOT have that parmater anymore. It drives
me crazy.
  Here it is what I do in the final.

    @Override
    public CharSequence encodeURL(CharSequence url) {
        final CharSequence encodeURL = super.encodeURL(url);
        String s = encodeURL.toString();
        int i = 0;
        if (s.indexOf("jsessionid=") >= 0) {
            i = s.indexOf("?");
            if (i >= 0) {
                return encodeURL.subSequence(i, encodeURL.length());
            } else {
                return encodeURL;
            }
        } else {
            return encodeURL;
        }
    }

   the encodeURL doesNOT have sessionid parameter, but my url in browser
address bar is still like
   "
http://192.168.1.164:8080/test/do/;jsessionid=6oghp91zh4es?x=1e7mGct0E7Evt3ol1co31g
"


I'm not sure about where I have made a mistake. Please help me, thanks very
much.

On Wed, Jan 7, 2009 at 1:24 AM, Johan Compagner <jc...@gmail.com>wrote:

> create your own BufferedWebResponse
> and overwrite this method:
>
> public CharSequence encodeURL(CharSequence url)
>
> and do nothing, just return the url
>
> johan
>
>
> On Tue, Jan 6, 2009 at 18:14, Quan Zhou <be...@gmail.com> wrote:
>
> > Firstly, i should say i have already read about those past threads which
> > are
> > concerned with the jsessionid appending in url problem. My experiment
> > proved
> > the conclusion: the first time people visit the site, the application
> > server
> > (tomcat) would append the jsessionid into the url no matter whether
> > your browser has enabled cookie.  then if you continue clicking other
> links
> > on the page ,or if you close the windows in your Firefox and reopen it
> > again, the jsessionid parameters would disappear because the cookie has
> > been
> > set.
> > Now here is my scenario. My program should be integrated with other
> forums
> > or portal sites. Those sites send their account profiles to my server by
> > HTTP request with encrypted parameters.(but not HTTPS). Meanwhile, my
> > program mount a url (like loginx) for such requests which does
> > some authentication and throws new
> RestartResponseAtInterceptPageException
> > to  Home page if success.
> > Unfortunately, my Home page is constructed with some Frame Pages which
> > means
> > users would NOT get browser url changing when they click links or submit
> > forms in the page. so the origin jsessionid set by tomcat like we
> mentioned
> > above remains forever.What's the worse, users would get into others
> account
> > if they could receive the url existing in the browser address bar by some
> > way. That's terrible for my system.
> >
> > BTW, I'm using mod_proxy of Lighttpd to proxy the dynamic request to
> > the back end Tomcat server which does NOT have any load balance setting
> or
> > other cluster usage.
> >
> > I've tried several methods which turn out to be useless
> > 1) find out some configuration settings which may force the tomcat use
> > cookie rather than both set the cookie and rewrite the url at the first
> > time.
> > 2) mount another page as a proxy connecting with my loginx page and Home
> > page, use setResponsePage at its constructor method.
> >
> > So my question is : how could I avoid appending jsessionid parameters in
> > the
> > url permanently even at the first time people visit my site?
> >
> > Thanks in advance. Appreciate if any advices.
> >
>

Re: how to remove jsessionid parameters in the url at the first time ppl visit the site?

Posted by Johan Compagner <jc...@gmail.com>.
create your own BufferedWebResponse
and overwrite this method:

public CharSequence encodeURL(CharSequence url)

and do nothing, just return the url

johan


On Tue, Jan 6, 2009 at 18:14, Quan Zhou <be...@gmail.com> wrote:

> Firstly, i should say i have already read about those past threads which
> are
> concerned with the jsessionid appending in url problem. My experiment
> proved
> the conclusion: the first time people visit the site, the application
> server
> (tomcat) would append the jsessionid into the url no matter whether
> your browser has enabled cookie.  then if you continue clicking other links
> on the page ,or if you close the windows in your Firefox and reopen it
> again, the jsessionid parameters would disappear because the cookie has
> been
> set.
> Now here is my scenario. My program should be integrated with other forums
> or portal sites. Those sites send their account profiles to my server by
> HTTP request with encrypted parameters.(but not HTTPS). Meanwhile, my
> program mount a url (like loginx) for such requests which does
> some authentication and throws new RestartResponseAtInterceptPageException
> to  Home page if success.
> Unfortunately, my Home page is constructed with some Frame Pages which
> means
> users would NOT get browser url changing when they click links or submit
> forms in the page. so the origin jsessionid set by tomcat like we mentioned
> above remains forever.What's the worse, users would get into others account
> if they could receive the url existing in the browser address bar by some
> way. That's terrible for my system.
>
> BTW, I'm using mod_proxy of Lighttpd to proxy the dynamic request to
> the back end Tomcat server which does NOT have any load balance setting or
> other cluster usage.
>
> I've tried several methods which turn out to be useless
> 1) find out some configuration settings which may force the tomcat use
> cookie rather than both set the cookie and rewrite the url at the first
> time.
> 2) mount another page as a proxy connecting with my loginx page and Home
> page, use setResponsePage at its constructor method.
>
> So my question is : how could I avoid appending jsessionid parameters in
> the
> url permanently even at the first time people visit my site?
>
> Thanks in advance. Appreciate if any advices.
>