當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpClientErrorException.getMessage方法代碼示例

本文整理匯總了Java中org.springframework.web.client.HttpClientErrorException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpClientErrorException.getMessage方法的具體用法?Java HttpClientErrorException.getMessage怎麽用?Java HttpClientErrorException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.web.client.HttpClientErrorException的用法示例。


在下文中一共展示了HttpClientErrorException.getMessage方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import org.springframework.web.client.HttpClientErrorException; //導入方法依賴的package包/類
@Override
protected RestResponsePage<Approval> run() throws Exception {
  try {
    ParameterizedTypeReference<RestResponsePage<Approval>>
        responsetype =
        new ParameterizedTypeReference<RestResponsePage<Approval>>() {
        };
    ResponseEntity<RestResponsePage<Approval>>
        result =
        restTemplate
            .exchange(uriBuilder.build().encode().toUri(), HttpMethod.POST,
                new HttpEntity<>(approvalFilters), responsetype);
    return result.getBody();
  } catch (HttpClientErrorException exception) {
    throw new HystrixBadRequestException(exception.getMessage(),
        new HttpBadRequestException(ErrorResponse.getErrorResponse(exception), exception));
  }
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:19,代碼來源:GetFilteredApprovalsCommand.java

示例2: toResponse

import org.springframework.web.client.HttpClientErrorException; //導入方法依賴的package包/類
@Override
public Response toResponse(HttpClientErrorException exception) {
    RestError error = new RestError(
            exception.getMessage(),
            exception.getMessage(),
            ErrorMap.from(new String(exception.getResponseBodyAsByteArray(), StandardCharsets.UTF_8)),
            exception.getStatusCode().value());
    return Response.status(exception.getStatusCode().value()).type(MediaType.APPLICATION_JSON_TYPE).entity(error).build();
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:10,代碼來源:HttpClientErrorExceptionMapper.java

示例3: run

import org.springframework.web.client.HttpClientErrorException; //導入方法依賴的package包/類
@Override
protected LocationResponseModel run() throws Exception {
  URI url = JerseyUriBuilder.fromUri(LocationConstants.URL).build();
  HttpEntity<LocationRequestModel> request = new HttpEntity<LocationRequestModel>(model, headers);
  try {
    ResponseEntity<LocationResponseModel>
        entity =
        restClient.postForEntity(url, request, LocationResponseModel.class);
    return entity.getBody();
  } catch (HttpClientErrorException exception) {
    throw new HystrixBadRequestException(exception.getMessage(),
        new HttpBadRequestException(ErrorResponse.getErrorResponse(exception), exception));
  }
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:15,代碼來源:GetLocationCommand.java

示例4: run

import org.springframework.web.client.HttpClientErrorException; //導入方法依賴的package包/類
@Override
protected CreateApprovalResponse run() throws Exception {
  URI link = JerseyUriBuilder.fromUri(url).build();
  try {
    ResponseEntity<CreateApprovalResponse>
        entity =
        restTemplate.postForEntity(link, request, CreateApprovalResponse.class);
    return entity.getBody();
  } catch (HttpClientErrorException exception) {
    throw new HystrixBadRequestException(exception.getMessage(),
        new HttpBadRequestException(ErrorResponse.getErrorResponse(exception), exception));
  }
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:14,代碼來源:CreateApprovalCommand.java

示例5: run

import org.springframework.web.client.HttpClientErrorException; //導入方法依賴的package包/類
@Override
protected CreateApprovalResponse run() throws Exception {
  try {
    return restTemplate.getForEntity(path, CreateApprovalResponse.class, approvalId).getBody();
  } catch (HttpClientErrorException exception) {
    throw new HystrixBadRequestException(exception.getMessage(),
        new HttpBadRequestException(ErrorResponse.getErrorResponse(exception), exception));
  }

}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:11,代碼來源:GetApprovalCommand.java

示例6: run

import org.springframework.web.client.HttpClientErrorException; //導入方法依賴的package包/類
@Override
protected String run() throws Exception {
  try {
    restTemplate.put(path, request, approvalId);
    return approvalId;
  } catch (HttpClientErrorException exception) {
    throw new HystrixBadRequestException(exception.getMessage(),
        new HttpBadRequestException(ErrorResponse.getErrorResponse(exception), exception));
  }
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:11,代碼來源:UpdateApprovalStatusCommand.java

示例7: httpClientErrorException

import org.springframework.web.client.HttpClientErrorException; //導入方法依賴的package包/類
@ExceptionHandler(value = HttpClientErrorException.class)
public ResponseEntity<Object> httpClientErrorException(HttpClientErrorException exception) {
    logger.error(exception.getMessage(), exception);
    return new ResponseEntity<>(exception.getMessage(), new HttpHeaders(),
        HttpStatus.valueOf(exception.getRawStatusCode()));
}
 
開發者ID:hmcts,項目名稱:cmc-claim-store,代碼行數:7,代碼來源:ResourceExceptionHandler.java

示例8: Request

import org.springframework.web.client.HttpClientErrorException; //導入方法依賴的package包/類
@ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Bad Request (most likely the token is invalid)")
@ExceptionHandler(HttpClientErrorException.class)
public String handleHttpClientErrorException(HttpClientErrorException e) {
    return e.getMessage();
}
 
開發者ID:redhat-developer,項目名稱:che-starter,代碼行數:6,代碼來源:GlobalExceptionHandler.java


注:本文中的org.springframework.web.client.HttpClientErrorException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。