Hi

There was a minor issue to do with handling arrays such as Integer[], but I can see no problems with List<Integer>. I committed a test involving List<Integer> & Integer[].
Not sure why you see a problem with List<Integer>
Can you try 2.4.2 please ?
Sergey

On 28/09/11 17:34, Kiren Pillay wrote:
Hi Sergey!

Tried int[], got the same error.

<detail>[I cannot be cast to [Ljava.lang.Object;
org.apache.cxf.jaxrs.utils.InjectionUtils.addToCollectionValues(InjectionUtils.java:752)
org.apache.cxf.jaxrs.utils.InjectionUtils.injectIntoCollectionOrArray(InjectionUtils.java:740)


I also tried List<Integer>  but that also failed with the same error.

Is there anything special with the provider configuration maybe? (using 2.4.1).



On Wed, Sep 28, 2011 at 5:41 PM, Sergey Beryozkin<[email protected]>  wrote:
Hi

List<Integer>  must be supported, I'll add a test for Integer[], have you
tried int[] ?

Cheers, Sergey

On 28/09/11 15:42, Kiren Pillay wrote:

Hi

This is an old problem, but I can't seem to find a solution posted
anywhere. I want to marshall a comma-separated list of integers
directly into an Integer [].

  1. Service:

   public Response getCounters(
             @QueryParam("msisdn") Long msisdn,
             @QueryParam("counters") Integer [] counters,
             @QueryParam("subscriberIdType") String subscriberIdType)

2. I've written a ParameterHandler for this :

public class IntegerArrayParameterHandler implements
                ParameterHandler<Integer[]>    {
        @Override
        public Integer[] fromString(String arg0) {

3. The parameter handler is registered, however its not picked up when
I do the query:

  <detail>[I cannot be cast to [Ljava.lang.Object;

org.apache.cxf.jaxrs.utils.InjectionUtils.addToCollectionValues(InjectionUtils.java:752)

org.apache.cxf.jaxrs.utils.InjectionUtils.injectIntoCollectionOrArray(InjectionUtils.java:740)

org.apache.cxf.jaxrs.utils.InjectionUtils.createParameterObject(InjectionUtils.java:807)
org.apache.cxf.jaxrs.utils.JAXRSUtils.readQueryString(JAXRSUtils.java:947)

org.apache.cxf.jaxrs.utils.JAXRSUtils.createHttpParameterValue(JAXRSUtils.java:649)

Is there a way to get this to work?

4. I've Registered the Provider:
                       ----
                        <ref bean="integerArrayParameterHandler" />
                </jaxrs:providers>

The easiest solution is to just use the String value and parse it
inside my code,( which is probably why there are not many posts on
this:).

Regards
Kiren



Reply via email to