Java Code Examples for javax.ws.rs.ext.ReaderInterceptorContext#getInputStream()
The following examples show how to use
javax.ws.rs.ext.ReaderInterceptorContext#getInputStream() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractFilterInterceptorTest.java From servicetalk with Apache License 2.0 | 5 votes |
@Override public Object aroundReadFrom(final ReaderInterceptorContext readerInterceptorCtx) throws IOException { final InputStream old = readerInterceptorCtx.getInputStream(); readerInterceptorCtx.setInputStream(new UpperCaseInputStream(old)); try { return readerInterceptorCtx.proceed(); } finally { readerInterceptorCtx.setInputStream(old); } }
Example 2
Source File: GZipInterceptor.java From Alpine with Apache License 2.0 | 5 votes |
@Override public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException { final List<String> header = context.getHeaders().get(HttpHeaders.CONTENT_ENCODING); if (header != null && header.contains("gzip")) { // DO NOT CLOSE STREAMS final InputStream contentInputSteam = context.getInputStream(); final GZIPInputStream gzipInputStream = new GZIPInputStream(contentInputSteam); context.setInputStream(gzipInputStream); } return context.proceed(); }
Example 3
Source File: TestHttpTarget.java From datacollector with Apache License 2.0 | 5 votes |
@Override public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException { if (context.getHeaders().containsKey("Content-Encoding") && context.getHeaders().get("Content-Encoding").contains("snappy")) { InputStream originalInputStream = context.getInputStream(); context.setInputStream(new SnappyFramedInputStream(originalInputStream, true)); } return context.proceed(); }
Example 4
Source File: SnappyReaderInterceptor.java From datacollector with Apache License 2.0 | 5 votes |
@Override public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException { if (context.getHeaders().containsKey(CONTENT_ENCODING) && context.getHeaders().get(CONTENT_ENCODING).contains(SNAPPY)) { InputStream originalInputStream = context.getInputStream(); context.setInputStream(new SnappyFramedInputStream(originalInputStream, true)); } return context.proceed(); }
Example 5
Source File: GZIPReaderInterceptor.java From divide with Apache License 2.0 | 5 votes |
@Override public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException { final InputStream originalInputStream = context.getInputStream(); context.setInputStream(new GZIPInputStream(originalInputStream)); return context.proceed(); }
Example 6
Source File: FormReaderInterceptor.java From cxf with Apache License 2.0 | 5 votes |
@Override public Object aroundReadFrom(ReaderInterceptorContext ctx) throws IOException, WebApplicationException { BufferedReader br = new BufferedReader(new InputStreamReader(ctx.getInputStream())); String line; while ((line = br.readLine()) != null) { LOG.info("readLine: " + line); } ByteArrayInputStream bais = new ByteArrayInputStream("value=MODIFIED".getBytes()); LOG.info("set value=MODIFIED"); ctx.setInputStream(bais); return ctx.proceed(); }
Example 7
Source File: JAXRS20ClientServerBookTest.java From cxf with Apache License 2.0 | 5 votes |
@Override public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException { if (context.getInputStream() != null) { context.getHeaders().add("ClientReaderInterceptor", "clientRead"); } return context.proceed(); }
Example 8
Source File: RequestServerReaderInterceptor.java From tutorials with MIT License | 5 votes |
@Override public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException { LOG.info("Request reader interceptor in the server side"); InputStream is = context.getInputStream(); String body = new BufferedReader(new InputStreamReader(is)).lines() .collect(Collectors.joining("\n")); context.setInputStream(new ByteArrayInputStream((body + " message added in server reader interceptor").getBytes())); return context.proceed(); }
Example 9
Source File: GZIPReaderInterceptor.java From wings with Apache License 2.0 | 5 votes |
@Override public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException { List<String> ce = context.getHeaders().get("content-encoding"); if (ce != null && ce.contains("gzip")) { final InputStream originalInputStream = context.getInputStream(); context.setInputStream(new GZIPInputStream(originalInputStream)); } return context.proceed(); }