use of jakarta.ws.rs.client.ClientResponseFilter in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method setCorruptedStream.
protected AtomicInteger setCorruptedStream() {
final AtomicInteger ai = new AtomicInteger(0);
ClientResponseFilter filter = new ClientResponseFilter() {
@Override
public void filter(ClientRequestContext arg0, ClientResponseContext response) throws IOException {
CorruptedInputStream cis = new CorruptedInputStream(ResponseTest.ENTITY.getBytes(), ai);
cis.setCorrupted(true);
response.setEntityStream(cis);
}
};
addProvider(filter);
// do not use new entity stream in logging filter for the case of priority
// disfunction, the CorruptedInputStream would be then replaced, wrongly
// informing about not closing the stream
super.setPrintEntity(false);
return ai;
}
Aggregations