You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jim deVos <ja...@asu.edu> on 2014/11/12 07:42:19 UTC

How to predict wildcard mapping matching order when using Struts annotations

When struts encounters a URI that matches multiple wildcard mappings it
chooses the most recent match (ie. "the last one wins" ).  As a result,  I
should define less-specific patterns before the more specific  patterns.
This is simple enough when using XML-based config, but I'm not sure how it
works with an annotation-based config. Does struts process these mappings
in a consistent/predictable manner?

For example, I have two @Action's defined in separate classes (both use
wildcard mappings).  When struts services a request it appears to match the
less-specific pattern *last*.  Can I influence the ordering of these
definitions?   Unfortunately choosing different url patterns is not an
option available to us.

Many thanks,
Jim deVos

Re: How to predict wildcard mapping matching order when using Struts annotations

Posted by Lukasz Lenart <lu...@apache.org>.
2014-11-12 7:42 GMT+01:00 Jim deVos <ja...@asu.edu>:
> When struts encounters a URI that matches multiple wildcard mappings it
> chooses the most recent match (ie. "the last one wins" ).  As a result,  I
> should define less-specific patterns before the more specific  patterns.
> This is simple enough when using XML-based config, but I'm not sure how it
> works with an annotation-based config. Does struts process these mappings
> in a consistent/predictable manner?
>
> For example, I have two @Action's defined in separate classes (both use
> wildcard mappings).  When struts services a request it appears to match the
> less-specific pattern *last*.  Can I influence the ordering of these
> definitions?   Unfortunately choosing different url patterns is not an
> option available to us.

Can you post an example? As right now it isn't possible to define
order of matching patterns (at least I don't see any) and it can
depend on classpath scanning and class resolution. Maybe it would be
possible to tweak this process...


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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