<div dir="ltr">If you don&#39;t put content_length, the server will calculate it. The calculation is based on the byte[] not string so your calculation is not correct. My understanding is you only need to set content_length if you are working on streams.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 7, 2016 at 4:17 PM, Hicks, Matt <span dir="ltr">&lt;<a href="mailto:matt@matthicks.com" target="_blank">matt@matthicks.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Strangely enough, removing the CONTENT_LENGTH header fixed it!</div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 7, 2016 at 2:33 PM Bill O&#39;Neil &lt;<a href="mailto:bill@dartalley.com" target="_blank">bill@dartalley.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="m_-6721712673596262286gmail_msg">Or if you are sending bytes try.<div class="m_-6721712673596262286gmail_msg"><br class="m_-6721712673596262286gmail_msg"></div><div class="m_-6721712673596262286gmail_msg"><span style="color:rgb(51,51,51);font-family:consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:12px;white-space:pre-wrap" class="m_-6721712673596262286gmail_msg">exchange</span><span class="m_-6721712673596262286m_6573072833660309167gmail-pl-k m_-6721712673596262286gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93);font-family:consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:12px;white-space:pre-wrap">.</span><span style="color:rgb(51,51,51);font-family:consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:12px;white-space:pre-wrap" class="m_-6721712673596262286gmail_msg">getResponseSender()</span><span class="m_-6721712673596262286m_6573072833660309167gmail-pl-k m_-6721712673596262286gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93);font-family:consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:12px;white-space:pre-wrap">.</span><span style="color:rgb(51,51,51);font-family:consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:12px;white-space:pre-wrap" class="m_-6721712673596262286gmail_msg">s<wbr>end(</span><span class="m_-6721712673596262286m_6573072833660309167gmail-pl-smi m_-6721712673596262286gmail_msg" style="box-sizing:border-box;color:rgb(51,51,51);font-family:consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:12px;white-space:pre-wrap">ByteBuffer</span><span class="m_-6721712673596262286m_6573072833660309167gmail-pl-k m_-6721712673596262286gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93);font-family:consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:12px;white-space:pre-wrap">.</span><span style="color:rgb(51,51,51);font-family:consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:12px;white-space:pre-wrap" class="m_-6721712673596262286gmail_msg">wrap(byteArray)<wbr>);</span><br class="m_-6721712673596262286gmail_msg"></div></div><div class="gmail_extra m_-6721712673596262286gmail_msg"><br class="m_-6721712673596262286gmail_msg"><div class="gmail_quote m_-6721712673596262286gmail_msg">On Wed, Dec 7, 2016 at 3:31 PM, Bill O&#39;Neil <span dir="ltr" class="m_-6721712673596262286gmail_msg">&lt;<a href="mailto:bill@dartalley.com" class="m_-6721712673596262286gmail_msg" target="_blank">bill@dartalley.com</a>&gt;</span> wrote:<br class="m_-6721712673596262286gmail_msg"><blockquote class="gmail_quote m_-6721712673596262286gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="m_-6721712673596262286gmail_msg">It might have something to do with character encoding. You should not need to pass the content length when using the send(String) method it should set it for you.<div class="m_-6721712673596262286gmail_msg"><br class="m_-6721712673596262286gmail_msg"></div><div class="m_-6721712673596262286gmail_msg">Try removing the line <span style="font-family:monospace;font-size:10.4px" class="m_-6721712673596262286gmail_msg">exchange.<wbr>getResponseHeaders.</span><span style="font-family:monospace;font-size:10.4px" class="m_-6721712673596262286gmail_msg">put(<wbr>Headers.CONTENT_LENGTH, html.length)</span></div></div><div class="gmail_extra m_-6721712673596262286gmail_msg"><br class="m_-6721712673596262286gmail_msg"><div class="gmail_quote m_-6721712673596262286gmail_msg"><div class="m_-6721712673596262286gmail_msg"><div class="m_-6721712673596262286m_6573072833660309167h5 m_-6721712673596262286gmail_msg">On Wed, Dec 7, 2016 at 3:17 PM, Hicks, Matt <span dir="ltr" class="m_-6721712673596262286gmail_msg">&lt;<a href="mailto:matt@matthicks.com" class="m_-6721712673596262286gmail_msg" target="_blank">matt@matthicks.com</a>&gt;</span> wrote:<br class="m_-6721712673596262286gmail_msg"></div></div><blockquote class="gmail_quote m_-6721712673596262286gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_-6721712673596262286gmail_msg"><div class="m_-6721712673596262286m_6573072833660309167h5 m_-6721712673596262286gmail_msg"><div dir="ltr" class="m_-6721712673596262286gmail_msg"><div class="gmail_quote m_-6721712673596262286gmail_msg"><div dir="ltr" class="m_-6721712673596262286m_6573072833660309167m_-3949167245482381659m_-7257260311300174859gmail_msg m_-6721712673596262286gmail_msg">I&#39;ve got a fairly simplistic scenario (using 1.4.6.Final) where I&#39;m building an HTML String and then sending it to my exchange:<div class="m_-6721712673596262286m_6573072833660309167m_-3949167245482381659m_-7257260311300174859gmail_msg m_-6721712673596262286gmail_msg"><br class="m_-6721712673596262286m_6573072833660309167m_-3949167245482381659m_-7257260311300174859gmail_msg m_-6721712673596262286gmail_msg"></div><font face="monospace" class="m_-6721712673596262286m_6573072833660309167m_-3949167245482381659m_-7257260311300174859gmail_msg m_-6721712673596262286gmail_msg">exchange.getResponseHeaders.<wbr>put(Headers.CONTENT_LENGTH, html.length)<br class="m_-6721712673596262286m_6573072833660309167m_-3949167245482381659m_-7257260311300174859gmail_msg m_-6721712673596262286gmail_msg">exchange.getResponseHeaders.<wbr>put(Headers.CONTENT_TYPE, &quot;text/html&quot;)<br class="m_-6721712673596262286m_6573072833660309167m_-3949167245482381659m_-7257260311300174859gmail_msg m_-6721712673596262286gmail_msg">exchange.getResponseSender.<wbr>send(html)</font><div class="m_-6721712673596262286m_6573072833660309167m_-3949167245482381659m_-7257260311300174859gmail_msg m_-6721712673596262286gmail_msg"><br class="m_-6721712673596262286m_6573072833660309167m_-3949167245482381659m_-7257260311300174859gmail_msg m_-6721712673596262286gmail_msg"></div><div class="m_-6721712673596262286m_6573072833660309167m_-3949167245482381659m_-7257260311300174859gmail_msg m_-6721712673596262286gmail_msg">However, very often the last one to three characters don&#39;t seem to be received by the browser.  I&#39;ve logged the HTML before outputting so I know that I&#39;m adding the &quot;&lt;/html&gt;&quot; at the end, but in order to get everything properly to the browser I have to append a few spaces to the end of my HTML so it doesn&#39;t get clipped.  Is there something I&#39;m missing that needs to be done to make sure the content is flushed appropriately?</div></div></div></div>
<br class="m_-6721712673596262286gmail_msg"></div></div>______________________________<wbr>_________________<br class="m_-6721712673596262286gmail_msg">
undertow-dev mailing list<br class="m_-6721712673596262286gmail_msg">
<a href="mailto:undertow-dev@lists.jboss.org" class="m_-6721712673596262286gmail_msg" target="_blank">undertow-dev@lists.jboss.org</a><br class="m_-6721712673596262286gmail_msg">
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" class="m_-6721712673596262286gmail_msg" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/undertow-dev</a><br class="m_-6721712673596262286gmail_msg"></blockquote></div><br class="m_-6721712673596262286gmail_msg"></div>
</blockquote></div><br class="m_-6721712673596262286gmail_msg"></div>
</blockquote></div>
</div></div><br>______________________________<wbr>_________________<br>
undertow-dev mailing list<br>
<a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/undertow-dev</a><br></blockquote></div><br></div>