Search code examples
javaatgatg-dynamo

ATG Dynamo 5 - how do I redirect all URIs to the same page


Why I would want to follows:

I'm working on a site that is pretty 1998. It's distributed into frames. A lot of hands that never RTFM'd before using the templating language have touched it and most of the jhtml files read more like lists of servlets with a dash of logic than HTML templates with a dash of templating tags for dynamic repetition of elements and insertions of dynamic values.

It's a pretty inflexible tightly coupled spaghetti monster of an app, especially from a front end dev's perspective.

I'm very fond of Django's approach to the problem and would like to take a crack at building something like it's URI config file which basically maps regEx URI patterns to controllers (passing in captured parameters is where that gets really useful) which in turn load up template files and plugs in the business logic to render the appropriate page.

I'm new to Java but I'm assuming I'd be writing servlets to handle this.


Solution

  • We've done something slightly like this in ATG. We put a servlet in the pipeline that does request.getServletPath(), then checks that path against our rules. If it matches, it uses a request dispatcher to send the request to the right JSP. It's all done with the standard J2EE API, apart from the fact that it's in the ATG request pipeline.