當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。