本文整理了Java中org.apache.olingo.odata2.api.exception.ODataBadRequestException.<init>()
方法的一些代码示例,展示了ODataBadRequestException.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ODataBadRequestException.<init>()
方法的具体详情如下:
包路径:org.apache.olingo.odata2.api.exception.ODataBadRequestException
类名称:ODataBadRequestException
方法名:<init>
暂无
代码示例来源:origin: org.apache.olingo/olingo-odata2-core-incubating
public static <T> InputStream contentAsStream(final T content) throws ODataException {
if (content == null) {
throw new ODataBadRequestException(ODataBadRequestException.COMMON);
}
InputStream inputStream;
if (content instanceof InputStream) {
inputStream = (InputStream) content;
} else if (content instanceof String) {
try {
inputStream = new ByteArrayInputStream(((String) content).getBytes("UTF-8"));
} catch (final UnsupportedEncodingException e) {
throw new ODataBadRequestException(ODataBadRequestException.COMMON, e);
}
} else {
throw new ODataBadRequestException(ODataBadRequestException.COMMON);
}
return inputStream;
}
代码示例来源:origin: com.sap.cloud.servicesdk/odata-v2-lib
public static <T> InputStream contentAsStream(final T content) throws ODataException {
if (content == null) {
throw new ODataBadRequestException(ODataBadRequestException.COMMON);
}
InputStream inputStream;
if (content instanceof InputStream) {
inputStream = (InputStream) content;
} else if (content instanceof String) {
try {
inputStream = new ByteArrayInputStream(((String) content).getBytes("UTF-8"));
} catch (final UnsupportedEncodingException e) {
throw new ODataBadRequestException(ODataBadRequestException.COMMON, e);
}
} else {
throw new ODataBadRequestException(ODataBadRequestException.COMMON);
}
return inputStream;
}
代码示例来源:origin: org.apache.olingo/olingo-odata2-core
/**
* Validates that <code>dollar format query/syntax</code> is correct for further processing.
* If some validation error occurs an exception is thrown.
*
* @param uriInfo
* @throws ODataBadRequestException
*/
private void validateFormatQuery(final UriInfoImpl uriInfo) throws ODataBadRequestException {
if (uriInfo.isValue()) {
throw new ODataBadRequestException(ODataBadRequestException.INVALID_SYNTAX);
}
}
代码示例来源:origin: com.sap.cloud.servicesdk/odata-v2-lib
/**
* Validates that <code>dollar format query/syntax</code> is correct for further processing.
* If some validation error occurs an exception is thrown.
*
* @param uriInfo
* @throws ODataBadRequestException
*/
private void validateFormatQuery(final UriInfoImpl uriInfo) throws ODataBadRequestException {
if (uriInfo.isValue()) {
throw new ODataBadRequestException(ODataBadRequestException.INVALID_SYNTAX);
}
}
代码示例来源:origin: com.sap.cloud.servicesdk.prov/odata-core
@Override
public ODataResponse existsEntity(GetEntityCountUriInfo uriInfo,String contentType) throws ODataBadRequestException {
ODataBadRequestException exception = new ODataBadRequestException(ODataBadRequestException.COMMON);
LoggerFactory.getLogger(GenericODataProcessor.class).error(exception.getMessage(), exception);
throw exception;
}
代码示例来源:origin: org.apache.olingo/olingo-odata2-core-incubating
/**
* Validates that <code>dollar format query/syntax</code> is correct for further processing.
* If some validation error occurs an exception is thrown.
*
* @param uriInfo
* @throws ODataBadRequestException
*/
private void validateFormatQuery(final UriInfoImpl uriInfo) throws ODataBadRequestException {
if (uriInfo.isValue()) {
throw new ODataBadRequestException(ODataBadRequestException.INVALID_SYNTAX);
}
}
代码示例来源:origin: org.apache.olingo/olingo-odata2-core
private List<ContentType> extractAcceptHeaders(final List<String> acceptHeaderValues)
throws ODataBadRequestException {
final List<ContentType> mediaTypes = new ArrayList<ContentType>();
if (acceptHeaderValues != null) {
for (final String mediaType : acceptHeaderValues) {
try {
mediaTypes.add(ContentType.create(mediaType.toString()));
} catch (IllegalArgumentException e) {
throw new ODataBadRequestException(ODataBadRequestException.INVALID_HEADER.addContent("Accept")
.addContent(mediaType.toString()), e);
}
}
}
return mediaTypes;
}
代码示例来源:origin: com.sap.cloud.servicesdk/odata-v2-lib
private List<ContentType> extractAcceptHeaders(final List<String> acceptHeaderValues)
throws ODataBadRequestException {
final List<ContentType> mediaTypes = new ArrayList<ContentType>();
if (acceptHeaderValues != null) {
for (final String mediaType : acceptHeaderValues) {
try {
mediaTypes.add(ContentType.create(mediaType.toString()));
} catch (IllegalArgumentException e) {
throw new ODataBadRequestException(ODataBadRequestException.INVALID_HEADER.addContent("Accept")
.addContent(mediaType.toString()), e);
}
}
}
return mediaTypes;
}
代码示例来源:origin: org.apache.olingo/olingo-odata2-core-incubating
private List<ContentType> extractAcceptHeaders(final List<String> acceptHeaderValues)
throws ODataBadRequestException {
final List<ContentType> mediaTypes = new ArrayList<ContentType>();
if (acceptHeaderValues != null) {
for (final String mediaType : acceptHeaderValues) {
try {
mediaTypes.add(ContentType.create(mediaType.toString()));
} catch (IllegalArgumentException e) {
throw new ODataBadRequestException(ODataBadRequestException.INVALID_HEADER.addContent("Accept")
.addContent(mediaType.toString()), e);
}
}
}
return mediaTypes;
}
代码示例来源:origin: org.apache.olingo/olingo-odata2-core-incubating
private static void validateDataServiceVersion(final String serverDataServiceVersion,
final String requestDataServiceVersion) throws ODataException {
if (requestDataServiceVersion != null) {
try {
final boolean isValid = ODataServiceVersion.validateDataServiceVersion(requestDataServiceVersion);
if (!isValid || ODataServiceVersion.isBiggerThan(requestDataServiceVersion, serverDataServiceVersion)) {
throw new ODataBadRequestException(ODataBadRequestException.VERSIONERROR.addContent(requestDataServiceVersion
.toString()));
}
} catch (final IllegalArgumentException e) {
throw new ODataBadRequestException(ODataBadRequestException.PARSEVERSIONERROR
.addContent(requestDataServiceVersion), e);
}
}
}
代码示例来源:origin: com.sap.cloud.servicesdk/odata-v2-lib
private static void validateDataServiceVersion(final String serverDataServiceVersion,
final String requestDataServiceVersion) throws ODataException {
if (requestDataServiceVersion != null) {
try {
final boolean isValid = ODataServiceVersion.validateDataServiceVersion(requestDataServiceVersion);
if (!isValid || ODataServiceVersion.isBiggerThan(requestDataServiceVersion, serverDataServiceVersion)) {
throw new ODataBadRequestException(ODataBadRequestException.VERSIONERROR
.addContent(requestDataServiceVersion));
}
} catch (final IllegalArgumentException e) {
throw new ODataBadRequestException(ODataBadRequestException.PARSEVERSIONERROR
.addContent(requestDataServiceVersion), e);
}
}
}
代码示例来源:origin: org.apache.olingo/olingo-odata2-core
private static void validateDataServiceVersion(final String serverDataServiceVersion,
final String requestDataServiceVersion) throws ODataException {
if (requestDataServiceVersion != null) {
try {
final boolean isValid = ODataServiceVersion.validateDataServiceVersion(requestDataServiceVersion);
if (!isValid || ODataServiceVersion.isBiggerThan(requestDataServiceVersion, serverDataServiceVersion)) {
throw new ODataBadRequestException(ODataBadRequestException.VERSIONERROR
.addContent(requestDataServiceVersion));
}
} catch (final IllegalArgumentException e) {
throw new ODataBadRequestException(ODataBadRequestException.PARSEVERSIONERROR
.addContent(requestDataServiceVersion), e);
}
}
}
代码示例来源:origin: org.apache.olingo/olingo-odata2-annotation-processor-core
private ODataEntry parseEntry(final EdmEntitySet entitySet, final InputStream content,
final String requestContentType, final EntityProviderReadProperties properties) throws ODataBadRequestException {
ODataContext context = getContext();
final int timingHandle = context.startRuntimeMeasurement("EntityConsumer", "readEntry");
ODataEntry entryValues;
try {
entryValues = EntityProvider.readEntry(requestContentType, entitySet, content, properties);
} catch (final EntityProviderException e) {
throw new ODataBadRequestException(ODataBadRequestException.BODY, e);
}
context.stopRuntimeMeasurement(timingHandle);
return entryValues;
}
代码示例来源:origin: io.cronapp/olingo-odata2-annotation-processor-core
private ODataEntry parseEntry(final EdmEntitySet entitySet, final InputStream content,
final String requestContentType, final EntityProviderReadProperties properties) throws ODataBadRequestException {
ODataContext context = getContext();
final int timingHandle = context.startRuntimeMeasurement("EntityConsumer", "readEntry");
ODataEntry entryValues;
try {
entryValues = EntityProvider.readEntry(requestContentType, entitySet, content, properties);
} catch (final EntityProviderException e) {
throw new ODataBadRequestException(ODataBadRequestException.BODY, e);
}
context.stopRuntimeMeasurement(timingHandle);
return entryValues;
}
代码示例来源:origin: org.apache.olingo/olingo-odata2-jpa-processor-core
public final ODataEntry parseEntry(final EdmEntitySet entitySet,
final InputStream content, final String requestContentType, final boolean merge)
throws ODataBadRequestException {
ODataEntry entryValues;
try {
EntityProviderReadProperties entityProviderProperties =
EntityProviderReadProperties.init().mergeSemantic(merge).build();
entryValues = EntityProvider.readEntry(requestContentType, entitySet, content, entityProviderProperties);
} catch (EntityProviderException e) {
throw new ODataBadRequestException(ODataBadRequestException.BODY, e);
}
return entryValues;
}
代码示例来源:origin: org.apache.olingo/olingo-odata2-annotation-processor-core-incubating
private ODataEntry parseEntry(final EdmEntitySet entitySet, final InputStream content,
final String requestContentType, final EntityProviderReadProperties properties) throws ODataBadRequestException {
ODataContext context = getContext();
final int timingHandle = context.startRuntimeMeasurement("EntityConsumer", "readEntry");
ODataEntry entryValues;
try {
entryValues = EntityProvider.readEntry(requestContentType, entitySet, content, properties);
} catch (final EntityProviderException e) {
throw new ODataBadRequestException(ODataBadRequestException.BODY, e);
}
context.stopRuntimeMeasurement(timingHandle);
return entryValues;
}
代码示例来源:origin: org.apache.olingo/olingo-odata2-annotation-processor-core-incubating
private Map<String, Object> parseLink(final EdmEntitySet entitySet, final InputStream content,
final String contentType) throws ODataException {
ODataContext context = getContext();
final int timingHandle = context.startRuntimeMeasurement("EntityProvider", "readLink");
final String uriString = EntityProvider.readLink(contentType, entitySet, content);
context.stopRuntimeMeasurement(timingHandle);
final Map<String, Object> targetKeys = parseLinkUri(entitySet, uriString);
if (targetKeys == null) {
throw new ODataBadRequestException(ODataBadRequestException.BODY);
}
return targetKeys;
}
代码示例来源:origin: io.cronapp/olingo-odata2-annotation-processor-core
private Map<String, Object> parseLink(final EdmEntitySet entitySet, final InputStream content,
final String contentType) throws ODataException {
ODataContext context = getContext();
final int timingHandle = context.startRuntimeMeasurement("EntityProvider", "readLink");
final String uriString = EntityProvider.readLink(contentType, entitySet, content);
context.stopRuntimeMeasurement(timingHandle);
final Map<String, Object> targetKeys = parseLinkUri(entitySet, uriString);
if (targetKeys == null) {
throw new ODataBadRequestException(ODataBadRequestException.BODY);
}
return targetKeys;
}
代码示例来源:origin: org.apache.olingo/olingo-odata2-annotation-processor-core
private Map<String, Object> parseLink(final EdmEntitySet entitySet, final InputStream content,
final String contentType) throws ODataException {
ODataContext context = getContext();
final int timingHandle = context.startRuntimeMeasurement("EntityProvider", "readLink");
final String uriString = EntityProvider.readLink(contentType, entitySet, content);
context.stopRuntimeMeasurement(timingHandle);
final Map<String, Object> targetKeys = parseLinkUri(entitySet, uriString);
if (targetKeys == null) {
throw new ODataBadRequestException(ODataBadRequestException.BODY);
}
return targetKeys;
}
代码示例来源:origin: com.sap.cloud.servicesdk.prov/odata-core
private void initializeContext(ODataContext context, PathInfoExtractor pathInfoExtractor, IServiceInfo gwService) throws ODataException {
if (pathInfoExtractor.isMultiOrigin() && pathInfoExtractor.hasOrigin()) {
// combination of both is not supported
ODataBadRequestException exception = new ODataBadRequestException(ODataBadRequestException.NOTSUPPORTED);
log.error(exception.getMessage(), exception);
gwLogger.logErrors(GatewayLogMessage.CoreRtMultiOriginAndOriginNotSupp, exception.getMessage(), exception.getMessage());
throw exception;
}
if (pathInfoExtractor.isMultiOrigin()) {
context.setParameter(ContextConstants.MULTI_ORIGIN, Boolean.TRUE);
} else if (pathInfoExtractor.hasOrigin()) {
String origin = pathInfoExtractor.getOrigin();
origin = DestinationInfoUtil.getDestinationForSid(origin, gwService, context);
context.setParameter(ContextConstants.ORIGIN, origin);
}
}
内容来源于网络,如有侵权,请联系作者删除!