PatrikStas
2015-08-20 09:46:47 UTC
Hi everyone !
I've been trying to get the @PATCH method get working for a while now but
with not further success.
I've noticed it haven't been present in CXF 3.0.2, but been added to CXF
3.1.2 into the package package org.apache.cxf.jaxrs.ext; ( it's missing in
documnetation tho )
When I try to use PATCH method to call my service, I get
*
Caused by: java.net.ProtocolException: Invalid HTTP method: PATCH
at java.net.HttpURLConnection.setRequestMethod(HttpURLConnection.java:428)*
The setRequestMethod is looking for methodn name in statically defined list
of methods, defined as
*
private static final String[] methods = {
"GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "TRACE"
};*
And since it doesn't find PATCH, it throws
*
throw new ProtocolException("Invalid HTTP method: " + method);*
Browsing forums and mailing lists, I found these posts here :
http://comments.gmane.org/gmane.comp.apache.cxf.user/25919
Saying I can use async transport and then the PATCH should work
* String address = "http://localhost:" + PORT +
"/bookstore/retrieve";
WebClient wc = WebClient.create(address);
WebClient.getConfig(wc).getRequestContext().put("use.async.http.conduit",
true);
Book book = wc.invoke("RETRIEVE", null, Book.class);*
However, even if I try to call my service like this, it's still failing.
Moreover even if this would work, I find it a bit hacky. Why is PATCH not
supported, if it's been added to CXF ?
I have other services working properly, the only service which are throwing
this exception are the ones annotated with @PATCH.
What is the problem ?
Thanks a lot in advance for any tips !
Patrik
--
View this message in context: http://cxf.547215.n5.nabble.com/PATCH-Method-is-failing-tp5760309.html
Sent from the cxf-user mailing list archive at Nabble.com.
I've been trying to get the @PATCH method get working for a while now but
with not further success.
I've noticed it haven't been present in CXF 3.0.2, but been added to CXF
3.1.2 into the package package org.apache.cxf.jaxrs.ext; ( it's missing in
documnetation tho )
When I try to use PATCH method to call my service, I get
*
Caused by: java.net.ProtocolException: Invalid HTTP method: PATCH
at java.net.HttpURLConnection.setRequestMethod(HttpURLConnection.java:428)*
The setRequestMethod is looking for methodn name in statically defined list
of methods, defined as
*
private static final String[] methods = {
"GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "TRACE"
};*
And since it doesn't find PATCH, it throws
*
throw new ProtocolException("Invalid HTTP method: " + method);*
Browsing forums and mailing lists, I found these posts here :
http://comments.gmane.org/gmane.comp.apache.cxf.user/25919
Saying I can use async transport and then the PATCH should work
* String address = "http://localhost:" + PORT +
"/bookstore/retrieve";
WebClient wc = WebClient.create(address);
WebClient.getConfig(wc).getRequestContext().put("use.async.http.conduit",
true);
Book book = wc.invoke("RETRIEVE", null, Book.class);*
However, even if I try to call my service like this, it's still failing.
Moreover even if this would work, I find it a bit hacky. Why is PATCH not
supported, if it's been added to CXF ?
I have other services working properly, the only service which are throwing
this exception are the ones annotated with @PATCH.
What is the problem ?
Thanks a lot in advance for any tips !
Patrik
--
View this message in context: http://cxf.547215.n5.nabble.com/PATCH-Method-is-failing-tp5760309.html
Sent from the cxf-user mailing list archive at Nabble.com.