2

直接アクセスできない内部アプリケーションへのリクエストをプロキシする Jersey-Application があります。

@GET
@Path("/path")
public static Response get(
        @Context UriInfo uriinfo,
        @Context HttpHeaders httpHeaders,
        byte[] body
        ) throws Exception{

//call the internal application
Response response = get(url, uriinfo, httpHeaders, body, HttpMethod.GET);

ResponseBuilder rb = Response.
                status(response.getStatusCode()).
                entity(response.getResponseStream());

//set all headers from response
for(header : response.getResponseHeaders()){
    rb.header(...);
}

Response r = rb.build();
//checking headers here, does NOT contain any Content-Length header
return r;

内部アプリケーションからの応答には、Transfer-Encoding = chunkedヘッダー セットがあります。ここまでは大丈夫です。

現在、クライアントに送信されるContent-Length応答には、発信応答でおそらく Jersey 自体によって設定されたヘッダーも含まれています。クライアントに送信する前にヘッダーを確認すると、内部アプリからの応答のように、すべてのヘッダーが正しく設定されています。

ヘッダーが原因で、クライアントはContent-Length応答を正しく解釈できません。ここで説明されているように、どちらか Content-LengthまたはTransfer-Encoding設定されている必要があります

Content-LengthTransfer-Encoding が既に設定されている場合、Jersey がヘッダーを設定できないようにするにはどうすればよいですか?

4

0 に答える 0