I did not see an easy and clean way to integrate it into ERRest. Instead we've created a utility class.
I will post it to the mailing list. If you find it useful we can submit it to Wonder. Michael Sent from my iPhone > On Oct 13, 2015, at 5:01 AM, Frank Stock <[email protected]> wrote: > > Thanks Michael, > > > Where do you put the code? Why isn't that in ERRest? > What do you do when you use: > public WOActionResults indexAction() { > if (isSchemaRequest()) { > return schemaResponse(showFilter()); > } > ERXRestFetchSpecification<Company> fetchSpec = new > ERXRestFetchSpecification<Company>(Company.ENTITY_NAME, null, null, > queryFilter(), Company.NAME.ascs(), 25); > return response(fetchSpec, showFilter()); > } > Do you first do a fetch to know is the array is empty? > > Frank >> Op 13 okt. 2015, om 02:47 heeft Michael Kondratov >> <[email protected]> het volgende geschreven: >> >> public static JSONObject emptyArray(String entityName) throws >> JSONException { >> JSONObject result = new JSONObject(); >> JSONArray array = new JSONArray(); >> result.put(pluralEntityName(entityName), array); >> return result; >> } >> >> public static String deleteResponse() { >> return "{}"; >> } >> >> public static String pluralEntityName(String entityName) { >> return >> ERXStringUtilities.uncapitalize(ERXLocalizer.englishLocalizer().plurifiedString(entityName, >> 2)); >> } >> >>> On Oct 12, 2015, at 6:37 PM, Michael Kondratov <[email protected]> >>> wrote: >>> >>> Frank, >>> We have a quick solution for that. I will post a code snippet. >>> >>> Michael >>> >>> Sent from my iPhone >>> >>>> On Oct 12, 2015, at 5:06 PM, Frank Stock <[email protected]> wrote: >>>> >>>> Hi, >>>> >>>> >>>> When using Ember as format, If the indexAction has to return an empty >>>> array I always get: net.sf.json.JSONException: JSON keys cannot be null. >>>> Is there something I can do to prevent that? >>>> When doing a test in the ERRestRouteExample, I get the same error. >>>> >>>> >>>> Thanks in advance, >>>> Frank Stock >>>> Belgium >>>> _______________________________________________ >>>> Do not post admin requests to the list. They will be ignored. >>>> Webobjects-dev mailing list ([email protected]) >>>> Help/Unsubscribe/Update your Subscription: >>>> https://lists.apple.com/mailman/options/webobjects-dev/michael%40aspireauctions.com >>>> >>>> This email sent to [email protected] >>> _______________________________________________ >>> Do not post admin requests to the list. They will be ignored. >>> Webobjects-dev mailing list ([email protected]) >>> Help/Unsubscribe/Update your Subscription: >>> https://lists.apple.com/mailman/options/webobjects-dev/michael%40aspireauctions.com >>> >>> This email sent to [email protected] >
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
