Hello Dan,
Could please point me in the right direction here wrt string parameter parsing
in Isis.
The parameter was sent from my angularjs controller client as follows:
var stopLocationCode= { locationGroupCode : JSON.stringify('09') };
StopsFactory.query(stopLocationCode, function(data) {
// xxxxxxxxxxxxxxxxxxxx
}
My Isis service method definition is:
@Bookmarkable
@Named("Get Locations")
@ActionSemantics(Of.SAFE)
public final List<Location> fetchMatchingGroupLocations(@Named("Location
Group Code") final String alternativeGroupCode) {
List<Location> locationsList =
findCurrentLocations(alternativeGroupCode);
return locationsList;
}
After debugging, I found out that the alternativeGroupCode was printed out as
"09" in the action method i.e. the stringify added the double quotes.
Do, I need a JSON Parser to convert the "09" to a normal POJO string 09?
I expected the string not to require any processing in the action i.e. trimming
the quotes.
Remember the issue I had with passing nested object. But, this is a get method
as against a create/put operation.
FYI:
Sending the param without stringify does not work :
var stopLocationCode= { locationGroupCode : '09' };
OR
var stopLocationCode= { locationGroupCode : "09") };
Resulted in this error:
{"locationGroupCode":{"value":1,"invalidReason":"Failed to parse representation
as value of type 'String'"},"x-ro-invalidReason":"Location Group Code is
mandatory"}