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()
          {
             return MyWicketServlet.this.m_appFactory;
          }
       };
    }
}
</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>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to