Enrique
Enrique

Reputation: 10117

How to rewrite URL in Tomcat 6

I'll build a web application and I want to use url rewriting. In apache this is done with mod_rewrite. But how can I rewrite urls with Tomcat 6?

I want to use Struts 2 framework.

Upvotes: 10

Views: 25582

Answers (3)

fglez
fglez

Reputation: 8552

It could be a good idea to have Apache as a web server for static content in front of Tomcat application server.

You can then use Apache's mod_rewrite and Tomcat.

In any case, there's a similar question.

Upvotes: 1

Droo
Droo

Reputation: 3205

You can do wildcard mappings in your struts.xml:

<action name="*Crud" class="example.Crud" method="{1}">
...

Then I think you can set your default action extension to / in struts.properties:

struts.action.extension=/

As for the URL filter, here's a good blog post.

Upvotes: 1

Jonathan Feinberg
Jonathan Feinberg

Reputation: 45324

I've used UrlRewriteFilter as a critical component of a couple of my tomcat-based apps, and have been totally happy with it.

Upvotes: 14

Related Questions