[ 
https://issues.apache.org/jira/browse/WICKET-2881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12870734#action_12870734
 ] 

Juergen Donnerstag commented on WICKET-2881:
--------------------------------------------

Hi Bernard,

RelativePathPrefixHandler implements WicketFilter and IComponentResolver, which 
indicates that it serves two purposes.
1) WicketFilter: for Wicket, markup consists of text and wicket relevant tags 
.Most of the different WicketFilters identify wicket relevant tags e.g. such as 
that have "wicket" namespace in either tag name or any of the attributes and 
add WicketTag and ComponentTag objects to the internal representation of the 
markup. Other WicketFilters e.g. identify HTML tags with missing close tags and 
virtually add the close tag to markup.
2) IComponentResolvers: when you design your application, you have to make sure 
that the markup matches your component hierarchy. Under the cover however 
Wicket automatically adds (usually transparent) components to manage internals. 
 IComponentResolver will help Wicket either to find the right component 
(transparent resolver) or to automatically create (transparent) components when 
needed.

Because RelativePathPrefixHandler serves 2 purposes, it gets registered as 
WicketFilter with the MarkupParser (see MarkupParser and MarkupParserFactory) 
and as IComponentFilter with the Application. 

There is no rules which states that each WicketFilter must have a corresponding 
IComponentResolver, which is why there are two separate lists. Most of these 
pairs are actually in separate classes, with RelativePathPrefixHandler being an 
exception.

>From what you've written I assume you want to replace the IComponentResolver 
>portion of RelativePathPrefixHandler  and not the WicketFilter part.

The IComponentResolver list is actually less dependent on the correct sequence 
of resolvers, so that it should be possible to remove existing one's and add 
new one's. Actually you don't need to remove existing ones if the new one comes 
before the old one in the list.

> Cannot substitute RelativePathPrefixHandler
> -------------------------------------------
>
>                 Key: WICKET-2881
>                 URL: https://issues.apache.org/jira/browse/WICKET-2881
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4.8
>         Environment: All
>            Reporter: bernard
>
> In IPageSettings
> Get the (modifiable) list of IComponentResolvers.
> List<IComponentResolver> getComponentResolvers();
> This looks very useful and easy indeed, and in Application.init() one can 
> find and remove
> RelativePathPrefixHandler and replace it with a different 
> AbstractMarkupFilter implementation e.g. XRelativePathPrefixHandler.
> But even while the List.remove(Object o) returns true, and the handler 
> appears to be removed, it is still active.
> I don't know why and what holds on to it or what creates a new 
> RelativePathPrefixHandler.
> If I add my XRelativePathPrefixHandler, it is not used.
> Consider
> public class MarkupParser
> public final void appendMarkupFilter(final IMarkupFilter filter)
> {
>     appendMarkupFilter(filter, RelativePathPrefixHandler.class);
> }
> So RelativePathPrefixHandler seems to be something special and I am afraid of 
> other potential complications in case replacement would work.
> Can Wicket be fixed to make a replacement as easy as it appears to be?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to