I have a knitwear project and one question with a beginner. From the server side:
throw new WebApplicationException(Response.status(Status.NOT_FOUND) .entity("no access token found").build());
On the client side
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; }
Problem
java.lang.ClassCastException: org.glassfish.jersey.client.HttpUrlConnector$1 cannot be cast to java.lang.String
Why can't I get a client-side error string? Is this the correct (String) response.getEntity () for this?
source share