Hi All,

I need to map URLs from our old application to the new URLs in our 5.3 app.  
Yesterday I found this page:

http://blog.tapestry5.de/index.php/2010/09/06/new-url-rewriting-api/

Following that I wrote my first rewrite rule

/maintenance/agency_required_documents.htm?agencyId=86  to 
/company/AgencyRequiredDocuments/86

That works fine.

This morning I tried my second URL

/candidate/ViewPayRate.external?sp=23761 to /candidate/ViewPayRate/23761/true

Unfortunately, it seems since the base page name ViewPayRate resolves fine, 5.3 
looks at ".external" as a component, and I get the following exception:

Component candidate/ViewPayRate does not contain embedded component 'external'. 
 Screenshot: http://take.ms/nLDlR

My URL Rewriter isn't even being called, I presume because 
candidate/ViewPayRate resolves to a valid page.  I verified this by slightly 
changing the input URL to something that wouldn't match, and my rewrite was 
called and everything worked fine.

What is my best approach for this?  I'm leaning towards putting my rewrite 
rules in nginx, but I was really hoping to keep this all in code.

Any hints or suggestions would be greatly appreciated.

For completeness, here is my existing code:

public class OldCodeBaseLinkTransformer implements PageRenderLinkTransformer {

    @Inject
    @SuppressWarnings("unused")
    private Logger logger;

    @Inject
    private ValueEncoderSource valueEncoderSource;

    @Override
    public Link transformPageRenderLink(Link defaultLink, 
PageRenderRequestParameters parameters) {
        logger.debug("LOOK: " + defaultLink.getBasePath());
        return defaultLink;
    }

    @Override
    public PageRenderRequestParameters decodePageRenderRequest(Request request) 
{

        final String path = request.getPath();
        logger.info("path: " + path);

        if (path.startsWith("/maintenance/agency_required_documents.htm")) {
            final String agencyId = request.getParameter("agencyId");
            final EventContext context = new 
LinkContext(valueEncoderSource).putValue(agencyId);
            return new 
PageRenderRequestParameters("company/AgencyRequiredDocuments", context, false);
        }
        else if (path.startsWith("/candidate/ViewPayRate.external")) {
            final String id = request.getParameter("sp");
            final EventContext context = new 
LinkContext(valueEncoderSource).putValue(id).putValue("true");
            return new PageRenderRequestParameters("candidate/viewpayrate", 
context, false);
        }

        return null;
    }
}

and my contribution

@Contribute(PageRenderLinkTransformer.class)
@Primary
public static void provideURLRewriting(
        OrderedConfiguration<PageRenderLinkTransformer>
                configuration) {

    configuration.addInstance(
            "OldCodeBaseLink",
            OldCodeBaseLinkTransformer.class);
}





Since 1982, Starpoint Solutions has been a trusted source of human capital and 
solutions. We are committed to our clients, employees, environment, community 
and social concerns.  We foster an inclusive culture based on trust, respect, 
honesty and solid performance. Learn more about Starpoint and our social 
responsibility at http://www.starpoint.com/social_responsibility

This email message from Starpoint Solutions LLC is for the sole use of  the 
intended recipient(s) and may contain confidential and privileged  information. 
 Any unauthorized review, use, disclosure or distribution is prohibited.  If 
you are not the intended recipient, please contact the sender by reply email 
and destroy all copies of the original message.  Opinions, conclusions and 
other information in this message that do not relate to the official business 
of Starpoint Solutions shall be understood as neither given nor endorsed by it.

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

Reply via email to