I`m trying to request to web-service by jersey client:
WebResource service = client.resource(UriBuilder.fromUri("http://localhost:8080/jersey-example-new/").build());
System.out.println(service.path("rs/").path("account/details/1").accept(MediaType.APPLICATION_JSON).get(String.class));
but I get:
GET http://localhost:8080/jersey-example-new/rs/account/details/1 returned a response status of 406 Not Acceptable
Please, note that url path http://localhost:8080/jersey-example-new/rs/account/details/1
works in browser. What is wrong with java client request?
the endpoint code:
@Path("account")
public class AccountDetailsService {
@GET
@Path("/details/{param}")
@Produces(MediaType.TEXT_PLAIN)
public Response getAccountDetails(@PathParam("param") String accountName) {
String output = "Account Name : " + accountName;
return Response.status(200).entity(output).build();
}
}