Hi John,
Thanks so much. This is exactly what I did to support PATCH server-side and it works like a champ.
Where I'm having difficulties is on the client side testing PATCH using Jersey Test Framework. For the time being I'm using PATCH tunneling over POST via a X-HTTP-Method-Override header (thanks to the list for the needed init params to make it happen). This allows me to test the PATCH handlers on the server, but it seems that for thorough coverage I should have test cases using proper PATCH verbs as well.
Thanks!
From: John Yeary [mailto:johnyeary_at_gmail.com]
Sent: Monday, March 26, 2012 3:54 PM
To: users_at_jersey.java.net
Subject: [Jersey] Re: PATCH support in Jersey Test Framework?
Hello Jeremy,
PATCH is not supported in Jersey. You may write your own method for PATCH.
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@HttpMethod("PATCH")
public @interface PATCH {
}
____________________________
John Yeary
____________________________
NetBeans Dream Team
President Greenville Java Users Group
Java Users Groups Community Leader
Java Enterprise Community Leader
[cid:~WRD000.jpg]
____________________________
[cid:~WRD000.jpg]<
http://javaevangelist.blogspot.com/> [cid:~WRD000.jpg] <
https://twitter.com/jyeary> [cid:~WRD000.jpg] <
http://www.youtube.com/johnyeary> [cid:~WRD000.jpg] <
http://www.linkedin.com/in/jyeary> [cid:~WRD000.jpg] <
https://plus.google.com/112146428878473069965> [cid:~WRD000.jpg] <
http://www.facebook.com/jyeary> [cid:~WRD000.jpg] <
http://feeds.feedburner.com/JavaEvangelistJohnYearysBlog> [cid:~WRD000.jpg] <
http://netbeans.org/people/84414-jyeary>
"Far better it is to dare mighty things, to win glorious triumphs, even though checkered by failure, than to take rank with those poor spirits who neither enjoy much nor suffer much, because they live in the gray twilight that knows not victory nor defeat."
-- Theodore Roosevelt
On Mon, Mar 26, 2012 at 12:40 PM, Jeremy Johnson <jeremy.johnson_at_imtc.gatech.edu<mailto:jeremy.johnson_at_imtc.gatech.edu>> wrote:
Hi folks,
I'm trying to use the Jersey Test Framework v. 1.12 to test a web service that makes use of HTTP PATCH.
I tried calling WebResource.Builder.method( "PATCH", ...) but received the following exception:
com.sun.jersey.api.client.ClientHandlerException: java.net.ProtocolException: Invalid HTTP method: PATCH
Is there a simple solution for getting the Test Framework to play nicely with PATCH?
Thanks,
Jeremy