/** * Same as {@link #getParserMatch(MediaType)} but returns just the matched parser. * * @param mediaType The HTTP media type. * @return The parser that matched the media type, or <jk>null</jk> if no match was made. */ public Parser getParser(MediaType mediaType) { ParserMatch pm = getParserMatch(mediaType); return pm == null ? null : pm.getParser(); }
/** * Returns the parser matching the request <code>Content-Type</code> header. * * @return * The parser matching the request <code>Content-Type</code> header, or <jk>null</jk> if no matching parser was * found. */ public Parser getParser() { ParserMatch pm = getParserMatch(); return (pm == null ? null : pm.getParser()); }
/** * Same as {@link #getParserMatch(String)} but returns just the matched parser. * * @param contentTypeHeader The HTTP <l>Content-Type</l> header string. * @return The parser that matched the content type header, or <jk>null</jk> if no match was made. */ public Parser getParser(String contentTypeHeader) { ParserMatch pm = getParserMatch(contentTypeHeader); return pm == null ? null : pm.getParser(); }
/** * Same as {@link #getParserMatch(String)} but returns just the matched parser. * * @param contentTypeHeader The HTTP <l>Content-Type</l> header string. * @return The parser that matched the content type header, or <jk>null</jk> if no match was made. */ public Parser getParser(String contentTypeHeader) { ParserMatch pm = getParserMatch(contentTypeHeader); return pm == null ? null : pm.getParser(); }
/** * Same as {@link #getParserMatch(String)} but returns just the matched parser. * * @param contentTypeHeader The HTTP <l>Content-Type</l> header string. * @return The parser that matched the content type header, or <jk>null</jk> if no match was made. */ public Parser getParser(String contentTypeHeader) { ParserMatch pm = getParserMatch(contentTypeHeader); return pm == null ? null : pm.getParser(); }
/** * Returns the parser matching the request <code>Content-Type</code> header. * * @return * The parser matching the request <code>Content-Type</code> header, or <jk>null</jk> if no matching parser was * found. */ public Parser getParser() { ParserMatch pm = getParserMatch(); return (pm == null ? null : pm.getParser()); }
/** * Returns the parser matching the request <code>Content-Type</code> header. * * @return * The parser matching the request <code>Content-Type</code> header, or <jk>null</jk> if no matching parser was * found. */ public Parser getParser() { ParserMatch pm = getParserMatch(); return (pm == null ? null : pm.getParser()); }
/** * Same as {@link #getParserMatch(MediaType)} but returns just the matched parser. * * @param mediaType The HTTP media type. * @return The parser that matched the media type, or <jk>null</jk> if no match was made. */ public Parser getParser(MediaType mediaType) { ParserMatch pm = getParserMatch(mediaType); return pm == null ? null : pm.getParser(); }
/** * Same as {@link #getParserMatch(MediaType)} but returns just the matched parser. * * @param mediaType The HTTP media type. * @return The parser that matched the media type, or <jk>null</jk> if no match was made. */ public Parser getParser(MediaType mediaType) { ParserMatch pm = getParserMatch(mediaType); return pm == null ? null : pm.getParser(); }
@Override /* MessageBodyReader */ public Object readFrom(Class<Object> type, Type gType, Annotation[] a, MediaType mediaType, MultivaluedMap<String,String> headers, InputStream in) throws IOException, WebApplicationException { try { ParserMatch pm = parsers.getParserMatch(mediaType.toString()); if (pm == null) throw new WebApplicationException(SC_UNSUPPORTED_MEDIA_TYPE); Parser p = pm.getParser(); ObjectMap mp = getMethodProperties(a); mp.put("mediaType", mediaType.toString()); Locale locale = getLocale(headers); TimeZone timeZone = getTimeZone(headers); ParserSession session = p.createSession(new ParserSessionArgs(mp, null, locale, timeZone, pm.getMediaType(), null, null, null)); Object in2 = session.isReaderParser() ? new InputStreamReader(in, UTF8) : in; return session.parse(in2, p.getClassMeta(gType)); } catch (ParseException e) { throw new IOException(e); } }
@Override /* MessageBodyReader */ public Object readFrom(Class<Object> type, Type gType, Annotation[] a, MediaType mediaType, MultivaluedMap<String,String> headers, InputStream in) throws IOException, WebApplicationException { try { ParserMatch pm = parsers.getParserMatch(mediaType.toString()); if (pm == null) throw new WebApplicationException(SC_UNSUPPORTED_MEDIA_TYPE); Parser p = pm.getParser(); ObjectMap mp = getMethodProperties(a); mp.put("mediaType", mediaType.toString()); Locale locale = getLocale(headers); TimeZone timeZone = getTimeZone(headers); ParserSession session = p.createSession(new ParserSessionArgs(mp, null, locale, timeZone, pm.getMediaType(), null, null, null)); Object in2 = session.isReaderParser() ? new InputStreamReader(in, UTF8) : in; return session.parse(in2, p.getClassMeta(gType)); } catch (ParseException e) { throw new IOException(e); } }
Parser p = pm.getParser(); MediaType mediaType = pm.getMediaType(); req.getProperties().append("mediaType", mediaType).append("characterEncoding", req.getCharacterEncoding());
Parser p = pm.getParser(); MediaType mediaType = pm.getMediaType(); req.getProperties().append("mediaType", mediaType).append("characterEncoding", req.getCharacterEncoding());
Parser p = pm.getParser(); MediaType mediaType = pm.getMediaType(); req.getProperties().append("mediaType", mediaType).append("characterEncoding", req.getCharacterEncoding());