我有两个servlet:第一个servlet类似于客户机,并创建一个HttpURLConnection
来调用第二个servlet.
我想发送一个特殊的错误,格式类似于JSON对象,所以我用以下方式调用sendError方法:
response.sendError(code, "{json-object}")
But in the first servlet when I read error with getResponseMessage
method I just get standard HTTP message and not my json object as a string.
如何获取json字符串?