You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Steve Mactaggart <st...@whitesquaresoft.com> on 2011/03/17 13:17:29 UTC

Need a CodingStrategy to parse parameter from prefix

Hi guys,

I am porting an existing application over to wicket, and while most of it is
plain sailing I have an issue where I need to be able to specify a set of
pages to have a common parameter supplied "before" the mount path.

An example of what I'm talking about would be:
http://localhost/person1/profile
http://localhost/person1/audit
http://localhost/person1/sessiondetails

Where the 3 pages, profile, audit and session details all have a common
parameter the 'person1' parameter.
As you can guess there are any number of potential values for the first
parameter.

I have started down the path of creating my
own IRequestTargetUrlCodingStrategy which I think I will be able to parse
out any prefix to the mountpath and pass it in as a parameter, but my
problem is that my strategy never gets resolved, due to the
WebRequestCodingStrategy$MountsMap checking if the path "startsWith" my
mount key.

Is there a way I can replace the entire WebRequestCodingStrategy to supply
my own?

I'm sure I'm missing something obvious here.

Cheers,
Steve

Re: Need a CodingStrategy to parse parameter from prefix

Posted by Bas Gooren <ba...@iswd.nl>.
Yes it is, e.g. have a look at 
https://cwiki.apache.org/WICKET/wicket-and-localized-urls.html

In your case, you would need to strip the first path parameter from the 
url and store it in the request for later retrieval.

Bas

Op 17-3-2011 23:58, Steve Mactaggart schreef:
> I guess I'll have a look at 1.5 then.  Is it at all possible with 1.4?
>
> On Thu, Mar 17, 2011 at 11:58 PM, Martin Grigorov<mg...@apache.org>wrote:
>
>> If you can use Wicket 1.5 (RC2) then I suggest you to take a look at
>>
>> http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/LocaleFirstMapper.java?view=markup
>>
>> <
>> http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/LocaleFirstMapper.java?view=markup
>>> It
>> is much more simpler in 1.5.
>>
>> On Thu, Mar 17, 2011 at 1:17 PM, Steve Mactaggart<
>> steve@whitesquaresoft.com
>>> wrote:
>>> Hi guys,
>>>
>>> I am porting an existing application over to wicket, and while most of it
>>> is
>>> plain sailing I have an issue where I need to be able to specify a set of
>>> pages to have a common parameter supplied "before" the mount path.
>>>
>>> An example of what I'm talking about would be:
>>> http://localhost/person1/profile
>>> http://localhost/person1/audit
>>> http://localhost/person1/sessiondetails
>>>
>>> Where the 3 pages, profile, audit and session details all have a common
>>> parameter the 'person1' parameter.
>>> As you can guess there are any number of potential values for the first
>>> parameter.
>>>
>>> I have started down the path of creating my
>>> own IRequestTargetUrlCodingStrategy which I think I will be able to parse
>>> out any prefix to the mountpath and pass it in as a parameter, but my
>>> problem is that my strategy never gets resolved, due to the
>>> WebRequestCodingStrategy$MountsMap checking if the path "startsWith" my
>>> mount key.
>>>
>>> Is there a way I can replace the entire WebRequestCodingStrategy to
>> supply
>>> my own?
>>>
>>> I'm sure I'm missing something obvious here.
>>>
>>> Cheers,
>>> Steve
>>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com<http://jweekend.com/>
>>

Re: Need a CodingStrategy to parse parameter from prefix

Posted by Steve Mactaggart <st...@whitesquaresoft.com>.
I guess I'll have a look at 1.5 then.  Is it at all possible with 1.4?

On Thu, Mar 17, 2011 at 11:58 PM, Martin Grigorov <mg...@apache.org>wrote:

> If you can use Wicket 1.5 (RC2) then I suggest you to take a look at
>
> http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/LocaleFirstMapper.java?view=markup
>
> <
> http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/LocaleFirstMapper.java?view=markup
> >It
> is much more simpler in 1.5.
>
> On Thu, Mar 17, 2011 at 1:17 PM, Steve Mactaggart <
> steve@whitesquaresoft.com
> > wrote:
>
> > Hi guys,
> >
> > I am porting an existing application over to wicket, and while most of it
> > is
> > plain sailing I have an issue where I need to be able to specify a set of
> > pages to have a common parameter supplied "before" the mount path.
> >
> > An example of what I'm talking about would be:
> > http://localhost/person1/profile
> > http://localhost/person1/audit
> > http://localhost/person1/sessiondetails
> >
> > Where the 3 pages, profile, audit and session details all have a common
> > parameter the 'person1' parameter.
> > As you can guess there are any number of potential values for the first
> > parameter.
> >
> > I have started down the path of creating my
> > own IRequestTargetUrlCodingStrategy which I think I will be able to parse
> > out any prefix to the mountpath and pass it in as a parameter, but my
> > problem is that my strategy never gets resolved, due to the
> > WebRequestCodingStrategy$MountsMap checking if the path "startsWith" my
> > mount key.
> >
> > Is there a way I can replace the entire WebRequestCodingStrategy to
> supply
> > my own?
> >
> > I'm sure I'm missing something obvious here.
> >
> > Cheers,
> > Steve
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>

Re: Need a CodingStrategy to parse parameter from prefix

Posted by Martin Grigorov <mg...@apache.org>.
If you can use Wicket 1.5 (RC2) then I suggest you to take a look at
http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/LocaleFirstMapper.java?view=markup

<http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/LocaleFirstMapper.java?view=markup>It
is much more simpler in 1.5.

On Thu, Mar 17, 2011 at 1:17 PM, Steve Mactaggart <steve@whitesquaresoft.com
> wrote:

> Hi guys,
>
> I am porting an existing application over to wicket, and while most of it
> is
> plain sailing I have an issue where I need to be able to specify a set of
> pages to have a common parameter supplied "before" the mount path.
>
> An example of what I'm talking about would be:
> http://localhost/person1/profile
> http://localhost/person1/audit
> http://localhost/person1/sessiondetails
>
> Where the 3 pages, profile, audit and session details all have a common
> parameter the 'person1' parameter.
> As you can guess there are any number of potential values for the first
> parameter.
>
> I have started down the path of creating my
> own IRequestTargetUrlCodingStrategy which I think I will be able to parse
> out any prefix to the mountpath and pass it in as a parameter, but my
> problem is that my strategy never gets resolved, due to the
> WebRequestCodingStrategy$MountsMap checking if the path "startsWith" my
> mount key.
>
> Is there a way I can replace the entire WebRequestCodingStrategy to supply
> my own?
>
> I'm sure I'm missing something obvious here.
>
> Cheers,
> Steve
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>