/** * Returns the reader parser matching the request <code>Accept</code> header. * * @return The reader parser matching the request <code>Accept</code> header, or <jk>null</jk> * if no matching reader parser was found, or the matching parser was an input stream parser. */ public ReaderParser getReaderParser() { Parser p = getParser(); if (p.isReaderParser()) return (ReaderParser)p; return null; }
/** * Returns the reader parser matching the request <code>Content-Type</code> header. * * @return * The reader parser matching the request <code>Content-Type</code> header, or <jk>null</jk> if no matching * reader parser was found, or the matching parser was an input stream parser. */ public ReaderParser getReaderParser() { Parser p = getParser(); if (p != null && p.isReaderParser()) return (ReaderParser)p; return null; }
/** * Returns the reader parser matching the request <code>Content-Type</code> header. * * @return * The reader parser matching the request <code>Content-Type</code> header, or <jk>null</jk> if no matching * reader parser was found, or the matching parser was an input stream parser. */ public ReaderParser getReaderParser() { Parser p = getParser(); if (p != null && p.isReaderParser()) return (ReaderParser)p; return null; }
/** * Returns the input stream parser matching the request <code>Content-Type</code> header. * * @return * The input stream parser matching the request <code>Content-Type</code> header, or <jk>null</jk> if no matching * reader parser was found, or the matching parser was a reader parser. */ public InputStreamParser getInputStreamParser() { Parser p = getParser(); if (p != null && ! p.isReaderParser()) return (InputStreamParser)p; return null; }
/** * Returns the reader parser matching the request <code>Content-Type</code> header. * * @return * The reader parser matching the request <code>Content-Type</code> header, or <jk>null</jk> if no matching * reader parser was found, or the matching parser was an input stream parser. */ public ReaderParser getReaderParser() { Parser p = getParser(); if (p != null && p.isReaderParser()) return (ReaderParser)p; return null; }
/** * Returns the input stream parser matching the request <code>Content-Type</code> header. * * @return * The input stream parser matching the request <code>Content-Type</code> header, or <jk>null</jk> if no matching * reader parser was found, or the matching parser was a reader parser. */ public InputStreamParser getInputStreamParser() { Parser p = getParser(); if (p != null && ! p.isReaderParser()) return (InputStreamParser)p; return null; }
/** * Returns the input stream parser matching the request <code>Content-Type</code> header. * * @return * The input stream parser matching the request <code>Content-Type</code> header, or <jk>null</jk> if no matching * reader parser was found, or the matching parser was a reader parser. */ public InputStreamParser getInputStreamParser() { Parser p = getParser(); if (p != null && ! p.isReaderParser()) return (InputStreamParser)p; return null; }
if (p != null) { try { if (p.isReaderParser()) return p.parse(new InputStreamReader(is, IOUtils.UTF8), c); return p.parse(is, c);
try (Closeable in = p.isReaderParser() ? new InputStreamReader(is, UTF8) : is) { return p.parse(in, c);
try (Closeable in = p.isReaderParser() ? new InputStreamReader(is, UTF8) : is) { return p.parse(in, c);
try (Closeable in = p.isReaderParser() ? new InputStreamReader(is, UTF8) : is) { return p.parse(in, c);
@Override /* MessageBodyReader */ public Object readFrom(Class<Object> type, Type gType, Annotation[] a, MediaType mediaType, MultivaluedMap<String,String> headers, InputStream in) throws IOException, WebApplicationException { try { String mt = parsers.findMatch(mediaType.toString()); if (mt == null) throw new WebApplicationException(SC_UNSUPPORTED_MEDIA_TYPE); Parser p = parsers.getParser(mt); BeanContext bc = p.getBeanContext(); ClassMeta<?> cm = bc.getClassMeta(gType); ObjectMap mp = getMethodProperties(a); mp.put("mediaType", mediaType.toString()); if (p.isReaderParser()) { ReaderParser p2 = (ReaderParser)p; InputStreamReader r = new InputStreamReader(in, IOUtils.UTF8); ParserSession session = p2.createSession(r, mp, null, null); return p2.parse(session, cm); } InputStreamParser p2 = (InputStreamParser)p; ParserSession session = p2.createSession(in, mp, null, null); return p2.parse(session, cm); } catch (ParseException e) { throw new IOException(e); } } }
try (Closeable in = parser.isReaderParser() ? getReader() : getInputStream()) {
try (Closeable in = parser.isReaderParser() ? getReader() : getInputStream()) {
try (Closeable in = parser.isReaderParser() ? getReader() : getInputStream()) {
try { properties.append("mediaType", mediaType).append("characterEncoding", getCharacterEncoding()); if (! p.isReaderParser()) { InputStreamParser p2 = (InputStreamParser)p; ParserSession session = p2.createSession(getInputStream(), properties, getJavaMethod(), getServlet());