Hi Thiago, The following approach does indeed work, but I'd like to
verify it to be the correct approach for handling
ComponentEventLinkTransformer. SimpleLink is basically the class you
wrote, I'm just not sure if I should be using simplelink with
transformComponentEventLink.  Also, is there a more efficient way of
doing this?

One last thing, I see a Mapper service is being used in the nabble
example below. What does that service do?

Thanks

a couple of example sites I used
https://mail.google.com/mail/u/0/#search/label%3Atapestry+url+rewrite/14a22796d35779f0
http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/URL-Rewriting-in-Tapestry-5-2-td2467342.html


    @Override
    public Link transformComponentEventLink(Link defaultLink,
ComponentEventRequestParameters contextPathEncoder) {
        String basePath = defaultLink.getBasePath();
        if (basePath.contains("/checkbox")) {
            return SimpleLink(basePath.replace("checkbox", "testpage"));
        }
        return null;
    }

    @Override
    public ComponentEventRequestParameters
decodeComponentEventRequest(Request request) {
        final String path = request.getPath();

        if (path.startsWith("/testpage")) {
            return encoder.decodeComponentEventRequest(
                    new DelegatingRequest(request) {
                @Override
                public String getPath() {
                    return path.replace("/testpage", "/checkbox");
                }
            });
        }
        return null;
    }

On Sun, Dec 7, 2014 at 8:35 PM, George Christman
<gchrist...@cardaddy.com> wrote:
> Okay great, thanks Thiago.
>
> On Sun, Dec 7, 2014 at 7:30 AM, Thiago H de Paula Figueiredo
> <thiag...@gmail.com> wrote:
>>
>> On Sat, 06 Dec 2014 23:59:50 -0200, George Christman
>> <gchrist...@cardaddy.com> wrote:
>>
>>> Hi, I'm doing some URL rewriting and I just discovered a new issue. I
>>> have the following page rewritten to a new URL.
>>> "/sell/buildlisting/sell-car"
>>> with "sell-car" being the context param and I'm rewriting the URL to
>>> "/sell-car". When a form.error occures and the page reloads, it returns
>>> "sell/buildlisting.form". How do I get the page to return
>>> "/sell-car.form"?
>>
>>
>> For almost every incoming URL rewrite, you should write an outgoing
>> (Tapestry-generated) URL rewrite too, otherwise the non-rewritten URLs still
>> appear, as exemplified by your case described above. Specifically, you'll
>> need to write a ComponentEventLinkTransformer too (form submission URLs in
>> Tapestry are considered event links).
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Tapestry, Java and Hibernate consultant and developer
>> http://machina.com.br
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>
>
>
> --
> George Christman
> CEO
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>



-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to