views:

50

answers:

1

I want to implement some attractive /path/to/my/app URLs for a java application. There is already an apache instance in front of the app server, with mod_rewrite installed. Do I win anything by using a java-based rewriter like UrlRewriteFilter instead?

+1  A: 

You win reduced complexity. Setup of the application becomes more and more complex when more moving parts are involved. As long as the front-end Apache doesn't do much except forwarding the requests to the appropriate web application server, it's a very simple element that's easy to understand.

As soon as you start adding business logic to that part it becomes an integral part of the system and needs to be perfectly configured for your system to run.

This also increases the complexity of running the system locally for development and/or bug fixing: It's much simpler to start a simple tomcat in your IDE of choice than it is to have a fully configured Apache + Tomcat system running.

Further more automated testing becomes much harder, since it's almost trivial to start a Tomcat instance programatically, but you'll get more moving parts if you involve an Apache HTTP server as well.

To summarize (tl;dr): adding more moving parts makes each part of your development lifecycle harder. You should only do it, if there is a clear gain that outweighs the price.

Joachim Sauer