<div dir="ltr"><div class="gmail_extra"><div class="im" style="font-family:arial,sans-serif;font-size:13px">On Thu, Jun 5, 2014 at 7:08 PM, Stuart Douglas <span dir="ltr">&lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">It is not obvious, but you can add a wrapper to io.undertow.server.<u></u>HttpServerExchange#<u></u>addResponseWrapper, which will then be called just before the response is written.<br>
</blockquote><div><br></div></div><div style="font-family:arial,sans-serif;font-size:13px">Woh, that&#39;s indeed not entirely obvious! ;)</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
I guess I&#39;ll just have to return factory.create(); then, and right before that iterate over the cookies and change their value. Well, I&#39;ll try it. Thanks!</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">I currently solved the issue by setting the responseCookies instance variable of HttpServerExchange anyway by using reflection, but that&#39;s of course not so nice. Is there any reason there&#39;s isn&#39;t a setter? Lot&#39;s of other things are directly mutable it seems, like the relativePath and such (which is great for handlers that need to do request rewriting).</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Kind regards,</div><div style="font-family:arial,sans-serif;font-size:13px">Arjan</div><div class="" style="font-family:arial,sans-serif;font-size:13px">
<div id=":1dq" class="" tabindex="0"><img class="" src="https://mail.google.com/mail/u/0/images/cleardot.gif"></div></div><div class="im" style="font-family:arial,sans-serif;font-size:13px"><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>Even though this primary purpose of this hook is to wrap the response channel, you can also use it to do actions that need to occur just before the response is written, such as modifying cookies.<br><br>Stuart<br><br>
arjan tijms wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>Hi,<br><br>I&#39;m trying to intercept the way that cookies are being written in<br>
Undertow. The idea is to do something like can be done with a cookie<br>rewrite rule in Apache (like e.g. add or replace something to the domain<br>attribute of each and every cookie being written).<br><br>After some hacking on the Undertow code it became clear that<br>
HttpServerExchange#<u></u>setResonseCookie is the central place where cookies<br>arrive.<br><br>However, HttpServerExchange is a final class, so can&#39;t (easily) be<br>wrapped. If HttpServerExchange only had a setResponseCookies method then<br>
handlers could install a special map that does the rewriting, making<br>this a fairly easy task.<br><br>What do you think? Would it be a good idea to add such a method. or is<br>there an other way to easily do something like this?<br>
<br>Kind regards,<br>Arjan Tijms<br><br></div>______________________________<u></u>_________________<br>undertow-dev mailing list<br><a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/undertow-dev</a></blockquote></blockquote></div></div></div>