1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
catch (WebApplicationException
e){ LOGGER.error( "webapplicationexception:
" +e.getResponse().getStatus()); //这一行是获取status
code InputStream
in = (InputStream) e.getResponse().getEntity(); //这个输入流中包含了所有的文本信息是关于error
message的 byte []
buffer; try { buffer= new byte [in.available()]; in
length; //打开输入流并且读取,最终将其中的内容拼成字符串 while ((length
= in.read(buffer, 0 ,buffer.length))
!= - 1 ){ output= new String(buffer, "UTF-8" ); } } catch (IOException
ex){ LOGGER.error(ex.getMessage()); } } ... |
关于用 apache cxf中对于不是返回200错误的处理 ,获取错误描述文本的方法
最新推荐文章于 2021-04-03 11:47:30 发布