Hi Luiz,

here are the request headers. For Apache HTTPClient:

  accept -> chemical/x-mdl-sdfile
  accept-encoding -> gzip
  breadcrumbId -> ID-6667e3dab68a-38877-1547658276076-0-15
  CamelHttpMethod -> POST
  CamelHttpPath ->
  CamelHttpQuery -> null
  CamelHttpServletRequest -> org.apache.catalina.connector.RequestFacade@7551baa3   CamelHttpServletResponse -> org.apache.catalina.connector.ResponseFacade@60e05546   CamelHttpUri -> /chem-services-cdk-basic/rest/v1/converters/dataset_to_sdf   CamelHttpUrl -> http://localhost:8092/chem-services-cdk-basic/rest/v1/converters/dataset_to_sdf
  CamelServletContextPath -> /v1/converters/dataset_to_sdf
  connection -> Keep-Alive
  content-encoding -> gzip
  Content-Type -> application/x-squonk-dataset-molecule+json
  host -> localhost:8092
  transfer-encoding -> chunked
  user-agent -> Apache-HttpAsyncClient/4.1.4 (Java/1.8.0_191)

For curl:

  accept -> chemical/x-mdl-sdfile
  breadcrumbId -> ID-09b7601451a2-34027-1547658868812-0-15
  CamelHttpMethod -> POST
  CamelHttpPath ->
  CamelHttpQuery -> null
  CamelHttpServletRequest -> org.apache.catalina.connector.RequestFacade@3af9ee39   CamelHttpServletResponse -> org.apache.catalina.connector.ResponseFacade@1f33d20b   CamelHttpUri -> /chem-services-cdk-basic/rest/v1/converters/dataset_to_sdf   CamelHttpUrl -> http://localhost:8092/chem-services-cdk-basic/rest/v1/converters/dataset_to_sdf
  CamelServletContextPath -> /v1/converters/dataset_to_sdf
  content-encoding -> gzip
  content-length -> 19397182
  Content-Type -> application/x-squonk-dataset-molecule+json
  expect -> 100-continue
  host -> localhost:8092
  user-agent -> curl/7.55.1


On 16/01/2019 16:55, Luiz Eduardo Valmont wrote:
Hi, Tim!

I'd suggest trying to intercept / dump the HttpAsyncClient request as well
as the curl one. A simple "nc -l -p 8888" in an *NIX OS will do.

My guess is that the perceived difference lies in the request headers.
Might be in the Accept.

Can you post both requests in full, body excluded?

Thanks!

On Wed, 16 Jan 2019, 14:46 Tim Dudgeon <[email protected] wrote:

I'm hitting a strange problem with a route that is using the servlet
component to send a large stream of data in its response.
This is part of a route that uses the REST DSL which is set up like this:

restConfiguration().component("servlet").host("0.0.0.0");

The route sets the response body as an PipedInputStream and then (in a
separate thread) writes to that InputStream and eventually closes it.
The expectation is that as the response size is unknown the data will be
chunked and response returned to the client immediately and the client
will start to consume the data immediately.

When using curl as the client it seems to be working correctly, and I
see a 'Transfer-Encoding: chunked' header in the response.

However my real client is Apache HttpAsyncClient and with that what I'm
seeing is that the response is not returned until all the data is
written, and instead of a 'Transfer-Encoding: chunked' header I see a
'Content-Length: 19196336' header suggesting that Camel has waited for
the entire content to be written so that it can set the Content-Length.
I tried manually setting the 'Transfer-Encoding: chunked' in the
response message but it did not appear and instead I saw the
Content-Length header.
I've got HttpAsyncClient working in a test example to prove that it can
received the response asynchronously, so I think (but can't be sure)
that the problem is on the server (Camel) side.

What can explain this different behaviour from the same service when
using different clients?


Reply via email to