<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 5, 2014 at 10:38 PM, Stuart Douglas <span dir="ltr"><<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>></span> wrote:<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">
I could add some other interface+method that makes it more obvious, although there would be a very slight performance impact as it means an extra allocation (for the adaptor to go from the new interface to the wrapper).</blockquote>
<div><br></div><div>Hmmm, it may not be worth it then especially since this is perhaps not about such a major use case. Some extra documentation somewhere that this would be the place to do "pre response write" operations would surely help.<br>
<br></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"><div class=""><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">
The map itself is directly mutable, is there any reason why you would need a whole new map vs just clearing the existing one?<br></blockquote></div></blockquote><div><br></div><div>To be absolutely sure that nothing else can possibly see the unmodified cookie. As an external user I don't know which code all over the place does a call to any of the getResponseCookies methods before I have had a chance to that do clearing or replacing/modifying. The new map I now set is a sub class of some map that modifies the cookie immediately in its put() method. </div>
<div><br></div><div>Of course what I conceptually actually would like to do is wrap <span style="font-size:13px;color:rgb(80,0,80);font-family:arial,sans-serif">HttpServerExchange so that I could directly intercept its setResponseCookie method.</span></div>
<div><span style="font-size:13px;color:rgb(80,0,80);font-family:arial,sans-serif"><br></span></div><div><span style="font-size:13px;color:rgb(80,0,80);font-family:arial,sans-serif">Since that is rather hard with the current setup (</span><font color="#500050" face="arial, sans-serif">HttpServerExchange is a final class and a huge one at that) the ability to set your own specialized map type seems to be the next best thing for this use case.</font></div>
<div><font color="#500050" face="arial, sans-serif"><br></font></div><div><font color="#500050" face="arial, sans-serif">Kind regards,</font></div><div><font color="#500050" face="arial, sans-serif">Arjan</font></div><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"><div class=""><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">
</blockquote></div>
<br>
Stuart<br>
<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 class="">
<br>
Kind regards,<br>
Arjan<br>
<br>
<br>
Even though this primary purpose of this hook is to wrap the<br>
response channel, you can also use it to do actions that need to<br>
occur just before the response is written, such as modifying cookies.<br>
<br>
Stuart<br>
<br>
arjan tijms wrote:<br>
<br>
Hi,<br>
<br>
I'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<br>
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></div>
HttpServerExchange#__<u></u>setResonseCookie is the central place where<div class=""><br>
cookies<br>
arrive.<br>
<br>
However, HttpServerExchange is a final class, so can't (easily) be<br>
wrapped. If HttpServerExchange only had a setResponseCookies<br>
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.<br>
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> <mailto:<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.<u></u>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><br>
<<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/undertow-dev</a>><br>
<br>
<br>
</blockquote>
</blockquote></div><br></div></div>