本文整理了Java中io.sphere.sdk.http.HttpResponse.withoutRequest()
方法的一些代码示例,展示了HttpResponse.withoutRequest()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpResponse.withoutRequest()
方法的具体详情如下:
包路径:io.sphere.sdk.http.HttpResponse
类名称:HttpResponse
方法名:withoutRequest
暂无
代码示例来源:origin: commercetools/commercetools-jvm-sdk
public void setUnderlyingHttpResponse(final HttpResponse httpResponse) {
this.httpResponse = httpResponse.withoutRequest();
}
代码示例来源:origin: io.sphere.sdk.jvm/common
public void setUnderlyingHttpResponse(final HttpResponse httpResponse) {
this.httpResponse = Optional.of(httpResponse.withoutRequest());
}
}
代码示例来源:origin: io.sphere.jvmsdk/java-client
@Override
public T apply(final HttpResponse httpResponse) {
final SphereInternalLogger logger = getLogger(httpResponse);
logger.debug(() -> httpResponse.withoutRequest());
logger.trace(() -> httpResponse.getStatusCode() + "\n" + JsonUtils.prettyPrintJsonStringSecure(httpResponse.getResponseBody()) + "\n");
final int status = httpResponse.getStatusCode();
final String body = httpResponse.getResponseBody();
final boolean hasError = status / 100 != 2;
if (hasError) {
SphereErrorResponse errorResponse;
try {
if (Strings.isNullOrEmpty(body)) {//the /model/id endpoint does not return JSON on 404
errorResponse = new SphereErrorResponse(status, "<no body>", Collections.<SphereError>emptyList());
} else {
errorResponse = objectMapper.readValue(body, errorResponseJsonTypeRef);
}
} catch (final Exception e) {
// This can only happen when the backend and SDK don't match.
final SphereException exception = new SphereException("Can't parse backend response", e);
fillExceptionWithData(httpResponse, exception, clientRequest);
throw exception;
}
final SphereBackendException exception = new SphereBackendException(clientRequest.httpRequest().getPath(), errorResponse);
fillExceptionWithData(httpResponse, exception, clientRequest);
throw exception;
} else {
return underlying.apply(httpResponse);
}
}
};
内容来源于网络,如有侵权,请联系作者删除!