Our application requires some action responses to be cacheable and others
not.

Although the default caching handling of struts can be easily modified by
setting the appropriate parameter in web.xml this only affects the overall
handling for ALL action responses.

Adapting this default behavior to conditional handling based on (extended)
action mappings by extending the ActionServlet is currently NOT possible
without modifying the ActionServlet source code itself or by overriding its
most important (and extensive) process(...) method.

Overriding the process(...) method is something I do not prefer: its
contains to much code unrelated to this issue.
Instead, I added one new (empty) method: processActionMapping(mapping,
request, response).
By extending the ActionServlet we now handle all mapping specific
functionality in an override of this method.

The actionservlet also sets the default contentType for ALL action responses
to one and only value (default "text/html", modifiable with a parameter in
web.xml).
Our action mapping extension also allows for override of the default content
type and the corresponding response header is then also set by the
processActionMapping(...) method.
But: this header would be set twice default because the default handling
cannot be turned off other than overriding the processContent(..) method
with an empty one. Although setting this header more than once is allowed in
which only the last set value will actually be output it didn't like that
thus implemented an empty override of the processContent(...) method (which
I didn't like to do either).

I think struts is great as a generic framework and out application would
have been much more difficult to build and certainly to maintain without it.
The "default" parameters defineable for the actionservlet in web.xml are
great for most of the situations, but I think struts should allow
conditional handling of these parameters otherwise the "default" values
aren't truly default values at all.

I thus kindly  propose an enhancement for these "nocache" and "content"
parameters handling in which they can be conditionally set/processed based
on an action mapping in a separate protected method. The current handling
could then be implemented in this method and by extending the new method
application specific handling can be written.

Ate Douma

Reply via email to