empty array in query param when using @Separator #4648
Replies: 2 comments
|
I'm seeing a different behavior. With an empty The only difference I had was @Path("arrays")
public class ArrayResource {
@GET
@Path("/long/no-sep")
public String longArrayNoSep(@QueryParam("id") final long[] values) {
return "values: " + (values == null ? "null" : Arrays.toString(values));
}
@GET
@Path("/long/sep")
public String longArraySep(@QueryParam("id") @Separator(",") final long[] values) {
return "values: " + (values == null ? "null" : Arrays.toString(values));
}
@GET
@Path("/string/no-sep")
public String stringArrayNoSep(@QueryParam("id") final String[] values) {
return "values: " + (values == null ? "null" : Arrays.toString(values));
}
@GET
@Path("/string/sep")
public String stringArraySep(@QueryParam("id") @Separator(",") final String[] values) {
return "values: " + (values == null ? "null" : Arrays.toString(values));
}
}Where I do see a difference is if I leave off the I'm definitely open to other opinions though and let me know if I'm testing something wrong :) |
|
You mean if you pass @GET
@Path("/string/sep")
public String stringArraySep(@QueryParam("id") @Separator(",") @DefaultValue(",") final String[] values) {
return "values: " + (values == null ? "null" : Arrays.toString(values));
} |
Uh oh!
There was an error while loading. Please reload this page.
I have the following examples:
To send in an empty array, the request URLs look like this:
In the second example, if I don't send any
id,idwill be null instead of empty array. This behavior seems weird. Shouldn't it evaluate to empty array instead of null?I'm using Wildfly 37.
All reactions