Saturday, 28 September 2013

How to have URLs without a suffix (e.g .action) in Struts 2?

How to have URLs without a suffix (e.g .action) in Struts 2?

Here's the thing, I need to not only serve java, but also some javascript
files, with my .war. So e,g. if someone goes to the url:
example.com/js/foo.jar
Then I need that to be properly served as a javascript file. At the same
time, if someone goes to:
example.com/bar
I need that to be served by Struts2 as a possible controller.
The methods I've found online of removing the suffix from the url, would
cause both URls to be served by struts 2 (and hence give an error for the
first foo.js file even though it exists). Is there a way (such as an
interceptor) which will first check if the given .js file exists, before
giving an error?

No comments:

Post a Comment