Hi Korbinian, I am not sure this is possible. You could set response headers for normal responses, but not for redirects' targets.
On Mon, Aug 23, 2021 at 1:41 AM Locke, Jonathan (Luo Shibo) < jonath...@telenav.com> wrote: > It's been a while, but can't you get the WebResponse from WebRequestCycle > and then call response.setHeader()? > To continue Jon's idea: getRequestCycle().scheduleRequestHandlerAfterCurrent((requestCycle) -> { WebResponse response = (WebResponse) requestCycle.getResponse(); response.setHeader(...); response.setRedirect("..."); }); Play with it but you should set the headers in the response after the redirect happens. Martin > Jon > > ________________________________ > From: Korbinian Bachl <korbinian.ba...@whiskyworld.de> > Sent: Sunday, August 22, 2021 4:58 AM > To: users <users@wicket.apache.org> > Subject: RedirectRequestHandler and HttpHeader? > > Hi, > > I call this: > > getRequestCycle().scheduleRequestHandlerAfterCurrent(new > RedirectRequestHandler("myNewURL",301)); > > How could I add a custom HttpHeader to the response? > e.g.: Cache-Control: max-age=300 > > > Best, > > KB > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > [EXTERNAL EMAIL] CAUTION: This email originated from outside of Telenav. > DO NOT CLICK links or attachments unless you recognize the sender and know > the content is safe. >