I'm doing these kind of arbitrary rewrites with a custom RequestFilter, sounds like that would suit your needs. Here's an example:
public class YourRequestFilter implements RequestFilter { @Override public boolean service(Request request, Response response, RequestHandler handler) throws IOException { String path = request.getPath(); final String newPath = ...; request = new DelegatingRequest(request) { @Override public String getPath() { return newPath; } }; return handler.service(request, response); } } and add it to the pipeline in your module: public void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration, ...) { configuration.add("YourRequestFilter", new YourRequestFilter() ...); } On Sat, 03 Dec 2011 05:32:12 +0100, angelochen <angelochen...@yahoo.com.hk> wrote:
Hi, I have following implementation in T5.2's URLrewrite: some entries in a property file: /newpage/123=/view/231 /newpage2/123=/view_more/xyz/abcd then in URLRewrite I can simply do this: public Request process(Request request, URLRewriteContext urlRewriteContext) { String path = request.getPath().toLowerCase(); String newPath = pathServices.getRewritePath(path); // this looks up from the property file containing rewrite entries if (newPath != null) { request = new SimpleRequestWrapper(request, newPath); } return request; } Now I'm trying to use LinkTransformer, it does not work as PageRenderRequestParameters requires a valid page name, not like "/view_more/xyz/abcd" which can be passed directly to SimpleRequestWrapper, any idea how to do something similar to the above? public PageRenderRequestParameters decodePageRenderRequest(Request request) { String newPath = pathServices.getRewritePath(path); if (newPath != null) { { return new PageRenderRequestParameters( newPath, new EmptyEventContext(), false); } } return null; }
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org