2. ServletResponseAware

Access HttpServletResponse by implementing the ServletResponseAware interface and override the setServletResponse() method.

Note When Struts 2 ‘servlet-config‘ interceptor is seeing that an Action class is implemented the ServletResponseAware interface, it will pass a HttpServletResponse reference to the requested Action class via the setServletResponse() menthod.

Of course, you can create a custom getServletResponse() to get the HttpServletResponse easily.