1

RESTを使用してnetbeans/JavaでPOSTメソッドを構築しようとしています。なんらかの理由で、このコードは呼び出されたときにエラーを返し続けます。何かアイデアはありますか?

@POST
@Path("findByImage")
public String findByImage() {
    return "hello";
}

次のエラーが返されます。

タイプ例外レポート

メッセージ

説明サーバーで内部エラー () が発生したため、この要求を実行できませんでした。

例外

javax.ws.rs.WebApplicationException: java.lang.IllegalArgumentException: Error parsing media type ', application/xml'
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1.2 logs.
4

1 に答える 1

0

間違った'Content-Type'ヘッダー('、application / xml')を使用してPOSTリクエストを送信すると、このエラーが発生します。たとえば、次のコマンドで再現できます。

curl -i -X POST -H "Content-Type: , application/xml" http://localhost:8080/jsfDemo/resources/testing/findByImage
于 2013-02-05T11:05:03.460 に答える