当前位置: 首页>>代码示例>>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;未经允许,请勿转载。