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:[email protected]]
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 <[email protected]>:
> 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: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]