private ContentType mapFormat(final UriInfoImpl uriInfo) { final String format = uriInfo.getFormat(); if (URI_INFO_FORMAT_XML.equals(format)) { return ContentType.APPLICATION_XML; } else if (URI_INFO_FORMAT_ATOM.equals(format)) { if (uriInfo.getUriType() == UriType.URI0) { // special handling for serviceDocument uris (UriType.URI0) return ContentType.APPLICATION_ATOM_SVC; } else if (uriInfo.getUriType() == UriType.URI1) { return ContentType.APPLICATION_ATOM_XML_FEED; } else if (uriInfo.getUriType() == UriType.URI2 || uriInfo.getUriType() == UriType.URI10) { return ContentType.APPLICATION_ATOM_XML_ENTRY; } } else if (URI_INFO_FORMAT_JSON.equals(format)) { return ContentType.APPLICATION_JSON; } return ContentType.createAsCustom(format); }
private ContentType mapFormat(final UriInfoImpl uriInfo) { final String format = uriInfo.getFormat(); if (URI_INFO_FORMAT_XML.equals(format)) { return ContentType.APPLICATION_XML; } else if (URI_INFO_FORMAT_ATOM.equals(format)) { if (uriInfo.getUriType() == UriType.URI0) { // special handling for serviceDocument uris (UriType.URI0) return ContentType.APPLICATION_ATOM_SVC; } else if (uriInfo.getUriType() == UriType.URI1) { return ContentType.APPLICATION_ATOM_XML_FEED; } else if (uriInfo.getUriType() == UriType.URI2 || uriInfo.getUriType() == UriType.URI10) { return ContentType.APPLICATION_ATOM_XML_ENTRY; } } else if (URI_INFO_FORMAT_JSON.equals(format)) { return ContentType.APPLICATION_JSON; } return ContentType.createAsCustom(format); }
private ContentType mapFormat(final UriInfoImpl uriInfo) { final String format = uriInfo.getFormat(); if (URI_INFO_FORMAT_XML.equals(format)) { return ContentType.APPLICATION_XML; } else if (URI_INFO_FORMAT_ATOM.equals(format)) { if (uriInfo.getUriType() == UriType.URI0) { // special handling for serviceDocument uris (UriType.URI0) return ContentType.APPLICATION_ATOM_SVC; } else if (uriInfo.getUriType() == UriType.URI1) { return ContentType.APPLICATION_ATOM_XML_FEED; } else if (uriInfo.getUriType() == UriType.URI2) { return ContentType.APPLICATION_ATOM_XML_ENTRY; } } else if (URI_INFO_FORMAT_JSON.equals(format)) { return ContentType.APPLICATION_JSON; } return ContentType.createAsCustom(format); }
private static void checkProperty(final ODataHttpMethod method, final UriInfoImpl uriInfo) throws ODataException { if ((uriInfo.getUriType() == UriType.URI4 || uriInfo.getUriType() == UriType.URI5) && (isPropertyKey(uriInfo) || method == ODataHttpMethod.DELETE && !isPropertyNullable(getProperty(uriInfo)))) { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } }
private static void checkProperty(final ODataHttpMethod method, final UriInfoImpl uriInfo) throws ODataException { if ((uriInfo.getUriType() == UriType.URI4 || uriInfo.getUriType() == UriType.URI5) && (isPropertyKey(uriInfo) || method == ODataHttpMethod.DELETE && !isPropertyNullable(getProperty(uriInfo)))) { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } }
private static void checkProperty(final ODataHttpMethod method, final UriInfoImpl uriInfo) throws ODataException { if ((uriInfo.getUriType() == UriType.URI4 || uriInfo.getUriType() == UriType.URI5) && (isPropertyKey(uriInfo) || method == ODataHttpMethod.DELETE && !isPropertyNullable(getProperty(uriInfo)))) { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } }
private List<String> getSupportedContentTypes(final UriInfoImpl uriInfo, final ODataHttpMethod method) throws ODataException { Class<? extends ODataProcessor> processorFeature = Dispatcher.mapUriTypeToProcessorFeature(uriInfo); if (ODataHttpMethod.POST.equals(method)) { UriType uriType = uriInfo.getUriType(); if (uriType == UriType.URI1 || uriType == UriType.URI6B) { processorFeature = EntityProcessor.class; } } return service.getSupportedContentTypes(processorFeature); }
/** * A modifying request that targets an entity with enabled concurrency control * must contain at least one concurrency-control HTTP request header field. */ private static void checkConditions(final ODataHttpMethod method, final UriInfoImpl uriInfo, final String ifMatch, final String ifNoneMatch, final String ifModifiedSince, final String ifUnmodifiedSince) throws ODataException { if ((method == ODataHttpMethod.PUT || method == ODataHttpMethod.PATCH || method == ODataHttpMethod.MERGE || method == ODataHttpMethod.DELETE) && ifMatch == null && ifNoneMatch == null && ifModifiedSince == null && ifUnmodifiedSince == null && Arrays.asList(UriType.URI2, UriType.URI6A, UriType.URI3, UriType.URI4, UriType.URI5, UriType.URI17) .contains(uriInfo.getUriType()) && hasConcurrencyControl(uriInfo.getTargetEntitySet().getEntityType())) { throw new ODataPreconditionRequiredException(ODataPreconditionRequiredException.COMMON); } }
private static void checkNumberOfNavigationSegments(final UriInfoImpl uriInfo) throws ODataException { switch (uriInfo.getUriType()) { case URI1: case URI6B: case URI7A: case URI7B: if (uriInfo.getNavigationSegments().size() > 1) { throw new ODataBadRequestException(ODataBadRequestException.NOTSUPPORTED); } break; case URI3: case URI4: case URI5: case URI17: if (!uriInfo.getNavigationSegments().isEmpty()) { throw new ODataBadRequestException(ODataBadRequestException.NOTSUPPORTED); } break; default: break; } }
private List<String> getSupportedContentTypes(final UriInfoImpl uriInfo, final ODataHttpMethod method) throws ODataException { Class<? extends ODataProcessor> processorFeature = Dispatcher.mapUriTypeToProcessorFeature(uriInfo); UriType uriType = uriInfo.getUriType(); // if (uriType == UriType.URI11) { processorFeature = EntitySetProcessor.class; } else if ((uriType == UriType.URI10)) { processorFeature = EntityProcessor.class; } else if (ODataHttpMethod.POST.equals(method)) { if (uriType == UriType.URI1 || uriType == UriType.URI6B) { processorFeature = EntityProcessor.class; } } return service.getSupportedContentTypes(processorFeature); }
private List<String> getSupportedContentTypes(final UriInfoImpl uriInfo, final ODataHttpMethod method) throws ODataException { Class<? extends ODataProcessor> processorFeature = Dispatcher.mapUriTypeToProcessorFeature(uriInfo); UriType uriType = uriInfo.getUriType(); // if (uriType == UriType.URI11) { processorFeature = EntitySetProcessor.class; } else if ((uriType == UriType.URI10)) { processorFeature = EntityProcessor.class; } else if (ODataHttpMethod.POST.equals(method)) { if (uriType == UriType.URI1 || uriType == UriType.URI6B) { processorFeature = EntityProcessor.class; } } return service.getSupportedContentTypes(processorFeature); }
private static void checkNumberOfNavigationSegments(final UriInfoImpl uriInfo) throws ODataException { switch (uriInfo.getUriType()) { case URI1: case URI6B: case URI7A: case URI7B: if (uriInfo.getNavigationSegments().size() > 1) { throw new ODataBadRequestException(ODataBadRequestException.NOTSUPPORTED); } break; case URI3: case URI4: case URI5: case URI17: if (!uriInfo.getNavigationSegments().isEmpty()) { throw new ODataBadRequestException(ODataBadRequestException.NOTSUPPORTED); } break; default: break; } }
private static void checkNumberOfNavigationSegments(final UriInfoImpl uriInfo) throws ODataException { switch (uriInfo.getUriType()) { case URI1: case URI6B: case URI7A: case URI7B: if (uriInfo.getNavigationSegments().size() > 1) { throw new ODataBadRequestException(ODataBadRequestException.NOTSUPPORTED); } break; case URI3: case URI4: case URI5: case URI17: if (!uriInfo.getNavigationSegments().isEmpty()) { throw new ODataBadRequestException(ODataBadRequestException.NOTSUPPORTED); } break; default: break; } }
private void checkSystemQueryOptionsCompatibility() throws UriSyntaxException { final UriType uriType = uriResult.getUriType(); for (SystemQueryOption queryOption : systemQueryOptions.keySet()) { if (queryOption == SystemQueryOption.$format && (uriType == UriType.URI4 || uriType == UriType.URI5) && uriResult.isValue()) { throw new UriSyntaxException(UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION.addContent(queryOption)); } if (!uriType.isCompatible(queryOption)) { throw new UriSyntaxException(UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION.addContent(queryOption)); } } }
private void checkSystemQueryOptionsCompatibility() throws UriSyntaxException { final UriType uriType = uriResult.getUriType(); for (SystemQueryOption queryOption : systemQueryOptions.keySet()) { if (queryOption == SystemQueryOption.$format && (uriType == UriType.URI4 || uriType == UriType.URI5) && uriResult.isValue()) { throw new UriSyntaxException(UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION.addContent(queryOption)); } if (!uriType.isCompatible(queryOption)) { throw new UriSyntaxException(UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION.addContent(queryOption)); } } }
private void checkSystemQueryOptionsCompatibility() throws UriSyntaxException { final UriType uriType = uriResult.getUriType(); for (SystemQueryOption queryOption : systemQueryOptions.keySet()) { if (queryOption == SystemQueryOption.$format && (uriType == UriType.URI4 || uriType == UriType.URI5) && uriResult.isValue()) { throw new UriSyntaxException(UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION.addContent(queryOption)); } if (!uriType.isCompatible(queryOption)) { throw new UriSyntaxException(UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION.addContent(queryOption)); } } }
/** * A modifying request that targets an entity with enabled concurrency control * must contain at least one concurrency-control HTTP request header field. */ private static void checkConditions(final ODataHttpMethod method, final UriInfoImpl uriInfo, final String ifMatch, final String ifNoneMatch, final String ifModifiedSince, final String ifUnmodifiedSince) throws ODataException { if ((method == ODataHttpMethod.PUT || method == ODataHttpMethod.PATCH || method == ODataHttpMethod.MERGE || method == ODataHttpMethod.DELETE) && ifMatch == null && ifNoneMatch == null && ifModifiedSince == null && ifUnmodifiedSince == null && checkUriType(uriInfo.getUriType()) && hasConcurrencyControl(uriInfo.getTargetEntitySet().getEntityType())) { throw new ODataPreconditionRequiredException(ODataPreconditionRequiredException.COMMON); } }
/** * A modifying request that targets an entity with enabled concurrency control * must contain at least one concurrency-control HTTP request header field. */ private static void checkConditions(final ODataHttpMethod method, final UriInfoImpl uriInfo, final String ifMatch, final String ifNoneMatch, final String ifModifiedSince, final String ifUnmodifiedSince) throws ODataException { if ((method == ODataHttpMethod.PUT || method == ODataHttpMethod.PATCH || method == ODataHttpMethod.MERGE || method == ODataHttpMethod.DELETE) && ifMatch == null && ifNoneMatch == null && ifModifiedSince == null && ifUnmodifiedSince == null && checkUriType(uriInfo.getUriType()) && hasConcurrencyControl(uriInfo.getTargetEntitySet().getEntityType())) { throw new ODataPreconditionRequiredException(ODataPreconditionRequiredException.COMMON); } }
return ContentType.TEXT_PLAIN_CS_UTF_8; } else if (uriInfo.isValue()) { if (uriInfo.getUriType() == UriType.URI5 || uriInfo.getUriType() == UriType.URI4) { return ContentType.TEXT_PLAIN_CS_UTF_8;
return ContentType.TEXT_PLAIN_CS_UTF_8; } else if (uriInfo.isValue()) { if (uriInfo.getUriType() == UriType.URI5 || uriInfo.getUriType() == UriType.URI4) { return ContentType.TEXT_PLAIN_CS_UTF_8;