fixed JOSE ClientResponseFilter for No Content response
@@ -26,6 +26,7 @@ import javax.ws.rs.HttpMethod;
import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientResponseContext;
import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.core.Response;
import org.apache.cxf.jaxrs.utils.HttpUtils;
import org.apache.cxf.rs.security.jose.common.JoseUtils;
@@ -36,6 +37,7 @@ public class JweClientResponseFilter extends AbstractJweDecryptingFilter impleme
@Override
public void filter(ClientRequestContext req, ClientResponseContext res) throws IOException {
if (isMethodWithNoContent(req.getMethod())
+ || isStatusCodeWithNoContent(res.getStatus())
|| isCheckEmptyStream() && !res.hasEntity()) {
return;
}
@@ -54,4 +56,8 @@ public class JweClientResponseFilter extends AbstractJweDecryptingFilter impleme
protected boolean isMethodWithNoContent(String method) {
return HttpMethod.DELETE.equals(method) || HttpUtils.isMethodWithNoResponseContent(method);
}
+
+ protected boolean isStatusCodeWithNoContent(int statusCode) {
+ return statusCode == Response.Status.NO_CONTENT.getStatusCode();
+ }
}
