users@jersey.java.net

Re: How to do partial updates or PATCH with Jersey

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 29 Feb 2008 12:21:37 +0100

Hi Martin,

Martin Grotzke wrote:
> Hi,
>
> I want to provide partial updates for a resource. I only read about
> partial updates and the PATCH method until now, without having tried one
> of both.
>
> Are there any experiences / suggestions regarding the implementation of
> such a functionality with jsr311/jersey?
>

It is easy to define the @PATCH annotation :-)

   @Target({ElementType.METHOD})
   @Retention(RetentionPolicy.RUNTIME)
   @HttpMethod("PATCH")
   public @interface PATCH {
   }

then i think there need to be appropriate message body readers
supporting Java types for PATCH representations. IMHO that is the tricky
part of PATCH, what exactly should be the diff format. James Snell has
some good blogs on the subject [1]. An XQuery approach could be
interesting. You might be able to use the nux API [2] for that.

Paul.

[1] http://www.snellspace.com/wp/?cat=45
[2] http://dsd.lbl.gov/nux/

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109