eclipse-ee4j / eclipse-ee4j/jersey

Json Array not binding properly if Content-Type is (application/json-patch+json) other than application/json

Open
#3,570 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

I was trying to implement https://tools.ietf.org/html/rfc6902
**Case:1**
Content-Type = application/json-patch+json
`[
{"op":"replace", "path":"/storageProviderId", "value":"fafba440-441f-11e7-a59b-9d9ddbd018df"},
{"op":"replace", "path":"/fileName", "value":"5864"},
{"op":"replace", "path":"/fileName", "value":"test-5485"}
]`

Class:
`public class JsonPatchRequest {

@JsonProperty
@NotEmpty
private String path;

@JsonProperty
@ValidEnumName(clazz = PatchOperation.class)
private String op;

@JsonProperty
private String value;
..
}`

Resource:
`@Consumes("application/json-patch+json")
@PATCH
public Response patch(@HeaderParam("If-Match") UUID id, @NotNull List jsonPatchRequests)`

I get java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key client.error.NotSupportedException.code (415 Unsupported Media Type).

When I use:
Content-Type: application/json
it works perfectly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.