Hi Sergey,
I've tried this solution: I've add a BodyReader at clientSide to manage the
response from the server.
I've added this provider:

@Provider
public class StringArrayBodyReader implements MessageBodyReader<String[]> {
         
                private static final Plat1Logger log = new
Plat1Logger(StringArrayBodyReader.class);

                @Override
                public boolean isReadable(Class<?> arg0, Type arg1, 
Annotation[] arg2,
                                MediaType arg3) {
                        return String[].class.isAssignableFrom(arg0);
                }

                @Override
                public String[] readFrom(Class<String[]> arg0, Type arg1,
                                Annotation[] arg2, MediaType arg3,
                                MultivaluedMap<String, String> arg4, 
InputStream arg5)
                                throws IOException, WebApplicationException {
                        // TODO Auto-generated method stub
                        return null;
                }
}

at the loading of the REST endPoints:

                JAXRSClientFactoryBean proxyFactory = new 
JAXRSClientFactoryBean();
                proxyFactory.setServiceClass(clazz);
                proxyFactory.setAddress(address);
                proxyFactory.setProvider(new StringArrayBodyReader());

by the client application.
Debugging I've seen that when I call a REST web method from the client I
arrive in the isReadable method of the provider and it returns true only if
the return type is a String[].... but I' m not yet able to arrive in the
readFrom method of the provider (this even if the isReadable has returned a
true value).
Do you know why this happens?
And how can I fix it and force to call the readFrom method when isReadable
returns true?
In this way I hope to solve the problem.
Thanks a lot,

Andrea






--
View this message in context: 
http://cxf.547215.n5.nabble.com/java-lang-ClassCastException-B-cannot-be-cast-to-Ljava-lang-Object-tp5730141p5730271.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to