从Jersey REST客户端调用时出现405错误代码 [英] 405 error code while calling from Jersey REST client
本文介绍了从Jersey REST客户端调用时出现405错误代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在请求放置操作,执行请求后,我将重定向到GET服务URL.这里,我面临着405 HTTP错误代码的问题.但是,对于POST操作,相同的代码对我有用.
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. However, same code works for me in the case of POST operation.
下面的代码是EndPoint:
Below code is 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();
}
请让我知道如何解决此问题.
Please let me know how I can resolve this.
推荐答案
在该问题中,我认为您可以找到答案: 放置后休息信息
In that question I think you can find the answer: PUT-POST Rest Information
这篇关于从Jersey REST客户端调用时出现405错误代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文