Attention! You can not strain on the decision, just tell me in which direction to think!
We have a very simple service:
@GET @Path("/search") @Consumes(MediaType.APPLICATION_JSON) public Response getSubscriber(@QueryParam("data") SubscriberSearchFormData data){ System.out.println(data); List <SubscrEntity> results = null //list of results return Response.ok(results).build(); } SubscriberSearchFormData class:
public class SubscriberSearchFormData { private String name; private String street; private Integer contractNumber; public static SubscriberSearchFormData fromString(String jsonRepresentation) throws Exception { System.out.println("WE ARE HERE"); ObjectMapper mapper = new ObjectMapper(); // Jackson's JSON marshaller SubscriberSearchFormData obj = null; try { obj = mapper.readValue(decoded, SubscriberSearchFormData.class); } catch (IOException e) { throw new Exception("Wrong JSON parameters!"); } return obj; } //all getters and setters } As planned, JSON should be automatically parsed by the fromString method into an object of the SubscriberSearchFormData class. And we will continue to work with him. But as soon as I call the service:
localhost:8080/application/rest/catalog/subscriber/search?data={ "name":"bbb", "street":"eee", "contractNumber":5 } Everything falls due to an error:
11:24:04,050 WARN [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-3) RESTEASY002130: Failed to parse request.: javax.ws.rs.core.UriBuilderException: RESTEASY003330: Failed to create URI: http://localhost:8080/application/rest/catalog/subscriber/search?data={%20%22name%22:%22bbb%22,%20%22street%22:%22eee%22,%20%22contractNumber%22:%225%22} And at the same time, System.out.println("WE ARE HERE"); not even called. That is, it collapses, even before calling fromString();
I dig in this second day and nothing can be solved.

fromStringmethod should throw anException? - MrFylypenkotry { obj = mapper.readValue(...); } catch (IOException e) { throw new Exception("Wrong JSON parameters!"); }try { obj = mapper.readValue(...); } catch (IOException e) { throw new Exception("Wrong JSON parameters!"); }try { obj = mapper.readValue(...); } catch (IOException e) { throw new Exception("Wrong JSON parameters!"); }- Kiryl Aleksandrovich