0
我試圖發送一個請求,我這樣做的捲曲以下幾點:捲曲JSON +餅乾+頭PARAMS +新澤西
curl -v --header "location: 60.004:8.456" --cookie "sessionToken=~session" -i -X PUT -H 'Content-Type: application/json' -d '{"data":"{"FCT":"Welcome", "Uni":"Welcome to DI"}"}' localhost:8080/tester/apps/e39/data
,由於某種原因它的類,但沒有這種方法匹配:
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createDocumentRoot(JSONObject inputJsonObj,
@Context UriInfo ui, @Context HttpHeaders hh) {
}
編輯: 類與@Path(「{APPID} /數據」)
這個問題不狀態的路徑,我已經調試它和看到它標識類權定義它只是在goi之後拋出不好的要求不需要輸入任何方法。
這裏是捲曲詳細:
* About to connect() to localhost port 8080 (#0)
* Trying 127.0.0.1... connected
> PUT /tester/apps/e39/data HTTP/1.1
> User-Agent: curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost:8080
> Accept: */*
> Cookie: sessionToken=~session
> location: 60.004:8.456
> Content-Type: application/json
> Content-Length: 60
>
* upload completely sent off: 60out of 60 bytes
< HTTP/1.1 400 Bad Request
HTTP/1.1 400 Bad Request
< Server: Apache-Coyote/1.1
Server: Apache-Coyote/1.1
< Content-Type: text/html;charset=utf-8
Content-Type: text/html;charset=utf-8
< Content-Length: 990
Content-Length: 990
< Date: Tue, 02 Jul 2013 21:46:56 GMT
Date: Tue, 02 Jul 2013 21:46:56 GMT
< Connection: close
Connection: close
很難說,沒有看到類和方法上的'@ Path'註解。請你能提供更多的代碼嗎? – jgm
添加了捲曲和其他一些信息。問題不在於Path註釋,而在於http請求內容與方法的匹配。 – HeWhoCodes
謝謝jgm,你是最善良的。問題出在json中,寫得不對,我會寫一個答案,讓人和我一樣困惑。 – HeWhoCodes