You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris Colman <ch...@stepaheadsoftware.com> on 2010/05/31 04:34:32 UTC

BookmarkablePageLinks using relative vs absolute paths

Our web application uses wicket with an assortment of utility servlets
that we use to service requests with specific paths. In order to use
forwarding instead of redirecting we recently, as suggested on this
list, switched our wicket app filter to use the /* (root) context
instead of the the more specific context that we used to use eg.,
/wicketpages. This has enabled us to overcome many problems we were
having with our collection of wicket/raw servlets.

We now have another issue:

A servlet with a pattern, say /myservlet needs to do a forward to a path
whose response is produced by a wicket mounted BookmarkablePage, let's
say /wicketpages/home. This all works fine except when we click on a
BookmarkablePageLinkS created in that page (eg., /wicketpages/contact,
/wicketpages/aboutus etc).

Instead of the URL pointing to eg.,

/wicketpages/aboutus

it points to

/myservlet/wicketpages/aboutus

Which obviously fails because our wicket BookmarkablePages are mounted
at  paths like /wicketpages/aboutus not /myservlet/wicketpages/aboutus.

Is there a way to tell wicket that the context is something different to
what it is and so form a correct 'relative' URL? If I could fool wicket
into thinking that the context path is root "/" then that would work I
would think.

The problem is not limited to BookmarkablePageLinks - all AJAX
behaviours also fail as well when the /myservlet page is accessed but
work fine when the page is accessed via /wicketpages/home.

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


RE: BookmarkablePageLinks using relative vs absolute paths

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
What I meant was that the wicket filter is mapped to:

/*

But the associated servlets in the app all have their own, more specific
paths like

/myservlet etc.,

As the wicket filter now is a 'catch all' for all paths I had to extend
WicketFilter and override the doFilter method to bypass Wicket for the
paths that are specific to the servlets (eg., /myservlet)

However ..... I think I've solved my problem in another way:

For the particular servlet that I am having problems with I just decided
to implement it in wicket instead of a dedicated servlet: i.e. made a
Bookmarkable page for it and then to a redirect via
RestartRedirectException to the appropriate wicket home page. Seems to
be all working quite 'goodly' now :)



>-----Original Message-----
>From: Paul Szulc [mailto:paul.szulc@gmail.com]
>Sent: Monday, 31 May 2010 4:19 PM
>To: users@wicket.apache.org
>Subject: Re: BookmarkablePageLinks using relative vs absolute paths
>
>one think I dont understand. you said thhat you've changed the root to
/
>instead of /wicketpages, but later on you said that /myservlet should
>redirect to /wicketpages/about.
>
>On Mon, May 31, 2010 at 4:34 AM, Chris Colman
><ch...@stepaheadsoftware.com>wrote:
>
>> Our web application uses wicket with an assortment of utility
servlets
>> that we use to service requests with specific paths. In order to use
>> forwarding instead of redirecting we recently, as suggested on this
>> list, switched our wicket app filter to use the /* (root) context
>> instead of the the more specific context that we used to use eg.,
>> /wicketpages. This has enabled us to overcome many problems we were
>> having with our collection of wicket/raw servlets.
>>
>> We now have another issue:
>>
>> A servlet with a pattern, say /myservlet needs to do a forward to a
path
>> whose response is produced by a wicket mounted BookmarkablePage,
let's
>> say /wicketpages/home. This all works fine except when we click on a
>> BookmarkablePageLinkS created in that page (eg.,
/wicketpages/contact,
>> /wicketpages/aboutus etc).
>>
>> Instead of the URL pointing to eg.,
>>
>> /wicketpages/aboutus
>>
>> it points to
>>
>> /myservlet/wicketpages/aboutus
>>
>> Which obviously fails because our wicket BookmarkablePages are
mounted
>> at  paths like /wicketpages/aboutus not
/myservlet/wicketpages/aboutus.
>>
>> Is there a way to tell wicket that the context is something different
to
>> what it is and so form a correct 'relative' URL? If I could fool
wicket
>> into thinking that the context path is root "/" then that would work
I
>> would think.
>>
>> The problem is not limited to BookmarkablePageLinks - all AJAX
>> behaviours also fail as well when the /myservlet page is accessed but
>> work fine when the page is accessed via /wicketpages/home.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>--
>Best regards,
>Paul Szulc
>
>http://paulszulc.wordpress.com

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


Re: BookmarkablePageLinks using relative vs absolute paths

Posted by Paul Szulc <pa...@gmail.com>.
one think I dont understand. you said thhat you've changed the root to /
instead of /wicketpages, but later on you said that /myservlet should
redirect to /wicketpages/about.

On Mon, May 31, 2010 at 4:34 AM, Chris Colman
<ch...@stepaheadsoftware.com>wrote:

> Our web application uses wicket with an assortment of utility servlets
> that we use to service requests with specific paths. In order to use
> forwarding instead of redirecting we recently, as suggested on this
> list, switched our wicket app filter to use the /* (root) context
> instead of the the more specific context that we used to use eg.,
> /wicketpages. This has enabled us to overcome many problems we were
> having with our collection of wicket/raw servlets.
>
> We now have another issue:
>
> A servlet with a pattern, say /myservlet needs to do a forward to a path
> whose response is produced by a wicket mounted BookmarkablePage, let's
> say /wicketpages/home. This all works fine except when we click on a
> BookmarkablePageLinkS created in that page (eg., /wicketpages/contact,
> /wicketpages/aboutus etc).
>
> Instead of the URL pointing to eg.,
>
> /wicketpages/aboutus
>
> it points to
>
> /myservlet/wicketpages/aboutus
>
> Which obviously fails because our wicket BookmarkablePages are mounted
> at  paths like /wicketpages/aboutus not /myservlet/wicketpages/aboutus.
>
> Is there a way to tell wicket that the context is something different to
> what it is and so form a correct 'relative' URL? If I could fool wicket
> into thinking that the context path is root "/" then that would work I
> would think.
>
> The problem is not limited to BookmarkablePageLinks - all AJAX
> behaviours also fail as well when the /myservlet page is accessed but
> work fine when the page is accessed via /wicketpages/home.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Best regards,
Paul Szulc

http://paulszulc.wordpress.com