简体   繁体   English

从Jersey REST客户端调用时出现405错误代码

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

I am requesting for put operation and after request performed I am redirecting to GET service URL.Here, I am facing the issue of 405 HTTP error code. 我正在请求put操作,并在请求执行后我重定向到GET服务URL。在这里,我面临405 HTTP错误代码的问题。 However, same code works for me in the case of POST operation. 但是,在POST操作的情况下,相同的代码适用于我。

Below code is EndPoint: 下面的代码是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;
    }


}

Client: 客户:

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

} }

Please let me know how I can resolve this. 请让我知道如何解决这个问题。

在那个问题上,我认为你可以找到答案: PUT-POST休息信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM