Introduce PATCH annotation
The PATCH request as described in RFC 5789 allows partial
updates of a resource in contrast to PUT, which has the
semantics to replace the target resource.
This change introduces an org.restlet annotatition for
implementing PATCH request handlers.
Change-Id: I02ab387695d65b009c4ba8acf15b1ea2a01e0cc0
Signed-off-by: Michael Ochmann <michael.ochmann@sap.com>
diff --git a/org.eclipse.skalli.api/META-INF/MANIFEST.MF b/org.eclipse.skalli.api/META-INF/MANIFEST.MF
index f622547..6c4c9e7 100644
--- a/org.eclipse.skalli.api/META-INF/MANIFEST.MF
+++ b/org.eclipse.skalli.api/META-INF/MANIFEST.MF
@@ -47,6 +47,7 @@
org.osgi.service.jpa,
org.restlet,
org.restlet.data,
+ org.restlet.engine,
org.restlet.representation,
org.restlet.resource,
org.restlet.util,
diff --git a/org.eclipse.skalli.api/src/main/java/org/eclipse/skalli/services/extension/rest/Patch.java b/org.eclipse.skalli.api/src/main/java/org/eclipse/skalli/services/extension/rest/Patch.java
new file mode 100644
index 0000000..baeda17
--- /dev/null
+++ b/org.eclipse.skalli.api/src/main/java/org/eclipse/skalli/services/extension/rest/Patch.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2015 SAP AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.skalli.services.extension.rest;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.restlet.engine.Method;
+import org.restlet.representation.Representation;
+
+/**
+ * Annotation for methods that provide partial resource modification.
+ *
+ * Its semantics is equivalent to HTTP PATCH method described in RFC 5789.
+ * The annotated method must have one {@link Representation entity} parameter.
+ * <p>
+ * Example:
+ *
+ * <pre>
+ * @Patch
+ * public Representation patch(Representation entity);
+ * </pre>
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@Method("PATCH")
+public @interface Patch {
+
+ /**
+ * Specifies the media type extension of the response entity.
+ *
+ * @return The result media types.
+ */
+ String value() default "";
+}