I should probably make this an error (attempting to send more than the
remaining content length).
Stuart
On Thu, Dec 8, 2016 at 8:48 AM, Steve Hu <stevehu(a)gmail.com> wrote:
If you don'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.
On Wed, Dec 7, 2016 at 4:17 PM, Hicks, Matt <matt(a)matthicks.com> wrote:
>
> Strangely enough, removing the CONTENT_LENGTH header fixed it!
>
> On Wed, Dec 7, 2016 at 2:33 PM Bill O'Neil <bill(a)dartalley.com> wrote:
>>
>> Or if you are sending bytes try.
>>
>> exchange.getResponseSender().send(ByteBuffer.wrap(byteArray));
>>
>> On Wed, Dec 7, 2016 at 3:31 PM, Bill O'Neil <bill(a)dartalley.com>
wrote:
>>>
>>> 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.
>>>
>>> Try removing the line
>>> exchange.getResponseHeaders.put(Headers.CONTENT_LENGTH, html.length)
>>>
>>> On Wed, Dec 7, 2016 at 3:17 PM, Hicks, Matt <matt(a)matthicks.com>
wrote:
>>>>
>>>> I've got a fairly simplistic scenario (using 1.4.6.Final) where
I'm
>>>> building an HTML String and then sending it to my exchange:
>>>>
>>>> exchange.getResponseHeaders.put(Headers.CONTENT_LENGTH, html.length)
>>>> exchange.getResponseHeaders.put(Headers.CONTENT_TYPE,
"text/html")
>>>> exchange.getResponseSender.send(html)
>>>>
>>>> However, very often the last one to three characters don't seem to
be
>>>> received by the browser. I've logged the HTML before outputting so I
know
>>>> that I'm adding the "</html>" 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't get clipped. Is there something I'm missing that
needs to be
>>>> done to make sure the content is flushed appropriately?
>>>>
>>>> _______________________________________________
>>>> undertow-dev mailing list
>>>> undertow-dev(a)lists.jboss.org
>>>>
https://lists.jboss.org/mailman/listinfo/undertow-dev
>>>
>>>
>>
>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/undertow-dev
_______________________________________________
undertow-dev mailing list
undertow-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev