cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John-M Baker <john-m.ba...@db.com>
Subject Re: HTTP multipart/form-data and REST
Date Thu, 08 May 2008 07:53:02 GMT
Sergey,

I've been looking at the formEncodingReaderProvider that was included in 
CXF2.1.  Perhaps if I change the use case a little I can understand how a 
message provider exists within CXF.

Given this example:

@POST
@PUT
@Path("/push/")
@ConsumeMime("application/x-www-form-urlencoded")
public Response addX(Map<String, String> params);

Does this automatically invoke the message producer? 

If I were to submit some XML with the parameter 'xml', is there a way to 
convert this into the object as would have happened if I'd done this:

@POST
@Path("/push/")
public Response addX(MyBean bean);

I can not see the point of a form encoding reader if the output is not a 
bean?


John Baker
-- 
Web SSO 
IT Infrastructure 
Deutsche Bank London

URL:  http://websso.cto.gt.intranet.db.com




"Sergey Beryozkin" <sergey.beryozkin@iona.com> 
07/05/2008 17:09
Please respond to
users@cxf.apache.org


To
<users@cxf.apache.org>
cc

Subject
Re: HTTP multipart/form-data and REST






In fact, you might get it working by having a method with the InputStream 
input parameter (or may be even byte[]) and 
ConsumeMime("multipart/form-data") and then process the 
multipart/form-data directly in the method.

Cheers, Sergey

----- Original Message ----- 
From: "Sergey Beryozkin" <sergey.beryozkin@iona.com>
To: <users@cxf.apache.org>
Sent: Wednesday, May 07, 2008 4:49 PM
Subject: Re: HTTP multipart/form-data and REST


Hi

JAX-RS mandates the support for DataSource and I reckon this would be the 
way to get the multipart/form-data 
in. CXF JAX-RS does not support this type yet. 

Possibly another viable alternative is to have a custom MessageBodyReader
which will have a ConsumeMime("multipart/form-data") annontation and then 
in its readFrom() method it will transform the multipart/form-data 
formatted input body into an appropriate type, as required by the method 
parameter...

Cheers, Sergey

> Hello,
> 
> Using the CXFServlet and REST, wget can be used to post a file to a URL 
> defined as a post operation:
> 
> wget --post-file file.xml url
> 
> And wget makes the following HTTP submission:
> 
> $ nc -p 1234 -l
> POST /blah/push HTTP/1.0
> User-Agent: Wget/1.10.2
> Accept: */*
> Host: localhost:1234
> Connection: Keep-Alive
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 599
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <myxml> ...
> 
> Is it possible to replicate this with a browser file submission? Or 
> rather, is it possible for a POST operation to be defined so the data is 

> taken from an HTTP parameter name? The browser submits a file as 
> multipart/form-data but this does not appear to work when submitting to 
a 
> URL that would otherwise handle a wget file post. 
> 
> Thanks,
> 
> 
> John Baker
> -- 
> Web SSO 
> IT Infrastructure 
> Deutsche Bank London
> 
> URL:  http://websso.cto.gt.intranet.db.com
> 
> 
> ---
> 
> This e-mail may contain confidential and/or privileged information. If 
you are not the intended recipient (or have received this e-mail in error) 
please notify the sender immediately and delete this e-mail. Any 
unauthorized copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.
> 
> Please refer to http://www.db.com/en/content/eu_disclosures.htm for 
additional EU corporate and regulatory disclosures.

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

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



---

This e-mail may contain confidential and/or privileged information. If you are not the intended
recipient (or have received this e-mail in error) please notify the sender immediately and
delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in
this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate
and regulatory disclosures.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message