struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jonathan.Le...@hhsc.state.tx.us>
Subject RE: Q: How do I combine struts 2 and another servlet in one application?
Date Fri, 17 Dec 2010 21:18:40 GMT
Thanks,

I just added the Filter interface to my servlet, put the my filter before the struts filter,
and now the servlet works like a champ.

You simply call the servlet service() method without forwarding to the next filter chain.

<code>
public void doFilter(ServletRequest servletrequest, ServletResponse servletresponse,
			FilterChain arg2) throws IOException, ServletException {
		this.service((HttpServletRequest)servletrequest, (HttpServletResponse)servletresponse);

	}

</code>

Thanks for your reply

Jonathan Lewis 
HHSC Enterprise Architecture
Enterprise Identity Management
(512) 438-2009

-----Original Message-----
From: Maurizio Cucchiara [mailto:maurizio.cucchiara@gmail.com] 
Sent: Friday, December 17, 2010 11:22 AM
To: Struts Users Mailing List
Subject: Re: Q: How do I combine struts 2 and another servlet in one application?

You could have different way:
1. You could change url pattern for struts filter as the following code:
<url-pattern>/struts2/*</url-pattern>
or simply
<url-pattern>*.action</url-pattern>

2. alternately you could write your custom filter, place its
filter-mapping before struts's one



2010/12/17  <Jonathan.Lewis@hhsc.state.tx.us>:
> Hi all,
>
> I am trying to incorporate a servlet into my struts 2 application. It seems that the
struts 2 filter fires before the servlet has a chance to execute, thereby causing the struts
engine to process the servlet url as a struts action. This of course results in a "no action
found for url /ITIMAuthenticatedServices" message.
>
> Is there a simple way of allowing my servlet to process my url /ITIMAuthenticatedServices
other than making my servlet implement the Filter interface?
>
> I have googled the heck out of this and have not found much on the subject. Struts 2
in Action (the book) shows that it can be done in one chapter, but never goes on to fully
implement the details...and 'surpise' the sample app that comes with the book omits the servlet
class talked about in the book. :-/
>
> Thanks
> -Jonathan
>
> <servlet>
>            <servlet-name>ITIMAuthenticatedServices</servlet-name>
>            <servlet-class>us.tx.state.hhsc.eim.eimconsole.servlets.ITIMAuthenticatedServices</servlet-class>
>            <load-on-startup>1</load-on-startup>
>      </servlet>
> <servlet-mapping>
>            <servlet-name>ITIMAuthenticatedServices</servlet-name>
>            <url-pattern>/ITIMAuthenticatedServices</url-pattern>
>      </servlet-mapping>
>   <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>
>
> Jonathan Lewis
> System Analyst V
> HHSC Enterprise Architecture
> Enterprise Identity Management
> (512) 438-2009
>
>



-- 
Maurizio Cucchiara

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


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


Mime
View raw message