You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by John Patterson <jd...@gmail.com> on 2007/10/09 23:37:27 UTC

Subclassing WebRequestCodingStrategy

Hi,

I seem to be making progress with my custom URL scheme but have hit a  
small wall.  I have subclassed WebRequestCodingStrategy because I  
want to keep the mountable page behaviour but just enhance it to  
return my own target if no mounts are found and default processing  
does not apply.  I am trying to implement

IRequestTarget targetForRequest(RequestParameters)

... but I cannot find a way to return my own target.  Everything is  
final or private.  If this method

	public final IRequestTargetUrlCodingStrategy urlCodingStrategyForPath 
(String path)

was not final I could return my implementation.  Or if I could add a  
mount which returned null for getMountPath() then I would be sweet.

Cheers,

John

Re: Subclassing WebRequestCodingStrategy

Posted by John Patterson <jd...@gmail.com>.
That is a huge class with lots of internal knowledge!   It would be a  
nightmare to maintain and keep up to date with internal Wicket  
changes.  All for one final keyword.

The class seems to have been built with subclassing in mind but just  
this single final clause stops  me being able to use it.  There is  
only one wicket subclass Crypted... which does not use a custom path  
so hasn't tested this superclass fully.

On 9 Oct 2007, at 16:01, Matej Knopp wrote:

> Thinking about it, probably better (and more solid) approach would be
> for you to copy the entire class (unless it references some package
> protected classes).
>
> -Matej
>
> On 10/9/07, John Patterson <jd...@gmail.com> wrote:
>> Just a bit more info on the problem... encoding allows me to override
>> the equivalent method:
>>
>> rg.apache.wicket.IRequestTarget)
>>          */
>>         public final CharSequence pathForTarget(IRequestTarget  
>> requestTarget)
>>         {
>>                 // first check whether the target was mounted
>>                 IRequestTargetUrlCodingStrategy encoder =  
>> getMountEncoder
>> (requestTarget);
>>
>>
>> ... here getMountEncoder() is not final.
>>
>> Cheers,
>>
>> John
>>
>>
>> On 9 Oct 2007, at 15:37, John Patterson wrote:
>>
>>> Hi,
>>>
>>> I seem to be making progress with my custom URL scheme but have hit
>>> a small wall.  I have subclassed WebRequestCodingStrategy because I
>>> want to keep the mountable page behaviour but just enhance it to
>>> return my own target if no mounts are found and default processing
>>> does not apply.  I am trying to implement
>>>
>>> IRequestTarget targetForRequest(RequestParameters)
>>>
>>> ... but I cannot find a way to return my own target.  Everything is
>>> final or private.  If this method
>>>
>>>       public final IRequestTargetUrlCodingStrategy
>>> urlCodingStrategyForPath(String path)
>>>
>>> was not final I could return my implementation.  Or if I could add
>>> a mount which returned null for getMountPath() then I would be  
>>> sweet.
>>>
>>> Cheers,
>>>
>>> John
>>
>>
>
> ---------------------------------------------------------------------
> 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


Re: Subclassing WebRequestCodingStrategy

Posted by John Patterson <jd...@gmail.com>.
OK thanks, I have created https://issues.apache.org/jira/browse/ 
WICKET-1057

I think final is a great tool and if someone can point out a better  
way for me to do this please do.

Cheers,

John

On 9 Oct 2007, at 17:19, Matej Knopp wrote:

> Well, as kind of our policy we make a lot of things final. But we do
> remove the final if someone has a good reason for it. :)
>
> Could you please create a jira issue with the finals you need to  
> have removed?
>
> Thanks.
>
> -Matej
>
> On 10/10/07, John Patterson <jd...@gmail.com> wrote:
>> Also, there is special case code in WebRequestCodingStrategy for a
>> mount with a null path.  This looks like a default mount  and is what
>> I want to use.  But there is no way to add a mount with a null path
>> as it is checked for.
>>
>> This class is so close to being extendable but not quite there.
>>
>>
>> On 9 Oct 2007, at 16:01, Matej Knopp wrote:
>>
>>> Thinking about it, probably better (and more solid) approach  
>>> would be
>>> for you to copy the entire class (unless it references some package
>>> protected classes).
>>>
>>> -Matej
>>>
>>> On 10/9/07, John Patterson <jd...@gmail.com> wrote:
>>>> Just a bit more info on the problem... encoding allows me to  
>>>> override
>>>> the equivalent method:
>>>>
>>>> rg.apache.wicket.IRequestTarget)
>>>>          */
>>>>         public final CharSequence pathForTarget(IRequestTarget
>>>> requestTarget)
>>>>         {
>>>>                 // first check whether the target was mounted
>>>>                 IRequestTargetUrlCodingStrategy encoder =
>>>> getMountEncoder
>>>> (requestTarget);
>>>>
>>>>
>>>> ... here getMountEncoder() is not final.
>>>>
>>>> Cheers,
>>>>
>>>> John
>>>>
>>>>
>>>> On 9 Oct 2007, at 15:37, John Patterson wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I seem to be making progress with my custom URL scheme but have  
>>>>> hit
>>>>> a small wall.  I have subclassed WebRequestCodingStrategy  
>>>>> because I
>>>>> want to keep the mountable page behaviour but just enhance it to
>>>>> return my own target if no mounts are found and default processing
>>>>> does not apply.  I am trying to implement
>>>>>
>>>>> IRequestTarget targetForRequest(RequestParameters)
>>>>>
>>>>> ... but I cannot find a way to return my own target.   
>>>>> Everything is
>>>>> final or private.  If this method
>>>>>
>>>>>       public final IRequestTargetUrlCodingStrategy
>>>>> urlCodingStrategyForPath(String path)
>>>>>
>>>>> was not final I could return my implementation.  Or if I could add
>>>>> a mount which returned null for getMountPath() then I would be
>>>>> sweet.
>>>>>
>>>>> Cheers,
>>>>>
>>>>> John
>>>>
>>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> 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
>>
>>
>
> ---------------------------------------------------------------------
> 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


Re: Subclassing WebRequestCodingStrategy

Posted by Matej Knopp <ma...@gmail.com>.
Well, as kind of our policy we make a lot of things final. But we do
remove the final if someone has a good reason for it. :)

Could you please create a jira issue with the finals you need to have removed?

Thanks.

-Matej

On 10/10/07, John Patterson <jd...@gmail.com> wrote:
> Also, there is special case code in WebRequestCodingStrategy for a
> mount with a null path.  This looks like a default mount  and is what
> I want to use.  But there is no way to add a mount with a null path
> as it is checked for.
>
> This class is so close to being extendable but not quite there.
>
>
> On 9 Oct 2007, at 16:01, Matej Knopp wrote:
>
> > Thinking about it, probably better (and more solid) approach would be
> > for you to copy the entire class (unless it references some package
> > protected classes).
> >
> > -Matej
> >
> > On 10/9/07, John Patterson <jd...@gmail.com> wrote:
> >> Just a bit more info on the problem... encoding allows me to override
> >> the equivalent method:
> >>
> >> rg.apache.wicket.IRequestTarget)
> >>          */
> >>         public final CharSequence pathForTarget(IRequestTarget
> >> requestTarget)
> >>         {
> >>                 // first check whether the target was mounted
> >>                 IRequestTargetUrlCodingStrategy encoder =
> >> getMountEncoder
> >> (requestTarget);
> >>
> >>
> >> ... here getMountEncoder() is not final.
> >>
> >> Cheers,
> >>
> >> John
> >>
> >>
> >> On 9 Oct 2007, at 15:37, John Patterson wrote:
> >>
> >>> Hi,
> >>>
> >>> I seem to be making progress with my custom URL scheme but have hit
> >>> a small wall.  I have subclassed WebRequestCodingStrategy because I
> >>> want to keep the mountable page behaviour but just enhance it to
> >>> return my own target if no mounts are found and default processing
> >>> does not apply.  I am trying to implement
> >>>
> >>> IRequestTarget targetForRequest(RequestParameters)
> >>>
> >>> ... but I cannot find a way to return my own target.  Everything is
> >>> final or private.  If this method
> >>>
> >>>       public final IRequestTargetUrlCodingStrategy
> >>> urlCodingStrategyForPath(String path)
> >>>
> >>> was not final I could return my implementation.  Or if I could add
> >>> a mount which returned null for getMountPath() then I would be
> >>> sweet.
> >>>
> >>> Cheers,
> >>>
> >>> John
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > 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
>
>

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


Re: Subclassing WebRequestCodingStrategy

Posted by John Patterson <jd...@gmail.com>.
Also, there is special case code in WebRequestCodingStrategy for a  
mount with a null path.  This looks like a default mount  and is what  
I want to use.  But there is no way to add a mount with a null path  
as it is checked for.

This class is so close to being extendable but not quite there.


On 9 Oct 2007, at 16:01, Matej Knopp wrote:

> Thinking about it, probably better (and more solid) approach would be
> for you to copy the entire class (unless it references some package
> protected classes).
>
> -Matej
>
> On 10/9/07, John Patterson <jd...@gmail.com> wrote:
>> Just a bit more info on the problem... encoding allows me to override
>> the equivalent method:
>>
>> rg.apache.wicket.IRequestTarget)
>>          */
>>         public final CharSequence pathForTarget(IRequestTarget  
>> requestTarget)
>>         {
>>                 // first check whether the target was mounted
>>                 IRequestTargetUrlCodingStrategy encoder =  
>> getMountEncoder
>> (requestTarget);
>>
>>
>> ... here getMountEncoder() is not final.
>>
>> Cheers,
>>
>> John
>>
>>
>> On 9 Oct 2007, at 15:37, John Patterson wrote:
>>
>>> Hi,
>>>
>>> I seem to be making progress with my custom URL scheme but have hit
>>> a small wall.  I have subclassed WebRequestCodingStrategy because I
>>> want to keep the mountable page behaviour but just enhance it to
>>> return my own target if no mounts are found and default processing
>>> does not apply.  I am trying to implement
>>>
>>> IRequestTarget targetForRequest(RequestParameters)
>>>
>>> ... but I cannot find a way to return my own target.  Everything is
>>> final or private.  If this method
>>>
>>>       public final IRequestTargetUrlCodingStrategy
>>> urlCodingStrategyForPath(String path)
>>>
>>> was not final I could return my implementation.  Or if I could add
>>> a mount which returned null for getMountPath() then I would be  
>>> sweet.
>>>
>>> Cheers,
>>>
>>> John
>>
>>
>
> ---------------------------------------------------------------------
> 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


Re: Subclassing WebRequestCodingStrategy

Posted by Matej Knopp <ma...@gmail.com>.
Thinking about it, probably better (and more solid) approach would be
for you to copy the entire class (unless it references some package
protected classes).

-Matej

On 10/9/07, John Patterson <jd...@gmail.com> wrote:
> Just a bit more info on the problem... encoding allows me to override
> the equivalent method:
>
> rg.apache.wicket.IRequestTarget)
>          */
>         public final CharSequence pathForTarget(IRequestTarget requestTarget)
>         {
>                 // first check whether the target was mounted
>                 IRequestTargetUrlCodingStrategy encoder = getMountEncoder
> (requestTarget);
>
>
> ... here getMountEncoder() is not final.
>
> Cheers,
>
> John
>
>
> On 9 Oct 2007, at 15:37, John Patterson wrote:
>
> > Hi,
> >
> > I seem to be making progress with my custom URL scheme but have hit
> > a small wall.  I have subclassed WebRequestCodingStrategy because I
> > want to keep the mountable page behaviour but just enhance it to
> > return my own target if no mounts are found and default processing
> > does not apply.  I am trying to implement
> >
> > IRequestTarget targetForRequest(RequestParameters)
> >
> > ... but I cannot find a way to return my own target.  Everything is
> > final or private.  If this method
> >
> >       public final IRequestTargetUrlCodingStrategy
> > urlCodingStrategyForPath(String path)
> >
> > was not final I could return my implementation.  Or if I could add
> > a mount which returned null for getMountPath() then I would be sweet.
> >
> > Cheers,
> >
> > John
>
>

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


Re: Subclassing WebRequestCodingStrategy

Posted by John Patterson <jd...@gmail.com>.
Just a bit more info on the problem... encoding allows me to override  
the equivalent method:

rg.apache.wicket.IRequestTarget)
	 */
	public final CharSequence pathForTarget(IRequestTarget requestTarget)
	{
		// first check whether the target was mounted
		IRequestTargetUrlCodingStrategy encoder = getMountEncoder 
(requestTarget);


... here getMountEncoder() is not final.

Cheers,

John


On 9 Oct 2007, at 15:37, John Patterson wrote:

> Hi,
>
> I seem to be making progress with my custom URL scheme but have hit  
> a small wall.  I have subclassed WebRequestCodingStrategy because I  
> want to keep the mountable page behaviour but just enhance it to  
> return my own target if no mounts are found and default processing  
> does not apply.  I am trying to implement
>
> IRequestTarget targetForRequest(RequestParameters)
>
> ... but I cannot find a way to return my own target.  Everything is  
> final or private.  If this method
>
> 	public final IRequestTargetUrlCodingStrategy  
> urlCodingStrategyForPath(String path)
>
> was not final I could return my implementation.  Or if I could add  
> a mount which returned null for getMountPath() then I would be sweet.
>
> Cheers,
>
> John


Re: Subclassing WebRequestCodingStrategy

Posted by John Patterson <jd...@gmail.com>.
Even just urlCodingStrategyForPath would be enough I think.

On 9 Oct 2007, at 15:51, Matej Knopp wrote:

> I don't see why targetForRequest(RequestParameter) couldn't be
> non-final. Anyone objects?
>
> Matej
>
> On 10/9/07, John Patterson <jd...@gmail.com> wrote:
>> Hi,
>>
>> I seem to be making progress with my custom URL scheme but have hit a
>> small wall.  I have subclassed WebRequestCodingStrategy because I
>> want to keep the mountable page behaviour but just enhance it to
>> return my own target if no mounts are found and default processing
>> does not apply.  I am trying to implement
>>
>> IRequestTarget targetForRequest(RequestParameters)
>>
>> ... but I cannot find a way to return my own target.  Everything is
>> final or private.  If this method
>>
>>         public final IRequestTargetUrlCodingStrategy  
>> urlCodingStrategyForPath
>> (String path)
>>
>> was not final I could return my implementation.  Or if I could add a
>> mount which returned null for getMountPath() then I would be sweet.
>>
>> Cheers,
>>
>> John
>>
> urlCodingStrategyForPath
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


Re: Subclassing WebRequestCodingStrategy

Posted by John Patterson <jd...@gmail.com>.
Actually, urlCodingStrategyForPath would be preferable because that  
also must be overridden.  I have just done this locally and so far  
seems to be all I need.

On 9 Oct 2007, at 15:51, Matej Knopp wrote:

> I don't see why targetForRequest(RequestParameter) couldn't be
> non-final. Anyone objects?
>
> Matej
>
> On 10/9/07, John Patterson <jd...@gmail.com> wrote:
>> Hi,
>>
>> I seem to be making progress with my custom URL scheme but have hit a
>> small wall.  I have subclassed WebRequestCodingStrategy because I
>> want to keep the mountable page behaviour but just enhance it to
>> return my own target if no mounts are found and default processing
>> does not apply.  I am trying to implement
>>
>> IRequestTarget targetForRequest(RequestParameters)
>>
>> ... but I cannot find a way to return my own target.  Everything is
>> final or private.  If this method
>>
>>         public final IRequestTargetUrlCodingStrategy  
>> urlCodingStrategyForPath
>> (String path)
>>
>> was not final I could return my implementation.  Or if I could add a
>> mount which returned null for getMountPath() then I would be sweet.
>>
>> Cheers,
>>
>> John
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


Re: Subclassing WebRequestCodingStrategy

Posted by Matej Knopp <ma...@gmail.com>.
I don't see why targetForRequest(RequestParameter) couldn't be
non-final. Anyone objects?

Matej

On 10/9/07, John Patterson <jd...@gmail.com> wrote:
> Hi,
>
> I seem to be making progress with my custom URL scheme but have hit a
> small wall.  I have subclassed WebRequestCodingStrategy because I
> want to keep the mountable page behaviour but just enhance it to
> return my own target if no mounts are found and default processing
> does not apply.  I am trying to implement
>
> IRequestTarget targetForRequest(RequestParameters)
>
> ... but I cannot find a way to return my own target.  Everything is
> final or private.  If this method
>
>         public final IRequestTargetUrlCodingStrategy urlCodingStrategyForPath
> (String path)
>
> was not final I could return my implementation.  Or if I could add a
> mount which returned null for getMountPath() then I would be sweet.
>
> Cheers,
>
> John
>

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