Hi Arun,
I created a test case based on your interceptor and the close method is
not called too (only the connection stream is closed but not the new
supplied input stream). The close should be called for intercepted
stream. I have created an issue:
http://java.net/jira/browse/JERSEY-1845
Mira
On 13.4.2013 23:50, Arun Gupta wrote:
> I created a aroundReadFrom interceptor and deployed on the client-side:
>
> ric.setInputStream(new FilterInputStream(ric.getInputStream()) {
>
> final ByteArrayOutputStream baos = new
> ByteArrayOutputStream();
>
> @Override
> public int read() throws IOException {
> System.out.println("read");
> return super.read();
> }
>
> @Override
> public int read(byte[] b) throws IOException {
> System.out.println("read(byte[]");
> return super.read(b);
> }
>
> @Override
> public int read(byte[] b, int off, int len) throws
> IOException {
> System.out.println("read(byte[], int, int)");
> baos.write(b, off, len);
> return super.read(b, off, len);
> }
>
> @Override
> public void close() throws IOException {
> System.out.println("### " + baos.toString());
> super.close();
> }
> });
>
> A POST request invokes only the read(byte[], int, int) method and
> close is never called.
>
> Is that the expected behavior ?
>
> Arun
>