You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by gu...@cox.net on 2007/08/20 23:30:26 UTC

Redirected after BrowserInfoPage and mounted Pages.

Short description :-
When using mounted pages, wicket redirects to wrong URL, after BrowserInfoPage, which
is called by Session.get().getClientInfo(), when gatherExtendedBrowserInfo is true in
RequestCycleSettings.

Long description :-

I need to determine the Client's time zone in my webapplication.
So I have set getRequestCycleSettings().setGaterExtendedBroserInfo(true) in my application class.

And in my BasePage.java's (which is the super class for all my pages) constructor 
I have set getSession().getClientInfo(), to trigger the redirect to BrowserInfoPage as per the javadocs.

My webapp context is /scheduler/ and my wicket application is mapped to /app/ (i.e. /scheduler/app/ ).
I have kept all my pages in one package and mounted that package to "/pages", ie.
the pages are accessed via http://host/scheduler/app/pages/XYZPage etc.

When I submit the request to
http://host/scheduler/app/

This is what happens (I have recorded the HTTP traffic via wireshark).
GET http://host/scheduler/app/
Temporary Redirect to http://host/scheduler/app/pages/HomePage (this is my home page).
GET http://host/scheduler/app/pages/HomePage
Temporary Redirect to http://host/scheduler/app/pages/../;jsessionID=...... (this is the BrowserInfo Page).
GET http://host/scheduler/app/;JSESSIONID=.....  (get the browser info page).
POST to browser info page.
Temporary redirect to http://host/scheduler/app/pages/../../app/pages/HomePage (redirect from browser info page, after it has populated ClientProperties).


The problem is that last redirect is wrong. 
The path http://host/scheduler/app/pages/../../app/pages/HomePage 
translates to http://host/app/pages/HomePage

i.e. I lose the webapp context path (/scheduler/) because of the path being 2 levels up.
and I get a 404 after that.

I suspect the culprit is the 
throw new RestartResponseAtInterceptPageException(new BrowserInfoPage(getRequest().getRelativePathPrefixToContextRoot() + getRequest().getURL()));


In WebRequestCycle.java.

The getRelativePathPrefixToContextRoot() is computed wrongly 
as /scheduler/app/../.. instead of /scheduler/app/.. because the context root is /scheduler/ and not "/"

Any thoughts on how to fix this ?

thanks
bhaskar


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


Re: Redirected after BrowserInfoPage and mounted Pages.

Posted by Eelco Hillenius <ee...@gmail.com>.
This was a bug. See WICKET-896. Thanks for reporting, it is fixed now.

Eelco

On 8/20/07, gumnaam@cox.net <gu...@cox.net> wrote:
> Short description :-
> When using mounted pages, wicket redirects to wrong URL, after BrowserInfoPage, which
> is called by Session.get().getClientInfo(), when gatherExtendedBrowserInfo is true in
> RequestCycleSettings.
>
> Long description :-
>
> I need to determine the Client's time zone in my webapplication.
> So I have set getRequestCycleSettings().setGaterExtendedBroserInfo(true) in my application class.
>
> And in my BasePage.java's (which is the super class for all my pages) constructor
> I have set getSession().getClientInfo(), to trigger the redirect to BrowserInfoPage as per the javadocs.
>
> My webapp context is /scheduler/ and my wicket application is mapped to /app/ (i.e. /scheduler/app/ ).
> I have kept all my pages in one package and mounted that package to "/pages", ie.
> the pages are accessed via http://host/scheduler/app/pages/XYZPage etc.
>
> When I submit the request to
> http://host/scheduler/app/
>
> This is what happens (I have recorded the HTTP traffic via wireshark).
> GET http://host/scheduler/app/
> Temporary Redirect to http://host/scheduler/app/pages/HomePage (this is my home page).
> GET http://host/scheduler/app/pages/HomePage
> Temporary Redirect to http://host/scheduler/app/pages/../;jsessionID=...... (this is the BrowserInfo Page).
> GET http://host/scheduler/app/;JSESSIONID=.....  (get the browser info page).
> POST to browser info page.
> Temporary redirect to http://host/scheduler/app/pages/../../app/pages/HomePage (redirect from browser info page, after it has populated ClientProperties).
>
>
> The problem is that last redirect is wrong.
> The path http://host/scheduler/app/pages/../../app/pages/HomePage
> translates to http://host/app/pages/HomePage
>
> i.e. I lose the webapp context path (/scheduler/) because of the path being 2 levels up.
> and I get a 404 after that.
>
> I suspect the culprit is the
> throw new RestartResponseAtInterceptPageException(new BrowserInfoPage(getRequest().getRelativePathPrefixToContextRoot() + getRequest().getURL()));
>
>
> In WebRequestCycle.java.
>
> The getRelativePathPrefixToContextRoot() is computed wrongly
> as /scheduler/app/../.. instead of /scheduler/app/.. because the context root is /scheduler/ and not "/"
>
> Any thoughts on how to fix this ?
>
> thanks
> bhaskar
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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