簡體   English   中英

從Jersey REST客戶端調用時出現405錯誤代碼

[英]405 error code while calling from Jersey REST client

我正在請求put操作,並在請求執行后我重定向到GET服務URL。在這里,我面臨405 HTTP錯誤代碼的問題。 但是,在POST操作的情況下,相同的代碼適用於我。

下面的代碼是EndPoint:

@PUT
@Produces({ MediaType.APPLICATION_JSON })
public Response put(InputStream objInputStream) {
    // System.out.println("AckService.put()");

    String strOutput = "";
    Status objStatus = Status.OK;
    URI objRedirectionURI = null;

    try {
            this.submitRequest(objInputStream);
            objRedirectionURI = new URI("https://local.test.com:8443/Reply/fetch");
            System.err.println("\n\nredirecting the put request...... to get operation\n\n");
            return Response.seeOther(objRedirectionURI).build();

    } catch (Exception e) {
        e.printStackTrace();
        objStatus = Status.INTERNAL_SERVER_ERROR;
    }


}

客戶:

ClientResponse response = null;   
 try {
    response = objWebResource.accept(MediaType.APPLICATION_JSON)
                    .type(MediaType.APPLICATION_JSON)
                    .put(ClientResponse.class, strInputData);

}catch (Exception e) {
    blnIsOk = false;
if(null != e.getMessage())
    lstExceptionMessage.add(e.getMessage());
e.printStackTrace();

}

請讓我知道如何解決這個問題。

在那個問題上,我認為你可以找到答案: PUT-POST休息信息

暫無
暫無

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

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