java - How to access data from RestTemplate as List -
i want access data spring boot service. return type of data list
, every time access it, list empty.
this code:
map<string, string> params = new hashmap<string, string>(); params.put("firstname", "test" ); params.put("lastname", "test1"); responseentity<person[]> response = resttemplate.getforentity(url, person[].class, params);
in case, response.getbody()
empty []
.
@requestmapping(value = "/search", method = requestmethod.get) public list<person> searchusers( @requestparam(value = "firstname", required = false) string firstname, @requestparam(value = "lastname", required = false) string lastname, @requestparam(value = "email", required = false) string email { return personservice.search(firstname, lastname, email, company); }
i tried string
, , person[]
, nothing worked.
thanks in advance!
@get @path("statement") @produces({mediatype.application_xml}) public response statement(@queryparam("from") string from, @queryparam("to") string to) { db idb = new db(); list<transaction> transactions = idb.gettransactionsbydate(from, to); final genericentity<list<transaction>> entity = new genericentity<list<transaction>>(transactions) { }; return response.status(response.status.ok).entity(entity).build(); }
Comments
Post a Comment