Hi!

I have defined (and implemented) the method below :

@WebMethod
@GET
@Path("/xxx/")
@ConsumeMime({"text/plain", "application/xml", "application/json"})
@ProduceMime({"text/plain", "application/xml", "application/json"})
public String[] getXXX(@QueryParam("index") String[] index);

My client is an HTML form that contains text inputs with the same value for the attribute called "name" like this :
<input type="text" name="index" value="toto" />
<input type="text" name="index" value="titi" />
<input type="text" name="index" value="tutu" />

So the URL is something like this : ...?index=toto&index=titi&index=tutu

But it seems that it doesn't work because in this case my method would have a List<String> parameter instead... So I have modified my form so that URL send is now like this : ...?index={"toto", "titi", "tutu"} and I have created a MessageBodyReader implementation like this : public class StringArrayTextProvider implements MessageBodyReader<String[]> { ... }
that I have registered in my beans.xml like that :

<bean id="StringArrayTextProvider" class="mypackage.helpers.StringArrayTextProvider"/>
<jaxrs:server id="myService" address="/rest/myservice">
       <jaxrs:serviceBeans>
         ...
       </jaxrs:serviceBeans>
       <jaxrs:providers>
           <ref bean="StringArrayTextProvider" />
       </jaxrs:providers>
   </jaxrs:server>
When sending the URL and calling the service, the index parameter received is null and the method "readFrom" of my MessageBodyReader is never called. :-(
Where is my mistake?

Thanks in advance!





--

---------------------------------------------
Priscille DURVILLE

INRIA
Equipe Edelweiss (ex Acacia)

[email protected]

Tél : 01 39 63 52 77 (Paris - Rocquencourt)
Tél : 04 92 38 50 23 (Sophia Antipolis)
Fax : 04 92 38 77 83

I.N.R.I.A.
Centre de Recherche Sophia Antipolis - Méditerranée
2004 route des Lucioles - B.P. 93
06902 Sophia-Antipolis Cedex
FRANCE
---------------------------------------------

Reply via email to