0
I have the following situation in my REST (Jersey):
URL:
http://localhost:8080/api/listar_log_utilizacao/null
Code:
@GET @Path("/listar_log_utilizacao/{idUsuario: .*}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response listarLogUtilizacao(@PathParam("idUsuario") Integer idUsuario) throws Exception {
...
}
Integer values are received smoothly, however, in this situation the parameter is optional and when null is set to 404 error...
Behold here and here. I believe they are useful to you. Now, I do not understand this
null
as a parameter.– StatelessDev
In fact null is originated in javascript and sent to the API via Axios... In the API (JAX-RS) null becomes String and thus gives error in the Integer parameter that receives the value... I solved the problem by creating a custom Integer class, which accepts null, null and '
– Bacamarte Linux