[ 
http://www.stripesframework.org/jira/browse/STS-678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11985#action_11985
 ] 

Nikolaos commented on STS-678:
------------------------------

The nice thing about 1.5.4 Snapshot is that it has a fix to 
DynamicMappingFilter for this issue.  The problem unfortunately is that 1.5.4 
Snapshot at this "current" time has serious issues when using nested Stripes 
Layout.  So what I ended up doing is creating my own 1.5.3.1 Snapshot (for my 
purposes) that essentially is 1.5.3 w/ the changes to DynamicMappingFilter in 
1.5.4.

If anyone is interested in this jar please let me know and I'll post it and its 
POM somewhere for people to download.  Again this is not official... and 
includes no warranty of any kind... just a convenience for anyone that has this 
issue and wants to use 1.5.3.

BTW the other interesting thing w/ the new DynamicMappingFilter code is that it 
now allows for StripesFilter to not be explicitly defined in web.xml and the 
init-params essentially move from being in the StripesFilter definition to the 
DynamicMappingFilter definition.  See below.  BTW keeping things the old way 
works as well as under the covers a StripesFilter is instantiated.

ASIDE:  In my quick testing it didn't appear that the trunk (1.6.x) had this 
fix but I could have been mistaken (though it is marked fixed for 1.6 in this 
ticket).

<!--  
        Don't need to explicitly define a StripesFilter anymore if you want to 
use DynamicMappingFilter in 1.5.4 Snapshot 
        <filter>
                <filter-name>StripesFilter</filter-name>
                
<filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
        </filter>
-->
        <filter>
                <filter-name>DynamicMappingFilter</filter-name>
                
<filter-class>net.sourceforge.stripes.controller.DynamicMappingFilter</filter-class>
                <init-param>
                        <param-name>ActionResolver.Packages</param-name>
                        <param-value>org.test.ui.web.action</param-value><!-- 
Automatically scans all sub-packages as well -->
                </init-param>
                <init-param>
                        <param-name>Interceptor.Classes</param-name>
                        
<param-value>net.sourceforge.stripes.integration.spring.SpringInterceptor</param-value>
                </init-param>
                <init-param>
                        <param-name>Extension.Packages</param-name>
                        <param-value>
                                org.test.ui.stripes.extensions,
                                org.test.ui.stripes.reload.extension,
                                org.stripesstuff.stripersist,
                                net.sourceforge.stripes.integration.spring
                        </param-value>
                </init-param>
        </filter>
            
        <filter-mapping>
                <filter-name>DynamicMappingFilter</filter-name>
                <url-pattern>/*</url-pattern>
                <dispatcher>REQUEST</dispatcher>
                <dispatcher>FORWARD</dispatcher>
                <dispatcher>INCLUDE</dispatcher>
        </filter-mapping>

> DynamicMappingFilter fails with "Could not get a reference to StripesFilter" 
> on WAS 6.1
> ---------------------------------------------------------------------------------------
>
>                 Key: STS-678
>                 URL: http://www.stripesframework.org/jira/browse/STS-678
>             Project: Stripes
>          Issue Type: Bug
>          Components: ActionBean Dispatching
>    Affects Versions: Release 1.5.1
>         Environment: WebSphere Application Server 6.1.0.0, JDK 1.5, Servlet 
> 2.4
>            Reporter: Jan Novotný
>            Assignee: Ben Gunter
>             Fix For: Release 1.5.4, Release 1.6
>
>
> DynamicMappingFilter fails with message:
> Could not get a reference to StripesFilter from the servlet context. The 
> dynamic mapping filter works in conjunction with StripesFilter and requires 
> that it be defined in web.xml
> even though StripesFilter is defined in web.xml.
> Problem lies in following statement in JavaDoc documentation of the filter:
>  * {...@link StripesFilter} and {...@link DispatcherServlet} need not be 
> mapped to any URL patterns in
>  * {...@code web.xml} since this filter will determine at runtime whether or 
> not they need to be
>  * invoked.
> This is like I have had it:
>     <filter>
>         <display-name>Stripes Filter</display-name>
>         <filter-name>StripesFilter</filter-name>
>         
> <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
>         ... proper init params
>     </filter>
>     <filter>
>         <filter-name>DynamicMappingFilter</filter-name>
>         
> <filter-class>net.sourceforge.stripes.controller.DynamicMappingFilter</filter-class>
>     </filter>
>     <filter-mapping>
>         <filter-name>DynamicMappingFilter</filter-name>
>         <url-pattern>/*</url-pattern>
>         <dispatcher>REQUEST</dispatcher>
>         <dispatcher>FORWARD</dispatcher>
>         <dispatcher>INCLUDE</dispatcher>
>     </filter-mapping>
> Which is correct according to documentation and works for example on Tomcat.
> Problem is that StripesFilter init method needs to be called - it writes a 
> specific attribute into the ServletContext that is expected by 
> DynamicMappingFilter (naturaly - because it means StripesFilter has been 
> initialized). But this method is not called on WAS while having this 
> configuration.
> I found out that WAS applies different lifecycle on the filters (I wonder 
> whether it doesn't violate the Servlet specification?). It doesn't call init 
> methods of filters and servlets on web application start, but delays it up to 
> the time when Filters are really needed (means if there is request to the url 
> the filter participates in). And when no filter-mapping for the StripesFilter 
> is defined - it is never called although its definition is present in web.xml.
> Solution that works for me is simple - just adding filter mapping for Stripes 
> filter:
>     <filter-mapping>
>         <filter-name>DynamicMappingFilter</filter-name>
>         <url-pattern>/*</url-pattern>
>         <dispatcher>REQUEST</dispatcher>
>         <dispatcher>FORWARD</dispatcher>
>         <dispatcher>INCLUDE</dispatcher>
>     </filter-mapping>
>     <filter-mapping>
>         <filter-name>StripesFilter</filter-name>
>         <url-pattern>/*</url-pattern>
>         <dispatcher>REQUEST</dispatcher>        
>     </filter-mapping>
> And StripesFilter is initialized at last.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to