当我使用下面的代码时,会得到什么情况HttpStatusCodeException
例外 。
ResponseEntity<Object> response =
restTemplate.exchange(builder.build().encode().toUri(), HttpMethod.GET, entity, Object.class);
请问有人可以帮忙吗???????
根据文档,有两种类型HttpStatusCodeException
HttpClientErrorException
and HttpServerErrorException
.
- 前者在收到 HTTP 4xx 时抛出。
- 后者在收到 HTTP 5xx 时抛出。
所以你可以使用 ResponseEntity.BodyBuilder.status(505) 例如来提出HttpServerErrorException
在你的
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)