本文整理匯總了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();