public static boolean isSupported(final ContentType contentType, final CustomContentTypeSupport customContentTypeSupport, final RepresentationType representationType) throws ContentNegotiatorException { for (ContentType supportedContentType : getSupportedContentTypes(customContentTypeSupport, representationType)) { if (AcceptType.fromContentType(supportedContentType).get(0).matches(contentType)) { return true; } } return false; } }
public static boolean isSupported(final ContentType contentType, final CustomContentTypeSupport customContentTypeSupport, final RepresentationType representationType) throws ContentNegotiatorException { for (ContentType supportedContentType : getSupportedContentTypes(customContentTypeSupport, representationType)) { if (AcceptType.fromContentType(supportedContentType).get(0).matches(contentType)) { return true; } } return false; } }
public static void checkSupport(final ContentType contentType, final CustomContentTypeSupport customContentTypeSupport, final RepresentationType representationType) throws ContentNegotiatorException { for (ContentType supportedContentType : getSupportedContentTypes(customContentTypeSupport, representationType)) { if (AcceptType.fromContentType(supportedContentType).get(0).matches(contentType)) { return; } } throw new ContentNegotiatorException("unsupported content type: " + contentType, ContentNegotiatorException.MessageKeys.UNSUPPORTED_CONTENT_TYPE, contentType.toContentTypeString()); }
public static void checkSupport(final ContentType contentType, final CustomContentTypeSupport customContentTypeSupport, final RepresentationType representationType) throws ContentNegotiatorException { for (ContentType supportedContentType : getSupportedContentTypes(customContentTypeSupport, representationType)) { if (AcceptType.fromContentType(supportedContentType).get(0).matches(contentType)) { return; } } throw new ContentNegotiatorException("unsupported content type: " + contentType, ContentNegotiatorException.MessageKeys.UNSUPPORTED_CONTENT_TYPE, contentType.toContentTypeString()); }
List<AcceptType> formatTypes = null; try { formatTypes = AcceptType.fromContentType(contentType == null ? ContentType.create(formatOption.getFormat()) : contentType); } catch (final IllegalArgumentException e) { charsets = getAcceptCharset(acceptCharset); final ContentType requestedContentType = getDefaultSupportedContentTypes(representationType).get(0); result = getAcceptedType(AcceptType.fromContentType(requestedContentType), supportedContentTypes, charsets);
List<AcceptType> formatTypes = null; try { formatTypes = AcceptType.fromContentType(contentType == null ? ContentType.create(formatOption.getFormat()) : contentType); } catch (final IllegalArgumentException e) { charsets = getAcceptCharset(acceptCharset); final ContentType requestedContentType = getDefaultSupportedContentTypes(representationType).get(0); result = getAcceptedType(AcceptType.fromContentType(requestedContentType), supportedContentTypes, charsets);