@@ -147,6 +147,15 @@ protected void onSendAfterWrite(WebServiceMessage message) throws IOException {
147147 * Receiving response
148148 */
149149
150+ @ Override
151+ protected boolean isGzipResponse () throws IOException {
152+ HttpEntity entity = getHttpEntity ();
153+ if (entity != null ) {
154+ return HttpTransportConstants .CONTENT_ENCODING_GZIP .equals (entity .getContentEncoding ());
155+ }
156+ return super .isGzipResponse ();
157+ }
158+
150159 @ Override
151160 protected int getResponseCode () throws IOException {
152161 return getHttpResponse ().getCode ();
@@ -159,28 +168,19 @@ protected String getResponseMessage() throws IOException {
159168
160169 @ Override
161170 protected long getResponseContentLength () throws IOException {
162-
163- if (this .httpResponse instanceof ClassicHttpResponse response ) {
164-
165- HttpEntity entity = response .getEntity ();
166- if (entity != null ) {
167- return entity .getContentLength ();
168- }
171+ HttpEntity entity = getHttpEntity ();
172+ if (entity != null ) {
173+ return entity .getContentLength ();
169174 }
170175 return 0 ;
171176 }
172177
173178 @ Override
174179 protected InputStream getRawResponseInputStream () throws IOException {
175-
176- if (this .httpResponse instanceof ClassicHttpResponse response ) {
177-
178- HttpEntity entity = response .getEntity ();
179- if (entity != null ) {
180- return entity .getContent ();
181- }
180+ HttpEntity entity = getHttpEntity ();
181+ if (entity != null ) {
182+ return entity .getContent ();
182183 }
183-
184184 throw new IllegalStateException ("Response has no enclosing response entity, cannot create input stream" );
185185 }
186186
@@ -196,4 +196,11 @@ public Iterator<String> getResponseHeaders(String name) throws IOException {
196196 return Arrays .stream (getHttpResponse ().getHeaders (name )).map (NameValuePair ::getValue ).iterator ();
197197 }
198198
199+ private @ Nullable HttpEntity getHttpEntity () {
200+ if (this .httpResponse instanceof ClassicHttpResponse response ) {
201+ return response .getEntity ();
202+ }
203+ return null ;
204+ }
205+
199206}
0 commit comments