/** * Returns <jk>true</jk> if this parser can handle the specified content type. * * @param contentType The content type to test. * @return <jk>true</jk> if this parser can handle the specified content type. */ public boolean canHandle(String contentType) { if (contentType != null) for (MediaType mt : getMediaTypes()) if (contentType.equals(mt.toString())) return true; return false; }
/** * Returns <jk>true</jk> if this parser can handle the specified content type. * * @param contentType The content type to test. * @return <jk>true</jk> if this parser can handle the specified content type. */ public boolean canHandle(String contentType) { if (contentType != null) for (MediaType mt : getMediaTypes()) if (contentType.equals(mt.toString())) return true; return false; }
/** * Returns <jk>true</jk> if this parser can handle the specified content type. * * @param contentType The content type to test. * @return <jk>true</jk> if this parser can handle the specified content type. */ public boolean canHandle(String contentType) { if (contentType != null) for (MediaType mt : getMediaTypes()) if (contentType.equals(mt.toString())) return true; return false; }
/** * Constructor. * * @param ps * The modifiable properties that were used to initialize the parsers. * A snapshot of these will be made so that we can clone and modify this group. * @param parsers * The parsers defined in this group. * The order is important because they will be tried in reverse order (e.g. newer first) in which they will be * tried to match against media types. */ public ParserGroup(PropertyStore ps, Parser[] parsers) { super(ps); this.parsers = immutableList(parsers); List<MediaType> lmt = new ArrayList<>(); List<Parser> l = new ArrayList<>(); for (Parser p : parsers) { for (MediaType m: p.getMediaTypes()) { lmt.add(m); l.add(p); } } this.mediaTypes = lmt.toArray(new MediaType[lmt.size()]); this.mediaTypesList = unmodifiableList(lmt); this.mediaTypeParsers = l.toArray(new Parser[l.size()]); }
/** * Constructor. * * @param ps * The modifiable properties that were used to initialize the parsers. * A snapshot of these will be made so that we can clone and modify this group. * @param parsers * The parsers defined in this group. * The order is important because they will be tried in reverse order (e.g. newer first) in which they will be * tried to match against media types. */ public ParserGroup(PropertyStore ps, Parser[] parsers) { super(ps); this.parsers = immutableList(parsers); List<MediaType> lmt = new ArrayList<>(); List<Parser> l = new ArrayList<>(); for (Parser p : parsers) { for (MediaType m: p.getMediaTypes()) { lmt.add(m); l.add(p); } } this.mediaTypes = lmt.toArray(new MediaType[lmt.size()]); this.mediaTypesList = unmodifiableList(lmt); this.mediaTypeParsers = l.toArray(new Parser[l.size()]); }
/** * Constructor. * * @param ps * The modifiable properties that were used to initialize the parsers. * A snapshot of these will be made so that we can clone and modify this group. * @param parsers * The parsers defined in this group. * The order is important because they will be tried in reverse order (e.g. newer first) in which they will be * tried to match against media types. */ public ParserGroup(PropertyStore ps, Parser[] parsers) { super(ps); this.parsers = immutableList(parsers); List<MediaType> lmt = new ArrayList<>(); List<Parser> l = new ArrayList<>(); for (Parser p : parsers) { for (MediaType m: p.getMediaTypes()) { lmt.add(m); l.add(p); } } this.mediaTypes = lmt.toArray(new MediaType[lmt.size()]); this.mediaTypesList = unmodifiableList(lmt); this.mediaTypeParsers = l.toArray(new Parser[l.size()]); }
getResponseHeader("Content-Type"), parser == null ? null : parser.getMediaTypes() );
getResponseHeader("Content-Type"), parser == null ? null : parser.getMediaTypes() );
getResponseHeader("Content-Type"), parser == null ? null : parser.getMediaTypes() );