tags:

views:

81

answers:

1

I am using JBoss 4.0.5.GA to run a set of java applications. One of them is a web frontend, using Spring 1.4. URL mappings are configured in a way that 'fake' pages from request URLs are mapped to controllers. That means that when someone requests /index.htm, there's no actual 'index.htm' on disk, and that request maps to a specific conroller which then renders a jsp view.

So the problem is as follows: I need to tell JBoss to somehow forward all requests for directory indices to corresponding 'index.htm' URLs like so: / → /index.htm; /news/ → /news/index.htm; /foo/bar/baz/ → /foo/bar/baz/index.htm and so on.

I can't use Tomcat's welcome-file-list feature because it looks for those files on disk, while all 'index.htm's are fake and don't actually exist on disk.

A: 

Why can't you add a controller that handles requests for / URLs, that forwards on to the index.htm controllers?

If that's not an option, consider using The URLRewriteFilter library to perform forwarding or redirecting. This should be able to sit outside of your own code.

skaffman
I tried to use URLRewriteFilter, but it breaks the whole application somehow. You see, it was designed and built by another company and they did a pretty good job in using every single anti-pattern avaliable :) As far as I was able to figure out, there are some filters in web.xml which set some preliminary information for later request processing. When URLRewriteFilter performs forwarding, it skips all other filters and feeds the request directly to the servlet. I tried to play with filters order, with no luck. So unfortunately URLRewriteFilter is not an option.
The Pretender
So I guess, I will have to add a new controller which will forward requests to another one, as you suggested. Thanks! :)
The Pretender