public static ContentType extractRequestContentType(final String contentType) throws ODataUnsupportedMediaTypeException { if (contentType == null || contentType.isEmpty()) { // RFC 2616, 7.2.1: // "Any HTTP/1.1 message containing an entity-body SHOULD include a // Content-Type header field defining the media type of that body. [...] // If the media type remains unknown, the recipient SHOULD treat it // as type "application/octet-stream"." return ContentType.APPLICATION_OCTET_STREAM; } else if (ContentType.isParseable(contentType)) { return ContentType.create(contentType); } else { throw new ODataUnsupportedMediaTypeException( ODataUnsupportedMediaTypeException.NOT_SUPPORTED_CONTENT_TYPE.addContent(contentType)); } }
public static ContentType extractRequestContentType(final String contentType) throws ODataUnsupportedMediaTypeException { if (contentType == null || contentType.isEmpty()) { // RFC 2616, 7.2.1: // "Any HTTP/1.1 message containing an entity-body SHOULD include a // Content-Type header field defining the media type of that body. [...] // If the media type remains unknown, the recipient SHOULD treat it // as type "application/octet-stream"." return ContentType.APPLICATION_OCTET_STREAM; } else if (ContentType.isParseable(contentType)) { return ContentType.create(contentType); } else { throw new ODataUnsupportedMediaTypeException( ODataUnsupportedMediaTypeException.NOT_SUPPORTED_CONTENT_TYPE.addContent(contentType)); } }
public static ContentType extractRequestContentType(final SubLocatorParameter param) throws ODataUnsupportedMediaTypeException { String contentType = getSafeHeader(HttpHeaders.CONTENT_TYPE, param.getHttpHeaders()); if (contentType == null || contentType.isEmpty()) { // RFC 2616, 7.2.1: // "Any HTTP/1.1 message containing an entity-body SHOULD include a // Content-Type header field defining the media type of that body. [...] // If the media type remains unknown, the recipient SHOULD treat it // as type "application/octet-stream"." return ContentType.APPLICATION_OCTET_STREAM; } else if (ContentType.isParseable(contentType)) { return ContentType.create(contentType); } else { throw new ODataUnsupportedMediaTypeException( ODataUnsupportedMediaTypeException.NOT_SUPPORTED_CONTENT_TYPE.addContent(contentType)); } }
public static ContentType extractRequestContentType(final SubLocatorParameter param) throws ODataUnsupportedMediaTypeException { String contentType = getSafeHeader(HttpHeaders.CONTENT_TYPE, param.getHttpHeaders()); if (contentType == null || contentType.isEmpty()) { // RFC 2616, 7.2.1: // "Any HTTP/1.1 message containing an entity-body SHOULD include a // Content-Type header field defining the media type of that body. [...] // If the media type remains unknown, the recipient SHOULD treat it // as type "application/octet-stream"." return ContentType.APPLICATION_OCTET_STREAM; } else if (ContentType.isParseable(contentType)) { return ContentType.create(contentType); } else { throw new ODataUnsupportedMediaTypeException( ODataUnsupportedMediaTypeException.NOT_SUPPORTED_CONTENT_TYPE.addContent(contentType)); } }
public static ContentType extractRequestContentType(final SubLocatorParameter param) throws ODataUnsupportedMediaTypeException { String contentType = getSafeHeader(HttpHeaders.CONTENT_TYPE, param.getHttpHeaders()); if (contentType == null || contentType.isEmpty()) { // RFC 2616, 7.2.1: // "Any HTTP/1.1 message containing an entity-body SHOULD include a // Content-Type header field defining the media type of that body. [...] // If the media type remains unknown, the recipient SHOULD treat it // as type "application/octet-stream"." return ContentType.APPLICATION_OCTET_STREAM; } else if (ContentType.isParseable(contentType)) { return ContentType.create(contentType); } else { throw new ODataUnsupportedMediaTypeException( ODataUnsupportedMediaTypeException.NOT_SUPPORTED_CONTENT_TYPE.addContent(contentType)); } }
throw new ODataUnsupportedMediaTypeException(ODataUnsupportedMediaTypeException.NOT_SUPPORTED .addContent(parsedContentType)); throw new ODataUnsupportedMediaTypeException(ODataUnsupportedMediaTypeException.NOT_SUPPORTED .addContent(parsedContentType));
throw new ODataUnsupportedMediaTypeException(ODataUnsupportedMediaTypeException.NOT_SUPPORTED .addContent(parsedContentType)); throw new ODataUnsupportedMediaTypeException(ODataUnsupportedMediaTypeException.NOT_SUPPORTED .addContent(parsedContentType));
throw new ODataUnsupportedMediaTypeException(ODataUnsupportedMediaTypeException.NOT_SUPPORTED .addContent(parsedContentType)); throw new ODataUnsupportedMediaTypeException(ODataUnsupportedMediaTypeException.NOT_SUPPORTED .addContent(parsedContentType));