As far as CXF is concerned, it manages the population of List in cases like this one, so UnDto factory methods should only create individual UnDto instances... Another option is simply introduce UnDtoCollection with methods like "List<UnDto> getUnDto()" given that an individual URI query parameter may represent some lists, would be simpler to deal with IMHO

Sergey

On 23/02/12 14:10, Glen Mazza wrote:
I haven't done this before, so my below suggestion may be wrong; but you
might need to create an ObjectMapper similar to here:
http://www.mkyong.com/java/how-to-convert-java-map-to-from-json-jackson/

And attach it as a @Provider, similar to here:
http://java.net/projects/jersey/sources/svn/content/trunk/jersey/samples/jacksonjsonprovider/src/main/java/com/sun/jersey/samples/jacksonjsonprovider/MyObjectMapperProvider.java


HTH,
Glen

On 02/23/2012 08:35 AM, Thieumdesp wrote:
Hello,
I'm trying to use cxf in combination with jackson in operation with a
parametre of type List :

@GET
@Path("inUnDtoList/{desdtos}")
@Produces(MediaType.APPLICATION_JSON)
public String inUnDtoList(*@PathParam("desdtos") List<UnDto> desDtos*) {
for (UnDto unDto : desDtos) {
System.out.println(unDto.getAttributString());
}

return "bonjour";
}

First it said i have to have a /valueOf/ or /fromString /static
method. So
do i.

But when i have such request : *(with a list as input)*
http://localhost:8080/formationCharteV2-web-0.0.1-SNAPSHOT.mht/services/jackson/JacksonWSService/inUnDtoList/[%7B%22attributString%22:%22bonjour%22,%22attributDouble%22:2.5,%22tableauString%22:[%221%22,%222%22]%7D]


What i see is that cxf (all is done in InjectionUtils) put my result from
/valueOf/ or /fromString/ is put in a ArrayList (via
/addToCollectionValues/). So the result is an ArrayList with an other
ArrayList inside (this one with mine from /valueOf/ or /fromString/)

So no way to have my ArrayList !

Does any on how to do that or can someone telle me the best practice to
*handle json format input parameter* ?

Thanks in advance.
Mathieu.

--
View this message in context:
http://cxf.547215.n5.nabble.com/List-T-as-input-parameter-tp5508023p5508023.html

Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to