本文整理汇总了Java中io.sphere.sdk.http.HttpResponse类的典型用法代码示例。如果您正苦于以下问题:Java HttpResponse类的具体用法?Java HttpResponse怎么用?Java HttpResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HttpResponse类属于io.sphere.sdk.http包,在下文中一共展示了HttpResponse类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserialize
import io.sphere.sdk.http.HttpResponse; //导入依赖的package包/类
@Nullable
@Override
public String deserialize(final HttpResponse httpResponse) {
if (httpResponse.getResponseBody() != null) {
return new String(httpResponse.getResponseBody());
} else {
return "no content";
}
}
示例2: HttpRequestResultImpl
import io.sphere.sdk.http.HttpResponse; //导入依赖的package包/类
public HttpRequestResultImpl(@Nonnull HttpRequest request,
@Nullable HttpResponse response,
@Nullable Throwable throwable) {
this.request = request;
this.response = response;
this.throwable = throwable;
}
开发者ID:commercetools,项目名称:commercetools-payment-integration-java,代码行数:9,代码来源:HttpRequestResultImpl.java
示例3: deserialize
import io.sphere.sdk.http.HttpResponse; //导入依赖的package包/类
@Nullable
@Override
public T deserialize(final HttpResponse httpResponse) {
final JsonNode rootJsonNode = SphereJsonUtils.parse(httpResponse.getResponseBody());
if (rootJsonNode.has("data")) {
final JsonNode data = rootJsonNode.get("data");
if (data.has(fieldName)) {
return SphereJsonUtils.readObject(data.get(fieldName), typeReference);
} else {
throw new GraphQLException("No field " + fieldName + " in response", httpResponse);
}
} else {
throw new GraphQLException("No data found in response", httpResponse);
}
}
示例4: of
import io.sphere.sdk.http.HttpResponse; //导入依赖的package包/类
static HttpRequestResult of(@Nonnull HttpRequest request,
@Nullable HttpResponse response,
@Nullable Throwable throwable) {
return new HttpRequestResultImpl(request, response, throwable);
}
示例5: getResponse
import io.sphere.sdk.http.HttpResponse; //导入依赖的package包/类
@Override
public Optional<HttpResponse> getResponse() {
return ofNullable(this.response);
}
开发者ID:commercetools,项目名称:commercetools-payment-integration-java,代码行数:5,代码来源:HttpRequestResultImpl.java
示例6: GraphQLException
import io.sphere.sdk.http.HttpResponse; //导入依赖的package包/类
public GraphQLException(final String message, final HttpResponse httpResponse) {
super(message + "\n" + httpResponse.toString());
}
示例7: execute
import io.sphere.sdk.http.HttpResponse; //导入依赖的package包/类
@Override
public CompletionStage<HttpResponse> execute(final HttpRequest httpRequest) {
lastUserAgent = httpRequest.getHeaders().getHeader(HttpHeaders.USER_AGENT).stream().findFirst().orElse(null);
return delegate.execute(httpRequest);
}
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:6,代码来源:SunriseSolutionInfoIntegrationTest.java
示例8: getResponse
import io.sphere.sdk.http.HttpResponse; //导入依赖的package包/类
Optional<HttpResponse> getResponse();