Foros de discusión

List as Parameter

thumbnail
Gustavo Oliveira, modificado hace 8 años.

List as Parameter

Junior Member Mensajes: 98 Fecha de incorporación: 23/09/15 Mensajes recientes
Anyone managed to create a service using List as parameter?

For example, I will send a JSONArray parameter from mobile and I registered a service receiving java.util.List. If I send [901, 1604, 1901, 1902, 2001, 2303] or "[901, 1604, 1901, 1902, 2001, 2303]" I get an error:

com.liferay.mobile.android.exception.ServerException: jodd.typeconverter.TypeConversionException

All parameters using JSONObject works fine.

I will try changing the service to Array or JSONArray.
thumbnail
Gustavo Oliveira, modificado hace 8 años.

RE: List as Parameter

Junior Member Mensajes: 98 Fecha de incorporación: 23/09/15 Mensajes recientes
EDIT: It worked, the problem was in my service. You can declare a parameter as a List of Long for example. You just need to create an instance of JSONArray on the mobile or other client side:

exampleService.findByIds(new JSONArray(idsExample));