当前位置: 首页>>代码示例>>Java>>正文


Java HttpResponse类代码示例

本文整理汇总了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";
    }
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java-training,代码行数:10,代码来源:MySphereRequest.java

示例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);
    }
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:16,代码来源:SingleGraphQLRequest.java

示例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);
}
 
开发者ID:commercetools,项目名称:commercetools-payment-integration-java,代码行数:6,代码来源:HttpRequestResult.java

示例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());
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:4,代码来源:GraphQLException.java

示例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(); 
开发者ID:commercetools,项目名称:commercetools-payment-integration-java,代码行数:2,代码来源:HttpRequestResult.java


注:本文中的io.sphere.sdk.http.HttpResponse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。