Hi all,

I've been spending time with Struts 2.1.6, and the
NamedVariablePatternMatcher, and I've come across a potential issue. 

The issue comes into play when defining a class such as this :

@Namespace("/content/{year}/{month}")
public class ContentAction extends ActionSupport {

  private Integer year = null, month = null;
  private String article =  null;

  public void setYear(Integer y) { this.year = y; }
  public Integer getYear() { return this.year; }

  public void setMonth(Integer m) { this.month = m; }
  public Integer getMonth() { return this.month; }

  public void setArticle(String a) { this.article = a: }
  public String getArticle() { return this.article; }

  @Action(value = "{article}", results = { @Result(name="success", location
= "/WEB-INF/content/content.jsp" ) } , params = { "article", "{article}" } )
  public String execute() {
     // do some db stuff
     return SUCCESS;
  }

}

In this case, I'm trying to "wildcard" map all my content into a single
action, and be able to get the name of the content being matched.. 

Hence, 
http://webserver.com/myapp/content/2009/01/some-piece-of-content.action
should result in :

year - 2009
month - 1
article = some-piece-of-content
 
The problem it seems, is that while the NamespaceMatcher defers to the
NamedVariablePatternMatcher to parse out and map to parameters in the
Namespace configuration, the ActionConfigMatcher still believes it's using a
simple wildcard matcher, as it calls AbstractMatcher's convertParam, which
only checks for variable names of length ( i assume this is because it's
only looking for parameter names 1 through 9 )

I have a temporary hack where I replace AbstractMatcher with my own slightly
modified version which does it's replacement much like how
NamedVariablePatternMatcher does it ( like a simplistic state-machine )

I would open up a ticket on this but I wanted to understand if i was
possibly doing something wrong, or if I had missed another angle at it, or
better still, if there was already thinking and work done behind this.

Thanks in advance for any help you might be able to provide,

-a
-- 
View this message in context: 
http://www.nabble.com/-S2--Issue-with-NamedVariablePatternMatcher-and-ActionConfigMatcher--tp23930585p23930585.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to