Skip to content

jersey-netty-connector - Post commit b2316648590c368aeb5b3729b29af300ab5c0bea unable to download file sent in a redirect #5881

@sxsubram

Description

@sxsubram

Client calls URL1 which does a redirect with the Location set to a .csv file
With change b231664, the stream is closed before the file can be downloaded due connector being shutdown.

newConnector.execute(newReq, this.redirectUriHistory, new CompletableFuture() {

                                public boolean complete(ClientResponse value) {
                                    **newConnector.close();**
                                    return JerseyClientHandler.this.responseAvailable.complete(value);
                                }

                                public boolean completeExceptionally(Throwable ex) {
                                    newConnector.close();
                                    return JerseyClientHandler.this.responseAvailable.completeExceptionally(ex);
                                }
                            });

Req 1
DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 302 Found
Server: Some Server
Date: Wed, 12 Mar 2025 22:11:40 GMT
Connection: close
Location: https://xxxx.com/somePath/8518C64490C6B934CA258C41004CF9DC/$file/someDirFeb25-347.csv
Strict-Transport-Security: max-age=604800
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: sniff
content-length: 0

Redirected Req
DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 200 OK
Server: Some server
Date: Wed, 12 Mar 2025 22:12:28 GMT
Last-Modified: Sun, 02 Mar 2025 14:01:29 GMT
Content-Type: application/octet-stream
ETag: W/"MTAtMDAwMi0wLUNBMjU4QzQxMDA0RDA5RjctODUxOEM2NDQ5MEM2QjkzNENBMjU4QzQxMDA0Q0Y5REM="
Strict-Transport-Security: max-age=604800
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: sniff
content-length: 1425188

When reading the response stream I get
java.io.IOException: java.io.IOException: Stream closed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions