In the former Wicket 2.0, adding a custom MarkupFilter could be done either
of 2 ways:
getMarkupSettings().setMarkupParserFactory(new
MarkupParserFactory(this) {
@Override
public MarkupParser newMarkupParser() {
MarkupParser parser = super.newMarkupParser();
// register the additional filter
parser.appendMarkupFilter(new MyFilter());
return parser;
}
});
With the new trunk, this does no longer work, since MarkupParserFactory now
returns its own innerclass implementation of MarkupParser:
public MarkupParser newMarkupParser()
{
final MarkupParser parser = new MarkupParser(new
XmlPullParser())
{
public void initFilterChain()
{
if (filters != null)
{
for (int i = 0; i < filters.length; i++)
{
appendMarkupFilter(filters[i]);
}
}
}
};
return parser;
}
Since it adds its own extra filters in the call to initFilterChain(), and
this filters attribute is private, there is no nice way to add any extra
filters. Also the method initMarkupFilters(final MarkupParser parser) has
disappeared.
Would it be possible to:
* either have a method initMarkupFilters(final MarkupParser parser) again,
that could be called from within the newMarkupParser() method of the factory
* or have a way to add extra filters to the 'filters' array of the factory
(with a simple addFilter())
Or did I miss something ? What would be the correct way to add a custom
filter ?
Jan.
--
View this message in context:
http://www.nabble.com/Backporting-from-2.0%3A-how-to-add-custom-MarkupFilters---tf3680307.html#a10285092
Sent from the Wicket - Dev mailing list archive at Nabble.com.