struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phillips1021 <bphill...@ku.edu>
Subject Re: FilterDispatcher configuration in web.xml
Date Fri, 27 Nov 2009 17:44:56 GMT

When we use additional Filter classes in our Struts 2 applications, we have
to put the
additional filter and filter mapping nodes before the filter and filter
mapping nodes for the
Struts 2 filter.

For example:
<filter>
		<filter-name>OpenSSODevFilter</filter-name>
		<filter-class>
			edu.ku.itsd.opensso.filter.OpenSSODevFilter
		</filter-class> 
		<init-param>
			<param-name>reloadConfigURI</param-name>
			<param-value>/reload-headers.jsp</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>OpenSSODevFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	
	<filter>
	
	<!-- declare the Struts 2 filter -->
	<filter-name>struts2</filter-name>

		<filter-class>
		
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

		<init-param>
			<param-name>struts.devMode</param-name>
			<param-value>true</param-value>
		</init-param>

		<init-param>
			<param-name>struts.enable.DynamicMethodInvocation</param-name>
			<param-value>false</param-value>
		</init-param>

		<init-param>
			<param-name>struts.convention.classes.reload</param-name>
			<param-value>true</param-value>
		</init-param>

		<init-param>
			<param-name>struts.ognl.allowStaticMethodAccess</param-name>
			<param-value>true</param-value>
		</init-param>

		<init-param>
			<param-name>struts.ui.theme</param-name>
			<param-value>xhtml</param-value>
		</init-param>

		<init-param>
			<param-name>struts.custom.i18n.resources</param-name>
			<param-value>global-messages</param-value>
		</init-param>
	</filter>

<!-- restrict the Struts 2 filter to be called only when specific
URLs are called. -->
	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>*.action</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>/struts/*</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>*.jsp</url-pattern>
	</filter-mapping>

Also note the new Struts 2 filter class that is recommended for Struts 2.1.3
and later versions.

Bruce Phillips



Kishore Kumar-4 wrote:
> 
> Hi, 
> 
> Is there a way to change the FilterDispatcher URL Pattren other than /*? 
> I am using ICEFaces and struts2 togeather but due to struts2 URL Pattren
> ICEFaces requests are being ignored. 
> 
> Can i use url-pattren /*.action ? 
> 
> As per the struts documentation it says to use following 
> 
> <filter> 
>       <filter-name>struts2</filter-name> 
>      
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>

>     </filter> 
>     <filter-mapping> 
>       <filter-name>struts2</filter-name> 
>       <url-pattern>/*</url-pattern> 
>     </filter-mapping> 
> 
> 
> 
>  Thanks, 
> Kishore
> 
> 

-- 
View this message in context: http://old.nabble.com/FilterDispatcher-configuration-in-web.xml-tp26539480p26545350.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message