Avoid Buffering Response for Request / ApplicationLink Requests

We use the Confluence’s ApplicationLink#createAuthenticatedRequestFactory() and com.atlassian.sal.api.net.RequestFactory to do request other systems.

We noticed that this that request handler seems to buffer the whole request. It copies all the content into a byte array:

Request request = applicationLink.createAuthenticatedRequestFactory().createRequest(...)
request.execute(new ResponseHandler(){
public void handle(Response response) throws ResponseException {
    // At this point the response already buffered the whole body.
    // If it's a large file, we had to wait for the whole file transfer, or even ran out of Java Heap Space
    // We don't get a chance to deal with the response in a streaming fashion.
}
})

Is there a way to set up the request so that it does not buffer the response?

If its not possible to prevent buffering, is there a way to make application link requests
with an alternative HTTP client. We would need the get the application link authentication
for the alternative HTTP client.

Same problem here. :confused:

1 Like