java - 500 Internal Server Error in RESTfull -


when try access resource error message 500 internal server error

i new web services , trying realize issue

rest service

@path("travelgood1") public class travelgood {  private lameduck lameduckclient; private niceview niceviewclient; private simpledateformat parsersdf; private hashmap<string, list<itinerary>> useritineraries; private int lastitineraryid;   public travelgood() {     lameduck_service service = new lameduck_service();     lameduckclient = service.getlameduck();      niceview_service niceviewservice = new niceview_service();     niceviewclient = niceviewservice.getniceview();      parsersdf = new simpledateformat("yyyy-mm-dd");      useritineraries = new hashmap<string, list<itinerary>>(); }  @post @path("{uid}/itineraries") @produces(mediatype.application_json) public int createitinerary(@pathparam("uid") string userid) {     if (!useritineraries.containskey(userid)) {         useritineraries.put(userid, new linkedlist<itinerary>());     }      itinerary itinerary = new itinerary(++lastitineraryid);     useritineraries.get(userid).add(itinerary);      return itinerary.getid(); } } 

client

@test     public void testp1() {      webresource clientitinerariesresource = client.resource("http://localhost:8080/tg/webresources/travelgood1/annestrandberg/itineraries");         int itineraryid = clientitinerariesresource.post(integer.class); 

an error occurs in jersey when trying serialize primitive int json. same happen if use integer. use wrapper object/dto return type (see jax-rs / jersey ".get(integer.class)" , single json primitive (integer) values?)


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -