Hi Thiago, here I attach my code thanks for your time :)
> @org.apache.tapestry5.annotations.Log > public static void > contributeURLRewriter(OrderedConfiguration<URLRewriterRule> configuration) { > URLRewriterRule rule = new URLRewriterRule() { > > @Override > public Request process(Request request, URLRewriteContext > context) { > > String path = request.getPath(); > > if (path.startsWith("/error/")) > // here i try to replace the first part which starts > like /error/404 with /mylib/error/404 > String newPath = path.replaceFirst("\\/error\\/", > "/mylib/error/"); > request = new SimpleRequestWrapper(request, newPath); > } > > return request; > } > > @Override > public RewriteRuleApplicability applicability() { > return RewriteRuleApplicability.INBOUND; > } > }; > > configuration.add("errorPageRule", rule); > } > Nicolás.- On Mon, Oct 15, 2012 at 12:12 PM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > Hi! > > Please post your URL rewriting code. > > > On Mon, 15 Oct 2012 11:10:41 -0300, Nicolas Barrera <nbarr...@gmail.com> > wrote: > > Hello Tapestry users, >> >> I 'm using T5.1 in my project, so I 'm using the URLRewriter method of >> rewriting urls. >> >> I 'm trying to develop a page who will show error messages for different >> situations, (e.g. 404, 503,... and when spring-security detects that you >> have no privileges for a page). >> This page is in a custom tapestry library which has a virtual name called >> "mylib" so as the page name is Error it's path is: >> >> "/contextPath/mylib/error" >> >> but, I 'd like the user didn't see "mylib" in the path, so I thought that >> URLRewriter would help me!. >> >> >> I 've configured my web.xml like this: >> >> <error-page> >> <error-code>404</error-code> >> <location>/error/404</**location> >> </error-page> >> >> and spring-security to redirect to /contextPath/error/forbidden whenever >> the user has no privileges to view a page. >> >> The Error page takes 404 and forbidden as an extra in the onActivate >> method >> so it can decide which message to show. >> >> URLRewriting seems to be working for me because whenever I access for >> example /contextPath/error/forbidden the correct Error page is shown. >> >> >> Here 's the problem, >> this Error page uses the same Layout as every other page in the site, this >> Layout includes an icon/link menu. Those links are somehow transformed >> (actually I never wanted to modify them!) >> and as a result of this unwanted transformation they are pointing to a >> path >> that doesn't include the context path so the user is stuck on that page >> because the links to get out are malformed (they got no context path). >> >> Please I would appreciate your help on this one, >> perhaps I could just live with showing the "mylib" virtual name on the >> path >> but I would prefer not to. >> >> cheers and thanks in advance. >> >> >> >> Nicolás.- >> > > > -- > Thiago H. de Paula Figueiredo > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: > users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org> > For additional commands, e-mail: users-h...@tapestry.apache.org > >