tjg184 / urlrewritefilter

Automatically exported from code.google.com/p/urlrewritefilter
Other
0 stars 0 forks source link

RewriteRule extensions with <class-rule> does not call initialise method, looks for init instead #136

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a new class that extends RewriteRule
2. override the initialise(ServletContext) method
3. Add reference to class in urlrewrite.xml using <class-rule>
4. Run rules, the initialise method never gets run

The samples for class-rule seem to indicate overriding RewriteRule to create 
own rule, and RewriteRule's javadoc suggest initialise is the method to 
override to init your rule.

Debugging through initialisation, can see ClassRule is looking for a method 
named "init" instead of "initialise".

Is method name wrong? Or is documentation wrong?  To get this working, I need 
to rename my method init and remove the @Override annotation, which is counter 
intuitive and doesn't appear to be documented anywhere.

Original issue reported on code.google.com by nathan.m...@gmail.com on 3 Apr 2013 at 9:56

GoogleCodeExporter commented 9 years ago
Recently debugged the issue with Tuckey 4.0.3. Indeed, override of 
`RewriteRule#initialize(ServletContext)` seems to be completely useless. 
Furthermore, according to the documentation `init(ServletConfig)` "will be run 
at when creating [...] an instance" ([1], section <class-rule>). This is 
obviously wrong. Instead, as mention by @Nathan, the `init(ServletContext)` 
will be called (note the different attributes). 

Please fix the documentation.

[1] http://tuckey.org/urlrewrite/manual/4.0/index.html#configuration

Original comment by dmitri.w...@gmail.com on 25 Jun 2014 at 4:26