adding configuration.add("rule1",rule) at end of method fixes the problem, I follow the first example in the doc and it has no add("rule1", rule)(http://tapestry.apache.org/tapestry5.1/guide/url-rewriting.html)
it seems to me: /itemlist/123 can not be simply changed to /items/123 with following code: if (path.equals("/items")) { request = new SimpleRequestWrapper(request, "/itemlist"); } because the path is /items/123, this will work: if (path.equals("/items/123")) { request = new SimpleRequestWrapper(request, "/itemlist/123"); } but this hard coded the activation context, any idea with rewriting urls with context? what i mean here is the incoming request, thanks, Angelo Angelo Chen wrote: > > Hi, > > in a 5.1.0.5 app, i want to rewrite the url: > > http://127.0.0.1:8080/items/123 > > to > > http://127.0.0.1:8080/itemlist/123 > > what I did is, adding the following block to AppModule.java, but it is not > working, any idea why? > > Thanks, > > Angelo > > public static void > contributeURLRewriter(OrderedConfiguration<URLRewriterRule> configuration) > { > > System.out.println("contribute url rewriter"); // i can see > this line in the log > URLRewriterRule rule = new URLRewriterRule() { > > public Request process(Request request, URLRewriteContext > context) { > final String path = request.getPath(); > System.out.println("pathxx"); // i can not > see this in > the log > System.out.println(path); // i > can not see this in the > log > if (path.equals("/items")) { > request = new SimpleRequestWrapper(request, > "/itemlist"); > } > > return request; > > } > > public RewriteRuleApplicability applicability() { > return RewriteRuleApplicability.BOTH; > } > > }; > > } > > -- View this message in context: http://www.nabble.com/t5%3A-URLWriting%2C-is-this-correct--tp24884685p24884973.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org