Hi,
Some time back I posted details about the plugin I developed for our project, 
which allows you to specify uri template e.g. /{foo}/{bar} 
@UriTemplateMatchingRule(template="/{foo}/{bar}" method="execute") {public 
class MyAction{
  public String execute() {     //dowork    }
  public void setFoo(String foo) {     this.foo = foo;  }    public void 
setBar(String bar) {    this.bar = bar;  }}
It also supports completely custom matching rules
@CustomUriMatchingRule(class="<fully qualified matcher class name>" 
method="execute") {

Mather class looks like this
class MyCustomUrlMatcher implements UriMatcher {      public boolean 
matches(HttpServletRequest request) {              //your custom matching logic 
  }
   public Map<String, String> getParameters(HttpServletRequest request) {       
//Your custom parameter extractor   }
}

Custom matcher instances are created by struts ObjectFactory, so if you are 
using spring any of the spring beans can be injected in custom matchers making 
it extremely useful.
I think this can be an extremely useful plugin to struts community. For people 
who are using struts, can do similar things which frameworks like Jersey 
support (UriTemplate)This plugin can be used along with REST plugin and gives a 
lot of power to users in terms of different type of urls they can support.This 
is also very useful if you want to have SEO friendly Urls.
I want to know if struts is going to support anything like this in future 
releases? e.g. @Action annotation supporting uri templates?
Thanks,Unmesh

                                          
_________________________________________________________________
See the news as it happens on MSN videos
http://video.in.msn.com/

Reply via email to