Skip to content

Commit 247af3d

Browse files
committed
Use JAX-RS PATCH annotation (#834)
Resolves #828
1 parent 3b7a5c2 commit 247af3d

File tree

11 files changed

+11
-7
lines changed

11 files changed

+11
-7
lines changed

core/http/src/main/java/org/trellisldp/http/TrellisHttpFilter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import static java.util.Collections.unmodifiableList;
2121
import static javax.ws.rs.HttpMethod.DELETE;
2222
import static javax.ws.rs.HttpMethod.GET;
23+
import static javax.ws.rs.HttpMethod.PATCH;
2324
import static javax.ws.rs.HttpMethod.POST;
2425
import static javax.ws.rs.HttpMethod.PUT;
2526
import static javax.ws.rs.Priorities.AUTHORIZATION;

core/http/src/main/java/org/trellisldp/http/TrellisHttpResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import javax.ws.rs.NotAcceptableException;
4040
import javax.ws.rs.NotFoundException;
4141
import javax.ws.rs.OPTIONS;
42+
import javax.ws.rs.PATCH;
4243
import javax.ws.rs.POST;
4344
import javax.ws.rs.PUT;
4445
import javax.ws.rs.Path;
@@ -66,7 +67,6 @@
6667
import org.trellisldp.api.Metadata;
6768
import org.trellisldp.api.RDFFactory;
6869
import org.trellisldp.api.Resource;
69-
import org.trellisldp.http.core.PATCH;
7070
import org.trellisldp.http.core.ServiceBundler;
7171
import org.trellisldp.http.core.TrellisExtensions;
7272
import org.trellisldp.http.core.TrellisRequest;

core/http/src/main/java/org/trellisldp/http/core/HttpConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public final class HttpConstants {
107107
public static final String ORIGINAL = "original";
108108

109109
/** The name of the HTTP verb used to update resources. */
110+
@Deprecated
110111
public static final String PATCH = "PATCH";
111112

112113
/** The name of the HTTP response code for a Precondition Required error. */

core/http/src/main/java/org/trellisldp/http/core/PATCH.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@
2727
/**
2828
* PATCH HTTP method.
2929
*
30+
* @deprecated Please use {@link javax.ws.rs.PATCH} instead.
3031
* @author acoburn
3132
*/
3233
@Target(value = METHOD)
3334
@Retention(value = RUNTIME)
3435
@HttpMethod(value = "PATCH")
3536
@Documented
37+
@Deprecated
3638
public @interface PATCH {
3739
}

core/http/src/main/java/org/trellisldp/http/impl/GetHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import static javax.ws.rs.HttpMethod.GET;
2828
import static javax.ws.rs.HttpMethod.HEAD;
2929
import static javax.ws.rs.HttpMethod.OPTIONS;
30+
import static javax.ws.rs.HttpMethod.PATCH;
3031
import static javax.ws.rs.HttpMethod.POST;
3132
import static javax.ws.rs.HttpMethod.PUT;
3233
import static javax.ws.rs.core.HttpHeaders.ACCEPT;
@@ -46,7 +47,6 @@
4647
import static org.trellisldp.http.core.HttpConstants.ACCEPT_RANGES;
4748
import static org.trellisldp.http.core.HttpConstants.DESCRIPTION;
4849
import static org.trellisldp.http.core.HttpConstants.MEMENTO_DATETIME;
49-
import static org.trellisldp.http.core.HttpConstants.PATCH;
5050
import static org.trellisldp.http.core.HttpConstants.PREFER;
5151
import static org.trellisldp.http.core.HttpConstants.PREFERENCE_APPLIED;
5252
import static org.trellisldp.http.core.HttpConstants.RANGE;

core/http/src/main/java/org/trellisldp/http/impl/OptionsHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import static javax.ws.rs.HttpMethod.GET;
2424
import static javax.ws.rs.HttpMethod.HEAD;
2525
import static javax.ws.rs.HttpMethod.OPTIONS;
26+
import static javax.ws.rs.HttpMethod.PATCH;
2627
import static javax.ws.rs.HttpMethod.POST;
2728
import static javax.ws.rs.HttpMethod.PUT;
2829
import static javax.ws.rs.core.HttpHeaders.ALLOW;
@@ -32,7 +33,6 @@
3233
import static org.slf4j.LoggerFactory.getLogger;
3334
import static org.trellisldp.http.core.HttpConstants.ACCEPT_PATCH;
3435
import static org.trellisldp.http.core.HttpConstants.ACCEPT_POST;
35-
import static org.trellisldp.http.core.HttpConstants.PATCH;
3636
import static org.trellisldp.http.core.RdfMediaType.APPLICATION_SPARQL_UPDATE;
3737

3838
import java.util.List;

core/http/src/main/java/org/trellisldp/http/impl/PostHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static javax.ws.rs.HttpMethod.GET;
2222
import static javax.ws.rs.HttpMethod.HEAD;
2323
import static javax.ws.rs.HttpMethod.OPTIONS;
24+
import static javax.ws.rs.HttpMethod.PATCH;
2425
import static javax.ws.rs.HttpMethod.PUT;
2526
import static javax.ws.rs.core.MediaType.APPLICATION_OCTET_STREAM;
2627
import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
@@ -33,7 +34,6 @@
3334
import static org.trellisldp.api.Resource.SpecialResources.DELETED_RESOURCE;
3435
import static org.trellisldp.api.Resource.SpecialResources.MISSING_RESOURCE;
3536
import static org.trellisldp.api.TrellisUtils.TRELLIS_DATA_PREFIX;
36-
import static org.trellisldp.http.core.HttpConstants.PATCH;
3737
import static org.trellisldp.http.impl.HttpUtils.closeDataset;
3838
import static org.trellisldp.http.impl.HttpUtils.ldpResourceTypes;
3939
import static org.trellisldp.vocabulary.Trellis.PreferUserManaged;

core/http/src/test/java/org/trellisldp/http/AbstractTrellisHttpResourceTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
import static org.trellisldp.http.core.HttpConstants.CONFIG_HTTP_PUT_UNCONTAINED;
5555
import static org.trellisldp.http.core.HttpConstants.EXT;
5656
import static org.trellisldp.http.core.HttpConstants.MEMENTO_DATETIME;
57-
import static org.trellisldp.http.core.HttpConstants.PATCH;
5857
import static org.trellisldp.http.core.HttpConstants.PREFER;
5958
import static org.trellisldp.http.core.HttpConstants.RANGE;
6059
import static org.trellisldp.http.core.HttpConstants.SLUG;

core/http/src/test/java/org/trellisldp/http/impl/BaseTestHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import static javax.ws.rs.HttpMethod.GET;
3232
import static javax.ws.rs.HttpMethod.HEAD;
3333
import static javax.ws.rs.HttpMethod.OPTIONS;
34+
import static javax.ws.rs.HttpMethod.PATCH;
3435
import static javax.ws.rs.HttpMethod.POST;
3536
import static javax.ws.rs.HttpMethod.PUT;
3637
import static javax.ws.rs.core.HttpHeaders.ALLOW;
@@ -47,7 +48,6 @@
4748
import static org.trellisldp.api.TrellisUtils.TRELLIS_BNODE_PREFIX;
4849
import static org.trellisldp.api.TrellisUtils.TRELLIS_DATA_PREFIX;
4950
import static org.trellisldp.http.core.HttpConstants.ACL;
50-
import static org.trellisldp.http.core.HttpConstants.PATCH;
5151
import static org.trellisldp.http.core.RdfMediaType.TEXT_TURTLE_TYPE;
5252

5353
import java.io.ByteArrayInputStream;

core/http/src/test/java/org/trellisldp/http/impl/GetHandlerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import static javax.ws.rs.HttpMethod.GET;
3131
import static javax.ws.rs.HttpMethod.HEAD;
3232
import static javax.ws.rs.HttpMethod.OPTIONS;
33+
import static javax.ws.rs.HttpMethod.PATCH;
3334
import static javax.ws.rs.HttpMethod.POST;
3435
import static javax.ws.rs.HttpMethod.PUT;
3536
import static javax.ws.rs.core.HttpHeaders.LINK;
@@ -56,7 +57,6 @@
5657
import static org.trellisldp.http.core.HttpConstants.ACCEPT_RANGES;
5758
import static org.trellisldp.http.core.HttpConstants.DESCRIPTION;
5859
import static org.trellisldp.http.core.HttpConstants.MEMENTO_DATETIME;
59-
import static org.trellisldp.http.core.HttpConstants.PATCH;
6060
import static org.trellisldp.http.core.HttpConstants.PREFER;
6161
import static org.trellisldp.http.core.HttpConstants.PREFERENCE_APPLIED;
6262
import static org.trellisldp.http.core.HttpConstants.RANGE;

0 commit comments

Comments
 (0)