簡體   English   中英

服務器415響應代碼

[英]Server 415 Response code

我正在使用Jetty Web服務器和Jersey進行REST處理。

我定義了:

@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();

}

但是,當我發送http請求http://localhost:8080/hqsim/sendMessage ,服務器返回415代碼。

這就像是不允許通話。 我該如何解決這個錯誤?

415表示不支持媒體類型。 最可能的情況是您在請求中缺少Content-Type標頭,或者它不正確。 在您的情況下,它必須是application/xmltext/xml

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM