Ok, I found the problem. The form action is created like so: void beginRender(MarkupWriter writer) { Link link = resources.createFormEventLink(EventConstants.ACTION, context);
It then pulls the query parameters from the link and sticks them into hidden fields. The problem is that when you rewrite a url the first thing it does is converts the link toAbsoluteURI SimpleRequestWrapper fakeRequest = new SimpleRequestWrapper(request, link.toAbsoluteURI()); which drops the containing the page context (t:ac) because it's in the links parameters, and the link is for a form. >From LinkImpl: private String buildURI() { if (forForm || parameters == null) return absoluteURI; ... So, the form is built without the page context... Seems mildly suspicious that the link knows it's for a form. The javadoc says: "Query parameters are never added to a forForm link." But I'm not coming up with a good reason why... if the form want's to treat the query params special then shouldn't it strip them off? Josh On Sun, Jan 31, 2010 at 5:45 AM, Jan Jirout <jir...@coroptis.com> wrote: > Hi, > > This is really code that I'm running. I really hope that I'm not wrong about > that. Code that I posted shouldn't affected result of filter. I'm using > tapestry version 5.1.0.5. I added simple project demonstrating the problem. > > In attachment is example application demonstrating that SimpleRequestWrapper > in my case somehow change the request. > > Let me closely describe used use case. I have component Discussion, this > discussion is used at different king of pages. In object Discussion there > should be inject object implementing ActionRemote. When user submit new > comment is called ActionRemote.onAction(CommentForm form). Injecting of > concrete ActionRemote implementation is done in main page (User) during > executing onActivate phase. > > In attached example, there are two ways how to demonstrate problem: > * start application by "mvn jetty:run" and then access User page and > submit filled form. And you'll see exception saying that page context is > missing. > * try to run test case UserTest.testSubmitForm() and you'll see same > exception > > I hope, that attached example will works in yours environment. Please try to > look at my example, it's possible that I doing something wrong. > > Jan > > Josh Canfield wrote: >>> >>> I tried to use following code: >>> >>> public Request process(Request request, URLRewriteContext context) { >>> return new SimpleRequestWrapper(request, request.getPath()); >>> } >>> >>> When I use this code then context of component event is even lost. I >>> didn't >>> find way how to create SimpleRequestWrapper with component even context. >>> >> >> This is surprising. I hate to ask, but are you really sure this is the >> code that is running? What you have here should be the equivalent to >> doing nothing. What version of tapestry are you using? >> >> >> Josh >> >> On Sat, Jan 30, 2010 at 2:56 PM, Jan Jirout <jir...@coroptis.com> wrote: >> >>> >>> Hi, >>> >>> thanks for answer. >>> >>> In my real application I change just pieces of path but it didn't work. >>> >>> I tried to use following code: >>> >>> public Request process(Request request, URLRewriteContext context) { >>> return new SimpleRequestWrapper(request, request.getPath()); >>> } >>> >>> When I use this code then context of component event is even lost. I >>> didn't >>> find way how to create SimpleRequestWrapper with component even context. >>> >>> Just in case when I call "return request;" from "process" method is >>> component event context correctly passed. >>> >>> If you would like to see example application I can send it to conference. >>> >>> regards >>> >>> Jan >>> >>> >>> Thiago H. de Paula Figueiredo wrote: >>> >>>> >>>> On Sat, 30 Jan 2010 19:58:34 -0200, Jan Jirout <jir...@coroptis.com> >>>> wrote: >>>> >>>> >>>>> >>>>> Hi All, >>>>> >>>> >>>> Hi! >>>> >>>> >>>>> >>>>> I have strange problem with URL rewriting. I'm changing path name in >>>>> URLRewriterRule. In following way: >>>>> >>>>> public Request process(Request request, URLRewriteContext context) >>>>> { >>>>> return new SimpleRequestWrapper(request, "somePath"); >>>>> } >>>>> >>>> >>>> The above rule rewrites *all* URLs to "somePath", losing any context or >>>> query parameters. You should use string manipulation to extract the >>>> original >>>> page name and then replace it with the new page name. >>>> >>>> If a request to "/original/1 arrives", your should rewrite it to >>>> "/new/1". >>>> You can use path.replace("/original/", "/new/") to do that, for example. >>>> >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >>> >>> >> >> >> >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > -- -- http://www.bodylabgym.com - a private, by appointment only, one-on-one health and fitness facility. -- http://www.ectransition.com - Quality Electronic Cigarettes at a reasonable price! -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org