0

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:

  1. Where would one implement this producer? Maybe with a web filter that sets the response in a @RequestScoped bean?
  2. Is injecting the response even a good idea in the first place since there is no way to inject the response by default?
orudicKS
  • 3
  • 3

1 Answers1

0

Never mind. I just found the Servlet module from Apache DeltaSpike which allows for injectable servlet objects such as the HttpServletResponse. So there is no need for a custom CDI Producer or @Produces method.

orudicKS
  • 3
  • 3