eclipse-ee4j / eclipse-ee4j/jersey

WebComponent.filterFormParameters reports confusing error for @GET method

Open
#3,243 6 comments 0 reactions 0 assignees View on GitHub
Priority: Major Type: Bug
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

We have a @GET rest method that accepts parameter named "list[]":

```
@GET
@Path("/listvalues")
public Map listGlobalParametersValues(@DefaultValue("") @QueryParam("name[]") List names) {
log.trace("listGlobalParametersValues: {}", names);

return service.listValues(names);
}
```

When I request this method with AJAX and content type is javax.ws.rs.core.MediaType#APPLICATION_FORM_URLENCODED_TYPE the request generates the following error:

```
WARNING: A servlet request to the URI http://localhost:8080/api/x/listvalues?name%5B%5D=VALUATION_DATE contains form parameters in the request body but the request body has been consumed by the servlet or a servlet filter accessing the request parameters. Only resource methods using @FormParam will work as expected. Resource methods consuming the request body by other means will not work as expected.
```

However, I can't sue @FormParam, because it is @GET method - and Jersey wouldn't start at all. The whole part "...the request body has been consumed by the servlet or a servlet filter accessing the request parameters" is rather confusing - what request body? There is no request body in my case (that is - there is nothing after headers). If I don't use that content-type, it is OK.

But the content-type seems to be allowed for GET. Shouldn't there be some junction for GET requests to avoid the warning?
#### Affected Versions
[2.21]

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.