On 11/8/2021 4:26 PM, Michael Osipov wrote:
Well, that is going to be a problem because the code in the low level method looks like this:

CloseableHttpResponse downloadResponse = httpClient.execute(downloadFile);

DataHandler dh = new DataHandler(new InputStreamDataSource(new HttpResponseInputStream(
        downloadResponse)));

dh is passed on to the return object and a high level class is processing the response implicitly. I don't see way to make that work in a closure.


Something like that. Give me a compilable code and will put the handling logic into a closure.

```
Object result = httpclient.execute(downloadFile, response -> {
DataHandler dh = new DataHandler(new InputStreamDataSource(new HttpResponseInputStream(response)));
    return dh.handle();
});
```

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to