As I've read here and tried myself, it is not possible to inject the HttpServletResponse
of the current @RequestScoped
.
So it seems that you have to implement a custom CDI Procuder
or @Produces
method to be able to inject the HttpserlvetResponse
. I have two questions:
- Where would one implement this producer? Maybe with a web filter that sets the response in a
@RequestScoped
bean? - Is injecting the response even a good idea in the first place since there is no way to inject the response by default?