WicketServlet deprecation and WicketFilter
------------------------------------------

                 Key: WICKET-245
                 URL: https://issues.apache.org/jira/browse/WICKET-245
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3, 2.0
            Reporter: Edward Yakop
             Fix For: 1.3, 2.0


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>

Reply from Johan Compagner ([EMAIL PROTECTED])
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

-- 
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