Search code examples
javaservletsjax-rsguice

Programmatically rewrite URL with Java


My app is built with Google Guice for handling mappings of servlets.

Is it possible to map a resource:

user.myapp.com to myapp.com/user without using Apache Mod Rewrite and any Server container component like it?

The idea being my backend is Google App Engine (GAE).


Solution

  • GAE allows the use of Servlet filters. Hence, I suggest you make use of that by configuring the UrlRewriteFilter. Essentially it's mod_rewrite for Java.