You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marc Logemann <li...@logemann.org> on 2009/04/03 11:54:24 UTC
S2: latest Struts 2.1.x and latest CXF dont play nice together
Hi,
i have the following web.xml:
<filter>
<filter-name>struts2</filter-name>
<filter-
class
>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</
filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
No as you can see, i want all URLs resolved by Struts2 but /services/
should be handled by CXF. This worked with Struts 2.0.x and CXF but
with latest Struts2, the Filter seems to be changed. Apart from the
fact that i know use StrutsPrepareAndExecuteFilter instead of
FilterDispatchter (using FilterDispatcher makes no difference
regarding my problem), it seems that Struts2 now treats every URL as
it should be processed by the framework, even without mapping and
namespaces for it.
The ciritical point is the following code in the Struts filter:
ActionMapping mapping = prepare.findActionMapping(request, response);
if (mapping == null) {
boolean handled =
execute.executeStaticResourceRequest(request, response);
if (!handled) {
chain.doFilter(request, response);
}
}
If it wouldnt find a mapping (in fact there is no mapping but the
object is nevertheless != null) i think it would work because
executeStaticResourceRequest() would return false and the normal
processing chain of the Request would occur.
I cant change the struts2 url filter mapping beause that would break
so much code of my existing app that i would rather modify the Filter
not to handle "/service" urls. Again all this is because of a very
poor web.xml (servlet) spec with regard to simple url-pattern without
the chance to exclude something....
Any hints ??
---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: S2: latest Struts 2.1.x and latest CXF dont play nice together
Posted by cheeran <sa...@omgeo.com>.
Hey Man, you are a life saver. thanks for taking time to reply! Such a simple
fix and I was going blue!
loge1974 wrote:
>
> Ahh here we go. Just read the struts 2.0 -> 2.1 migration guide and
> saw this:
>
> "The default action extension list (struts.action.extension) has
> changed from just 'action' to 'action' plus "" (no extension). If your
> application has servlets or other requests that have no extension then
> they will be mistaken as actions and you will get a "There is no
> Action mapped for ..." exception like below."
>
> This explains the difference with regard to handling the mentioned
> URIs. So i can just do that:
>
> <constant name="struts.action.extension" value="action" />
>
> to get the old "2.0.x" bevaior. Unfortunately i created a custom
> ActionMapper the wont handle /services/* URIs. Hmmm. Lets see what i
> do now :)
>
> ---
> regards
> Marc Logemann
> http://www.logemann.org
> http://www.logentis.de
>
>
>
>
> Am 03.04.2009 um 11:54 schrieb Marc Logemann:
>
>> Hi,
>>
>> i have the following web.xml:
>>
>> <filter>
>> <filter-name>struts2</filter-name>
>> <filter-
>> class
>> >
>> org
>> .apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</
>> filter-class>
>> </filter>
>>
>> <filter-mapping>
>> <filter-name>struts2</filter-name>
>> <url-pattern>/*</url-pattern>
>> </filter-mapping>
>>
>> <servlet>
>> <servlet-name>CXFServlet</servlet-name>
>> <servlet-class>
>> org.apache.cxf.transport.servlet.CXFServlet
>> </servlet-class>
>> <load-on-startup>1</load-on-startup>
>> </servlet>
>>
>> <servlet-mapping>
>> <servlet-name>CXFServlet</servlet-name>
>> <url-pattern>/services/*</url-pattern>
>> </servlet-mapping>
>>
>>
>> No as you can see, i want all URLs resolved by Struts2 but /
>> services/ should be handled by CXF. This worked with Struts 2.0.x
>> and CXF but with latest Struts2, the Filter seems to be changed.
>> Apart from the fact that i know use StrutsPrepareAndExecuteFilter
>> instead of FilterDispatchter (using FilterDispatcher makes no
>> difference regarding my problem), it seems that Struts2 now treats
>> every URL as it should be processed by the framework, even without
>> mapping and namespaces for it.
>>
>> The ciritical point is the following code in the Struts filter:
>>
>> ActionMapping mapping = prepare.findActionMapping(request, response);
>> if (mapping == null) {
>> boolean handled =
>> execute.executeStaticResourceRequest(request, response);
>> if (!handled) {
>> chain.doFilter(request, response);
>> }
>> }
>>
>>
>> If it wouldnt find a mapping (in fact there is no mapping but the
>> object is nevertheless != null) i think it would work because
>> executeStaticResourceRequest() would return false and the normal
>> processing chain of the Request would occur.
>>
>>
>> I cant change the struts2 url filter mapping beause that would break
>> so much code of my existing app that i would rather modify the
>> Filter not to handle "/service" urls. Again all this is because of a
>> very poor web.xml (servlet) spec with regard to simple url-pattern
>> without the chance to exclude something....
>>
>> Any hints ??
>>
>>
>> ---
>> regards
>> Marc Logemann
>> http://www.logemann.org
>> http://www.logentis.de
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
--
View this message in context: http://www.nabble.com/S2%3A-latest-Struts-2.1.x-and-latest-CXF-dont-play-nice-together-tp22865405p22952450.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
Re: S2: latest Struts 2.1.x and latest CXF dont play nice together
Posted by Marc Logemann <li...@logemann.org>.
Ahh here we go. Just read the struts 2.0 -> 2.1 migration guide and
saw this:
"The default action extension list (struts.action.extension) has
changed from just 'action' to 'action' plus "" (no extension). If your
application has servlets or other requests that have no extension then
they will be mistaken as actions and you will get a "There is no
Action mapped for ..." exception like below."
This explains the difference with regard to handling the mentioned
URIs. So i can just do that:
<constant name="struts.action.extension" value="action" />
to get the old "2.0.x" bevaior. Unfortunately i created a custom
ActionMapper the wont handle /services/* URIs. Hmmm. Lets see what i
do now :)
---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de
Am 03.04.2009 um 11:54 schrieb Marc Logemann:
> Hi,
>
> i have the following web.xml:
>
> <filter>
> <filter-name>struts2</filter-name>
> <filter-
> class
> >
> org
> .apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</
> filter-class>
> </filter>
>
> <filter-mapping>
> <filter-name>struts2</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
>
> <servlet>
> <servlet-name>CXFServlet</servlet-name>
> <servlet-class>
> org.apache.cxf.transport.servlet.CXFServlet
> </servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>CXFServlet</servlet-name>
> <url-pattern>/services/*</url-pattern>
> </servlet-mapping>
>
>
> No as you can see, i want all URLs resolved by Struts2 but /
> services/ should be handled by CXF. This worked with Struts 2.0.x
> and CXF but with latest Struts2, the Filter seems to be changed.
> Apart from the fact that i know use StrutsPrepareAndExecuteFilter
> instead of FilterDispatchter (using FilterDispatcher makes no
> difference regarding my problem), it seems that Struts2 now treats
> every URL as it should be processed by the framework, even without
> mapping and namespaces for it.
>
> The ciritical point is the following code in the Struts filter:
>
> ActionMapping mapping = prepare.findActionMapping(request, response);
> if (mapping == null) {
> boolean handled =
> execute.executeStaticResourceRequest(request, response);
> if (!handled) {
> chain.doFilter(request, response);
> }
> }
>
>
> If it wouldnt find a mapping (in fact there is no mapping but the
> object is nevertheless != null) i think it would work because
> executeStaticResourceRequest() would return false and the normal
> processing chain of the Request would occur.
>
>
> I cant change the struts2 url filter mapping beause that would break
> so much code of my existing app that i would rather modify the
> Filter not to handle "/service" urls. Again all this is because of a
> very poor web.xml (servlet) spec with regard to simple url-pattern
> without the chance to exclude something....
>
> Any hints ??
>
>
> ---
> regards
> Marc Logemann
> http://www.logemann.org
> http://www.logentis.de
>
>
>
>
>
> ---------------------------------------------------------------------
> 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