java - Server response doesn't match the list size -


i have server developped in spring framework.

when try control response browser web pasting url, seems list (response.java's field) has right size (that same of list returned method getfourmyobject() ), i've tried print in server's console size , it's not equal 1.

but when response android application, doesn't recognize other myobject first.

so in controller's server response's list has different size received size client.

my server's code:

@requestmapping("/") public class routecontroller extends restgatewaysupport {  @requestmapping(value = "/",method = requestmethod.get) public string index (){     return "index"; } @requestmapping(value = "/objectize",method = requestmethod.get) public @responsebody response objectize(@requestparam(value="time", defaultvalue="-1") string time,                                                  @requestparam(value="id", defaultvalue="-1") string id,                                             @requestparam(value="ratio", defaultvalue="-1") string destination) {     return new response().addallmyobjects(myobject.getfourmyobject()); } 

response.java:

public class response implements serializable{    public final list<myobject> response;    public response () {      .response = new arraylist<>();     }    public response addmobect(myobject mobject){      .response.add(mobject);     return this;    }    public response addallmyobjects (list<myobject> mobjects){      .response.addall(mobjects);     return this;    } 

}

android app's requester method:

   protected list<route> doinbackground(string... params) {           string link = params[0];           url url;           try {               url = new url(link);               inputstream = url.openconnection().getinputstream();               stringbuilder jsondata = new stringbuilder();               bufferedreader reader = new bufferedreader(new inputstreamreader(is));             string line;                while ((line = reader.readline()) != null)                   jsondata.append(line).append("\n");               jsonobject jsonobject = new jsonobject(jsondata.tostring());               jsonarray jsonmyobjects = jsonobject.getjsonarray("response");               log.i("logger","jsonmyobjects list's size = "+jsonmyobjects.length());             return jsonmyobjects;              } catch (ioexception | jsonexception e) {               e.printstacktrace();           }           return null;       }  

can me? it's wrong parsing problem?


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -