Re: Append content to OutputStream after RequestDispatcher#forward

2020-09-29 Thread Nicolò Boschi
Yes I also need to keep headers derived from included/forwarded servlet Thank you Tim, I already thought your solution and it should work, but it is a bit tricky I was wondering if there is a more elegant solution I'm not strictly bound to forward method if there is a better solution Il Mar 29 S

Re: Append content to OutputStream after RequestDispatcher#forward

2020-09-29 Thread Tim Funk
Forward needed to be used due to this in the original email > I also tried using RequestDispatcher#include but I need to keep response > headers, added during the forward And include() is not allowed to set headers. -Tim On Tue, Sep 29, 2020 at 2:27 PM Christopher Schultz wrote: > > If you wan

Re: Append content to OutputStream after RequestDispatcher#forward

2020-09-29 Thread Christopher Schultz
Nicolò, On 9/29/20 05:31, Nicolò Boschi wrote: > I would like to know how to append (or prepend) some content in a Servlet, > after RequestDispatcher#forward is called. > > Example code: > > class MyServlet extends HttpServlet { > > > @Override > public void doGet(HttpServletRequest reques

Re: Append content to OutputStream after RequestDispatcher#forward

2020-09-29 Thread Tim Funk
Advice: Redesign since this will be a support nightmare for you in the future since the design is not in the spirit of how the spec works. Now onto the real solution (over simplified .. but google can expand on each sub-idea) Create a ServletResponseWrapper and pass that to the forward() method w