Hi,

somehow your description doesn't make sense to me. You are rewriting the
incoming URLs like /<app>/page/123 to /<app>/page?id=123. Why actually? The
incoming request path is a valid page rendering URL. It requests Page with
activation context 123 to be rendered. Why do you want to transform the
activation context to a request parameter? No EventContext will help you
because a context is encoded into the URL like /page/123.

2010/9/8 Marek Stanisław Wawrzyczny <marek_wawrzyc...@internode.on.net>

> Hi,
>
> Yes, I'm working with incoming links. The code I have so far:
>
> public class PageLinkTransformer implements PageRenderLinkTransformer {
>
>        <...>
>
>        private static final Pattern REGEX_NODE_PATTERN =
> Pattern.compile("/page/(\\d++)");
>
>        <…>
>
>        public PageRenderRequestParameters decodePageRenderRequest(Request
> request) {
>                final String path = request.getPath();
>                Matcher matcher = REGEX_NODE_PATTERN.matcher(path);
>
>                if (matcher.find()) {
>                        String node = matcher.group(1);
>                        if (node != null) {
>                                // TODO: How to inject node number into the
> new page?
>                                PageRenderRequestParameters newRequest = new
> PageRenderRequestParameters(
>                                                "Page", new
> EmptyEventContext(), false);
>
>                                return newRequest;
>                        }
>                }
>                return null;
>        }
>
>        <…>
> }
>
> and the Page itself:
>
> public class Page {
>
>        <…>
>
>        @Property
>        @Component(id = "pageTemplate", parameters = { "node=currentNode"})
>        private PageTemplate pageTemplate;
>
>        <…>
> }
>
> On 08/09/2010, at 02:57, Igor Drobiazko wrote:
>
> > Hi,
> >
> > you need to provide some more details. Are you trying to rewrite incoming
> > URLs?
> >
> > 2010/9/7 Marek Stanisław Wawrzyczny <marek_wawrzyc...@internode.on.net>
> >
> >> Hi everyone,
> >>
> >> I hope you can help a Tapestry newbie here :)
> >>
> >> I've been following the blog post on how to use the new API (we're
> >> developing a new app in 5.2)
> >> http://blog.tapestry5.de/index.php/2010/09/06/new-url-rewriting-api/but
> >> for the life of me I can't figure out how to pass extracted URL
> parameters
> >> to the new page.
> >>
> >> So, say we have to rewrite /<app>/page/123 to /<app>/page?id=123, how do
> I
> >> pass the id:123 URL parameter to the EventContext without touching on
> any
> >> internal classes?
> >>
> >>
> >> Many thanks,
> >>
> >> Marek Wawrzyczny
> >
> >
> >
> >
> > --
> > Best regards,
> >
> > Igor Drobiazko
> > http://tapestry5.de
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Best regards,

Igor Drobiazko
http://tapestry5.de

Reply via email to