我有一个球衣休息项目和一个新手问题。从服务器端:
throw new WebApplicationException(Response.status(Status.NOT_FOUND)
.entity("no access token found").build());
从客户端
else if (Status.fromStatusCode(response.getStatus()) == Status.NOT_FOUND || Status.fromStatusCode(response.getStatus()) == Status.GONE)
{
final VerifyTokenResponse verifyTokenResponse = new VerifyTokenResponse();
verifyTokenResponse.setError((String) response.getEntity());
return verifyTokenResponse;
}
问题是
java.lang.ClassCastException: org.glassfish.jersey.client.HttpUrlConnector$1 cannot be cast to java.lang.String
为什么我无法在客户端获取错误字符串?这是正确的(字符串) response.getEntity() 吗?