/** * Check if a valid match for this {@link ContentType} exists in given list. * For more detail what a valid match is see {@link #match(List)}. * * @param toMatchContentTypes list of {@link ContentType}s which are matches against this {@link ContentType} * @return <code>true</code> if a matching content type was found in given list * or <code>false</code> if none matching content type match was found */ public boolean hasMatch(final List<ContentType> toMatchContentTypes) { return match(toMatchContentTypes) != null; }
/** * Check if a valid match for this {@link ContentType} exists in given list. * For more detail what a valid match is see {@link #match(List)}. * * @param toMatchContentTypes list of {@link ContentType}s which are matches against this {@link ContentType} * @return <code>true</code> if a matching content type was found in given list * or <code>false</code> if none matching content type match was found */ public boolean hasMatch(final List<ContentType> toMatchContentTypes) { return match(toMatchContentTypes) != null; }
/** * Check if a valid match for this {@link ContentType} exists in given list. * For more detail what a valid match is see {@link #match(List)}. * * @param toMatchContentTypes list of {@link ContentType}s which are matches against this {@link ContentType} * @return <code>true</code> if a matching content type was found in given list * or <code>false</code> if none matching content type match was found */ public boolean hasMatch(final List<ContentType> toMatchContentTypes) { return match(toMatchContentTypes) != null; }
ContentType contentNegotiation(final List<ContentType> acceptedContentTypes, final List<ContentType> supportedContentTypes) throws ODataException { final Set<ContentType> setSupported = new HashSet<ContentType>(supportedContentTypes); if (acceptedContentTypes.isEmpty()) { if (!setSupported.isEmpty()) { return supportedContentTypes.get(0); } } else { for (ContentType contentType : acceptedContentTypes) { contentType = ensureCharset(contentType); final ContentType match = contentType.match(supportedContentTypes); if (match != null) { return match; } } } throw new ODataNotAcceptableException(ODataNotAcceptableException.NOT_SUPPORTED_ACCEPT_HEADER .addContent(acceptedContentTypes.toString())); }
ContentType contentNegotiation(final List<ContentType> acceptedContentTypes, final List<ContentType> supportedContentTypes) throws ODataException { final Set<ContentType> setSupported = new HashSet<ContentType>(supportedContentTypes); if (acceptedContentTypes.isEmpty()) { if (!setSupported.isEmpty()) { return supportedContentTypes.get(0); } } else { for (ContentType contentType : acceptedContentTypes) { contentType = ensureCharset(contentType); final ContentType match = contentType.match(supportedContentTypes); if (match != null) { return match; } } } throw new ODataNotAcceptableException(ODataNotAcceptableException.NOT_SUPPORTED_ACCEPT_HEADER .addContent(acceptedContentTypes.toString())); }
ContentType contentNegotiation(final List<ContentType> acceptedContentTypes, final List<ContentType> supportedContentTypes) throws ODataException { final Set<ContentType> setSupported = new HashSet<ContentType>(supportedContentTypes); if (acceptedContentTypes.isEmpty()) { if (!setSupported.isEmpty()) { return supportedContentTypes.get(0); } } else { for (ContentType contentType : acceptedContentTypes) { contentType = ensureCharset(contentType); final ContentType match = contentType.match(supportedContentTypes); if (match != null) { return match; } } } throw new ODataNotAcceptableException(ODataNotAcceptableException.NOT_SUPPORTED_ACCEPT_HEADER .addContent(acceptedContentTypes.toString())); }