URL matrix parameters vs. query parameters

I’m wondering whether to use matrix or query parameters in my URLs. I found an older discussion to that topic not satisfying. Examples URL with query params: http://some.where/thing?paramA=1&paramB=6542 URL with matrix params: http://some.where/thing;paramA=1;paramB=6542 At first sight matrix params seem to have only advantages: more readable no encoding and decoding of “&” in XML documents is … Read more

Java 8 LocalDate Jackson format

For java.util.Date when I do @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = “dd/MM/yyyy”) private Date dateOfBirth; then in JSON request when I send { {“dateOfBirth”:”01/01/2000″} } it works. How should I do this for Java 8’s LocalDate field?? I tried having @JsonDeserialize(using = LocalDateDeserializer.class) @JsonSerialize(using = LocalDateSerializer.class) private LocalDate dateOfBirth; It didn’t work. Can someone please let … Read more

JAX-RS / Jersey how to customize error handling?

I’m learning JAX-RS (aka, JSR-311) using Jersey. I’ve successfuly created a Root Resource and am playing around with parameters: @Path(“/hello”) public class HelloWorldResource { @GET @Produces(“text/html”) public String get( @QueryParam(“name”) String name, @QueryParam(“birthDate”) Date birthDate) { // Return a greeting with the name and age } } This works great, and handles any format in … Read more

JAX-RS — How to return JSON and HTTP status code together?

I’m writing a REST web app (NetBeans 6.9, JAX-RS, TopLink Essentials) and trying to return JSON and HTTP status code. I have code ready and working that returns JSON when the HTTP GET method is called from the client. Essentially: @Path(“get/id”) @GET @Produces(“application/json”) public M_機械 getMachineToUpdate(@PathParam(“id”) String id) { // some code to return JSON … Read more

How to implement REST token-based authentication with JAX-RS and Jersey

I’m looking for a way to enable token-based authentication in Jersey. I am trying not to use any particular framework. Is that possible? My plan is: A user signs up for my web service, my web service generates a token, sends it to the client, and the client will retain it. Then the client, for … Read more

A message body writer for Java class java.util.ArrayList and MIME media type application/json was not found

I am trying to get a web service to work which returns a JSON (JAX-RS with jersey implementation on Tomcat). However, I am getting the below exception. I have looked at the similar problems here, but none of the solutions work for me, and it’s been more than half a day 🙁 07-Nov-2017 20:47:17.109 SEVERE … Read more