Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0 branch (discontinued), 1.3.0-beta1
-
None
Description
Hi,
I'm one of the maintainer of ops4j-pax-wicket. Atm, I'm trying to
migrate pax-wicket to wicket-2.0 that can be found at
(https://scm.ops4j.org/repos/ops4j/branches/pax/wicket-2.0).
One of the problem that I found during migration is the fact that
WicketFilter uses reflection to instantiate application factory by
using the FilterConfig.getInitParam( "applicationFactoryClassName" ).
Since this is not advisable in OSGi (Due to problem of ensuring
whoever export the wicket bundle must have it's classloader be able to
load the application factory) and HttpService does not support Filter.
It would be better if the old pattern of WicketServlet is supported.
<code>
public class WicketServlet
{
protected WicketFilter newWicketFilter()
{ return new WicketFilter(); } public void init()
{
wicketFilter = newWicketFilter();
filter.init(new FilterConfig()
);
}
}
</code>
This way, I would be able to override the instantiation of
WicketFilter without having to reimplement my FilterConfig.
For example, my wicket servlet will look like like:
<code>
final class MyWicketServlet extends WicketServlet
{
private final IWebApplicationFactory m_appFactory;
MyWicketServlet( IWebApplicationFactory factory )
{ m_appFactory = factory; } protected final WicketFilter newWicketFilter()
{
return new WicketFilter()
{
protected IWebApplicationFactory getApplicationFactory()
};
}
}
</code>
This way, reflection will not be used anymore in both instantiating
WebApplication (bypassing ContextParamWebApplicationFactory class) and
IWebApplicationFactory.
Regards,
Edward Yakop
Note:
Can we please remove the log.info part to mark WicketServlet is deprecated.
<code>
public WicketServlet()
{
// log warning
log.info("********************************************");
log.info("DEPRECATED! Please use WicketFilter instead.");
log.info("********************************************");
}
</code>
Reply from Johan Compagner (jcompagner@gmail.com)
We will remove the warnings about the deprication when we will release 1.3/2.0
for now we want to point people as much as possible to the wicket filter.
The wicket servlet will still be there.
So you just want a factory method in wicket servlet where you can make the wicket filter?
can you add a RFE for this:
https://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&mode=hide&pid=12310561&sorter/order=DESC&sorter/field=priority&resolution=-1&component=12311420
then i will add the factory method asap.
johan