org.apache.http.HttpResponse.getLocale()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(298)

本文整理了Java中org.apache.http.HttpResponse.getLocale()方法的一些代码示例,展示了HttpResponse.getLocale()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpResponse.getLocale()方法的具体详情如下:
包路径:org.apache.http.HttpResponse
类名称:HttpResponse
方法名:getLocale

HttpResponse.getLocale介绍

[英]Obtains the locale of this response. The locale is used to determine the reason phrase for the #setStatusCode. It can be changed using #setLocale.
[中]获取此响应的区域设置。区域设置用于确定#setStatusCode的原因短语。可以使用#setLocale对其进行更改。

代码示例

代码示例来源:origin: rest-assured/rest-assured

public Locale getLocale() {
  return responseBase.getLocale();
}

代码示例来源:origin: com.jayway.restassured/rest-assured

public Locale getLocale() {
  return responseBase.getLocale();
}

代码示例来源:origin: ibinti/bugvm

@Override
public Locale getLocale() {
  return original.getLocale();
}

代码示例来源:origin: com.bugvm/bugvm-rt

@Override
public Locale getLocale() {
  return original.getLocale();
}

代码示例来源:origin: com.hynnet/httpclient

@Override
public Locale getLocale() {
  return original.getLocale();
}

代码示例来源:origin: com.agapsys.libs/servlet-testing-framework

/** @return the locale of the response. */
public Locale getLocale() {
  return coreResponse.getLocale();
}

代码示例来源:origin: org.esigate/esigate-core

@Override
public Locale getLocale() {
  return httpResponse.getLocale();
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

@Override
public Locale getLocale() {
  return original.getLocale();
}

代码示例来源:origin: Nextdoor/bender

@Override
public Locale getLocale() {
  return original.getLocale();
}

代码示例来源:origin: org.codehaus.groovy.modules.http-builder/http-builder

public Locale getLocale() {
  return responseBase.getLocale();
}

代码示例来源:origin: com.github.paweladamski/HttpClientMock

public Locale getLocale() {
  return this.original.getLocale();
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient

public Locale getLocale() {
  return original.getLocale();
}

代码示例来源:origin: org.apache.httpcomponents/httpclient-android

public Locale getLocale() {
  return original.getLocale();
}

代码示例来源:origin: jgritman/httpbuilder

public Locale getLocale() {
  return responseBase.getLocale();
}

代码示例来源:origin: opencast/opencast

@Override public Locale getLocale() {
 return response.getLocale();
}

代码示例来源:origin: baidubce/bce-sdk-java

public Locale getLocale() {
  return original.getLocale();
}

代码示例来源:origin: com.jkoolcloud/jesl

/**
 * {@inheritDoc}
 */
@Override
public Locale getLocale() {
  return (response != null ? response.getLocale() : super.getLocale());
}

代码示例来源:origin: horrorho/InflatableDonkey

@Override
public T handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
  locale = response.getLocale();
  protocolVersion = response.getProtocolVersion();
  statusLine = response.getStatusLine();
  headers = Arrays.asList(response.getAllHeaders())
      .stream()
      .collect(groupingBy(header -> header.getName().toLowerCase(Locale.US)));
  return responseHandler.handleResponse(response);
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-netflix-ribbon

public HttpClientStatusCodeException(String serviceId, HttpResponse response, HttpEntity entity, URI uri) throws IOException {
  super(serviceId, response.getStatusLine().getStatusCode(), response, uri);
  this.response = new BasicHttpResponse(response.getStatusLine());
  this.response.setLocale(response.getLocale());
  this.response.setStatusCode(response.getStatusLine().getStatusCode());
  this.response.setReasonPhrase(response.getStatusLine().getReasonPhrase());
  this.response.setHeaders(response.getAllHeaders());
  EntityUtils.updateEntity(this.response, entity);
}

代码示例来源:origin: org.apache.camel/camel-olingo2-api

public static HttpStatusCodes checkStatus(HttpResponse response) throws ODataApplicationException {
  final StatusLine statusLine = response.getStatusLine();
  HttpStatusCodes httpStatusCode = HttpStatusCodes.fromStatusCode(statusLine.getStatusCode());
  if (400 <= httpStatusCode.getStatusCode() && httpStatusCode.getStatusCode() <= 599) {
    if (response.getEntity() != null) {
      try {
        final ContentType responseContentType = getContentTypeHeader(response);
        final String mimeType = responseContentType.getMimeType();
        if (ODATA_MIME_TYPE.matcher(mimeType).matches()) {
          final ODataErrorContext errorContext = EntityProvider.readErrorDocument(
            response.getEntity().getContent(),
            responseContentType.toString());
          throw new ODataApplicationException(errorContext.getMessage(),
            errorContext.getLocale(), httpStatusCode, errorContext.getErrorCode(),
            errorContext.getException());
        }
      } catch (EntityProviderException e) {
        throw new ODataApplicationException(e.getMessage(), response.getLocale(), httpStatusCode, e);
      } catch (IOException e) {
        throw new ODataApplicationException(e.getMessage(), response.getLocale(), httpStatusCode, e);
      }
    }
    throw new ODataApplicationException(statusLine.getReasonPhrase(), response.getLocale(), httpStatusCode);
  }
  return httpStatusCode;
}

相关文章