Java – server 415 response code

I'm using jetty web server and Jersey for rest processing

I define:

@POST
@Path("/sendMessage")
@Consumes ({MediaType.APPLICATION_XML,MediaType.TEXT_XML})
public Response sendMessage(@Context final UriInfo uriInfo) 
{
    logger.debug("sendMessage:");
    System.out.println("Received POST!");
    return Response.status(Response.Status.OK).build();

}

However, when I send an HTTP request http: / / localhost: 8080 / HQsim / SendMessage, the server returns a 415 code

It's like not allowing calls How to solve this error?

Solution

415 indicates that the media type is not supported The most likely scenario is that you either lose the content type title in your request or it is wrong In your case, it must be application / XML or text / XML

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>