public AtomEntityProvider(final ContentType contentType) throws EntityProviderException { this(contentType.getODataFormat()); }
/** * * @return <code>true</code> if this {@link ContentType} is text related (in the view of OData) */ public boolean isContentTypeODataTextRelated() { return (ContentType.TEXT_PLAIN.equals(this) || (getODataFormat() == ODataFormat.XML) || (getODataFormat() == ODataFormat.ATOM) || (getODataFormat() == ODataFormat.JSON)); }
/** * * @return <code>true</code> if this {@link ContentType} is text related (in the view of OData) */ public boolean isContentTypeODataTextRelated() { return (ContentType.TEXT_PLAIN.equals(this) || (getODataFormat() == ODataFormat.XML) || (getODataFormat() == ODataFormat.ATOM) || (getODataFormat() == ODataFormat.JSON)); }
/** * * @return <code>true</code> if this {@link ContentType} is text related (in the view of OData) */ public boolean isContentTypeODataTextRelated() { return (ContentType.TEXT_PLAIN.equals(this) || (getODataFormat() == ODataFormat.XML) || (getODataFormat() == ODataFormat.ATOM) || (getODataFormat() == ODataFormat.JSON)); }
/** * Checks if the given list of {@link ContentType}s contains a matching {@link ContentType} for the given * <code>contentType</code> parameter. * @param contentType for which a matching content type is searched * @param allowedContentTypes list against which is checked for possible matching {@link ContentType}s * @return <code>true</code> if a matching content type is in given list, otherwise <code>false</code> */ private static boolean hasMatchingContentType(final ContentType contentType, final List<ContentType> allowedContentTypes) { final ContentType requested = contentType.receiveWithCharsetParameter(ContentNegotiator.DEFAULT_CHARSET); if (requested.getODataFormat() == ODataFormat.CUSTOM || requested.getODataFormat() == ODataFormat.MIME) { return requested.hasCompatible(allowedContentTypes); } return requested.hasMatch(allowedContentTypes); }
/** * Checks if the given list of {@link ContentType}s contains a matching {@link ContentType} for the given * <code>contentType</code> parameter. * @param contentType for which a matching content type is searched * @param allowedContentTypes list against which is checked for possible matching {@link ContentType}s * @return <code>true</code> if a matching content type is in given list, otherwise <code>false</code> */ private static boolean hasMatchingContentType(final ContentType contentType, final List<ContentType> allowedContentTypes) { final ContentType requested = contentType.receiveWithCharsetParameter(ContentNegotiator.DEFAULT_CHARSET); if (requested.getODataFormat() == ODataFormat.CUSTOM || requested.getODataFormat() == ODataFormat.MIME) { return requested.hasCompatible(allowedContentTypes); } return requested.hasMatch(allowedContentTypes); }
/** * Checks if the given list of {@link ContentType}s contains a matching {@link ContentType} for the given * <code>contentType</code> parameter. * @param contentType for which a matching content type is searched * @param allowedContentTypes list against which is checked for possible matching {@link ContentType}s * @return <code>true</code> if a matching content type is in given list, otherwise <code>false</code> */ private static boolean hasMatchingContentType(final ContentType contentType, final List<ContentType> allowedContentTypes) { final ContentType requested = contentType.receiveWithCharsetParameter(ContentNegotiator.DEFAULT_CHARSET); if (requested.getODataFormat() == ODataFormat.CUSTOM || requested.getODataFormat() == ODataFormat.MIME) { return requested.hasCompatible(allowedContentTypes); } return requested.hasMatch(allowedContentTypes); }
private static ContentTypeBasedEntityProvider create(final ContentType contentType) throws EntityProviderException { try { switch (contentType.getODataFormat()) { case ATOM: case XML: return new AtomEntityProvider(contentType.getODataFormat()); case JSON: return new JsonEntityProvider(); default: throw new ODataNotAcceptableException(ODataNotAcceptableException.NOT_SUPPORTED_CONTENT_TYPE .addContent(contentType)); } } catch (final ODataNotAcceptableException e) { throw new EntityProviderException(EntityProviderException.COMMON, e); } }
private ContentTypeBasedSerializer createSerializer(ContentType contentType) throws EntityProviderException { try { switch (contentType.getODataFormat()) { case ATOM: case XML: return new AtomSerializerDeserializer(contentType.getODataFormat()); case JSON: return new JsonSerializerDeserializer(); default: throw new ODataNotAcceptableException(ODataNotAcceptableException.NOT_SUPPORTED_CONTENT_TYPE .addContent(contentType)); } } catch (final ODataNotAcceptableException e) { throw new EntityProviderException(EntityProviderException.COMMON, e); } }
private static ContentTypeBasedEntityProvider create(final ContentType contentType) throws EntityProviderException { try { switch (contentType.getODataFormat()) { case ATOM: case XML: return new AtomEntityProvider(contentType.getODataFormat()); case JSON: return new JsonEntityProvider(); default: throw new ODataNotAcceptableException(ODataNotAcceptableException.NOT_SUPPORTED_CONTENT_TYPE .addContent(contentType)); } } catch (final ODataNotAcceptableException e) { throw new EntityProviderException(EntityProviderException.COMMON, e); } }
private static ContentTypeBasedEntityProvider create(final ContentType contentType) throws EntityProviderException { try { switch (contentType.getODataFormat()) { case ATOM: case XML: return new AtomEntityProvider(contentType.getODataFormat()); case JSON: return new JsonEntityProvider(); default: throw new ODataNotAcceptableException(ODataNotAcceptableException.NOT_SUPPORTED_CONTENT_TYPE .addContent(contentType)); } } catch (final ODataNotAcceptableException e) { throw new EntityProviderException(EntityProviderException.COMMON, e); } }
private ContentTypeBasedDeserializer createDeserializer(ContentType contentType) throws EntityProviderException { try { switch (contentType.getODataFormat()) { case ATOM: case XML: return new AtomSerializerDeserializer(contentType.getODataFormat()); case JSON: return new JsonSerializerDeserializer(); default: throw new ODataNotAcceptableException(ODataNotAcceptableException.NOT_SUPPORTED_CONTENT_TYPE .addContent(contentType)); } } catch (final ODataNotAcceptableException e) { throw new EntityProviderException(EntityProviderException.COMMON, e); } }