Hi Robert.
I solved this by using the UrlRewriteFilter:
http://tuckey.org/urlrewrite/

Since you don't need to generate the old urls anymore, a custom service encoder isn't really necessary and the UrlRewriteFilter will probably be sufficient.




You can even unit test the rewrite rules. :)
Something like this:

private static final String CONF_FILE = "src/main/webapp/WEB-INF/urlrewrite.xml";
        private MockResponse response;
        private UrlRewriter urlRewriter;

        public UrlRewriteTest()
                throws FileNotFoundException
        {
                response = new MockResponse();
                Conf conf = new Conf(new FileInputStream(CONF_FILE), null);
                conf.initialise();
                urlRewriter = new UrlRewriter(conf);
        }

        @Test(dataProvider = "rewrite")
        public void rewrite(String in, String expected)
        {
                MockRequest request = new MockRequest(in);
RewrittenUrl rewrittenRequest = urlRewriter.processRequest(request, response);

                assert (rewrittenRequest != null);
                assert (rewrittenRequest.isForward());
                assert (rewrittenRequest.getTarget().equals(expected));
        }

        @DataProvider(name = "rewrite")
        public Object[][] getRewriteData()
                throws IOException
        {
[loads parameters from *.properties file]
        }



Martin

On Tue, 19 Dec 2006 19:23:15 +0100, Robert J. Walker <[EMAIL PROTECTED]> wrote:

I'm upgrading our existing applications from Tapestry 3.1 to Tapestry 4.1. One problem we have is that we send emails to our users with links to an IExternalPage. The URL format for this has changed in Tapestry 4, so when we release, all the links in emails sent before the release will be broken.

I imagine that it must be possible to set up an URL encoder to translate the old URLs to the new ones. I also imagine that someone else out there must have already encountered this and written one, but I've been unable to find any such thing. I'd rather not re-invent the wheel if the solution already exists.

Robert J. Walker

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to