You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by deniak <de...@gmail.com> on 2008/08/13 20:05:23 UTC

MultivaluedMap and @ConsumeMime("application/x-www-form-urlencoded")

Hi all,

I'd like to use a web service with a form and a POST method.

Here's my web service implementation:
@POST
	@Path("/test/")
	@ConsumeMime("application/x-www-form-urlencoded")
	public Response someTest(MultivaluedMap<String, String> params){
		log.debug("nbr params " + params.size());
		log.debug("nom = " + params.get("name"));
		return Response.ok(params).build();
	}


I'm using curl to check the webservice like that:
curl -d "name=toto" http://localhost:8180/cxf/test/


My problem is that my MultivaluedMap params  returns null, size = 0...
Can you help me please?

I also tried with MetadataMap without success.
-- 
View this message in context: http://www.nabble.com/MultivaluedMap-and-%40ConsumeMime%28%22application-x-www-form-urlencoded%22%29-tp18968238p18968238.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: MultivaluedMap and @ConsumeMime("application/x-www-form-urlencoded")

Posted by Sergey Beryozkin <se...@iona.com>.
> curl -d "name=toto" http://localhost:8180/cxf/test/

May be it should be

> curl -X POST http://localhost:8180/cxf/test/ -d "name=toto"

Cheers, Sergey

>
> Hi all,
>
> I'd like to use a web service with a form and a POST method.
>
> Here's my web service implementation:
> @POST
> @Path("/test/")
> @ConsumeMime("application/x-www-form-urlencoded")
> public Response someTest(MultivaluedMap<String, String> params){
> log.debug("nbr params " + params.size());
> log.debug("nom = " + params.get("name"));
> return Response.ok(params).build();
> }
>
>
> I'm using curl to check the webservice like that:
> curl -d "name=toto" http://localhost:8180/cxf/test/
>
>
> My problem is that my MultivaluedMap params  returns null, size = 0...
> Can you help me please?
>
> I also tried with MetadataMap without success.
> -- 
> View this message in context: 
> http://www.nabble.com/MultivaluedMap-and-%40ConsumeMime%28%22application-x-www-form-urlencoded%22%29-tp18968238p18968238.html
> Sent from the cxf-user mailing list archive at Nabble.com. 

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland