You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by John-M Baker <jo...@db.com> on 2008/05/07 16:21:46 UTC
HTTP multipart/form-data and REST
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.
Re: HTTP multipart/form-data and REST
Posted by John-M Baker <jo...@db.com>.
Sergey,
But I see this as a really simple thing to implement. If you've already
got stuff in place to transform the submission of a POST into an object,,
why not let a developer specify a parameter through annotations? Whether
the XML is valid or not is not something we need to worry about - a client
can submit broken XML via a POST or via an HTTP parameter. Ideally we
want to be able to pass multiple objects to methods too!
public void method(MyObject a, MyOtherObject b);
And annotate with the HTTP parameters to use when deserialising.
This functionality would also make it easy to build test web interfaces,
which was my original plan. No-one wants to type wget --post-file - they
want to post XML into a text box in a browser window.
John Baker
--
Web SSO
IT Infrastructure
Deutsche Bank London
URL: http://websso.cto.gt.intranet.db.com
"Sergey Beryozkin" <se...@iona.com>
12/05/2008 16:48
Please respond to
users@cxf.apache.org
To
<us...@cxf.apache.org>
cc
<us...@cxf.apache.org>
Subject
Re: HTTP multipart/form-data and REST
I don't see it as a viable approach for a *default* JAXB provider for a
number of reasons :
* The format of parameters can be arbitrary and there's no standard way to
indicate that the value of a query parameter X is an
instance of XML or comma-seperated entity, etc
* Even though I've listed this option I'm not sure body readers, by
definition, are good candidates for deserializing query params
* Multiple parameters can have different formats, etc...
Perhaps you may want to raise this issue at a JAX-RS users list and
suggest introducing some sort of QueryProviders which will be
called/given an opportunity by the runtime to deserialize a given complex
query param..
Cheers, Sergey
> Indeed, encoding is performed - I was just illustrating the concept
> because the browser would encode the XML.
>
> I don't understand option 2 but I'm still not quite sure I've made my
> point clear. CXF currently has no problems using JAXBElementProvider to
> deserialise the contents of a POST, so why can't we make it work for an
> HTTP parameter? Why is it so hard to implement some logic to say, "If
> there's no parameters submitted then take the entire submission and
> deserialise - as is already the case - but if there's name/value
> parameters then use the value of parameter X and process with
> JAXBElementProvider".
>
> Surely this could be achieved through option 1 without a specific
valueOf
> method - you have all the code!
>
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
>
>
> "Sergey Beryozkin" <se...@iona.com>
> 12/05/2008 13:28
> Please respond to
> users@cxf.apache.org
>
>
> To
> <us...@cxf.apache.org>
> cc
> <us...@cxf.apache.org>
> Subject
> Re: HTTP multipart/form-data and REST
>
>
>
>
>
>
> Hi,
>
>
>> http://localhost:8080/rest/push?X=<moo />
>>
>> I want to build an interface where a user can paste XML into a web form
>> and press submit. As opposed to doing wget --post-file test.xml
>> http://localhost:8080/rest/push
>
> I'm not sure if XML can be pasted like that, perhaps some escaping will
> need to be done, but either way, when dealing with complex query
> parameters, perhaps two options are available :
>
> 1. Add a static valueOf(String s) method to MyObject :
>
> class MyObject {
> public static MyObject valueOf(String xmlString) {
> // convert that XML into an instance of MyObject somehow
> }
>
> and then just do
>
> Response post(@QueryParam("X") MyObject o) {...}
>
>
> 2. Have a custom MessageBodyReader for MyObject, in its readFrom()
method
> ignore the input stream, but instead deserialize the given query
parameter
> into MyObject. For this to work, an instance of JAX-RS UriInfo will need
> to be injected into a custom reader's @Context-annotated field of type
> UriInfo by the runtime, UriInfo will provide an access to query
> parameters. CXF though does not support yet the injection of context
> fields so at the tine being option1 would be the way to go.
>
> and then just do
>
> Response post(MyObject o) {...}
>
>
> Cheers, Sergey
>
>>
>>
>> John Baker
>> --
>> Web SSO
>> IT Infrastructure
>> Deutsche Bank London
>>
>> URL: http://websso.cto.gt.intranet.db.com
>>
>>
>>
>>
>> "Sergey Beryozkin" <se...@iona.com>
>> 12/05/2008 11:58
>> Please respond to
>> users@cxf.apache.org
>>
>>
>> To
>> <us...@cxf.apache.org>
>> cc
>> <us...@cxf.apache.org>
>> Subject
>> Re: HTTP multipart/form-data and REST
>>
>>
>>
>>
>>
>>
>> I'm feeling so slow myself :-), it it because it's Monday ?
>>
>>
>>> Hi,
>>>
>>> I'm talking about deserialising to an object - I've been looking at
>>> JAXBElementProvider which I assume is the default provider for:
>>>
>>> public Response post(MyObject o);
>>
>> JAXBElementProvider is a default provider for serializing/deserilizing
>> JAXB-annotated classes, when application/xml media type is
>> used...On input, it will take the whole input body and attempt to
>> deserialize it, on output it will take the response entity and
>> serialize it into the provided output stream...
>>
>>>
>>> and I want to submit the XML with the parameter 'X' and deserialise to
>>> MyObject.
>>
>> I really don't understand it. Can you please elaborate on what does it
>> mean to 'submit the XML with the parameter 'X'' ?
>>
>> Cheers, Sergey
>>
>>>
>>>
>>> John Baker
>>> --
>>> Web SSO
>>> IT Infrastructure
>>> Deutsche Bank London
>>>
>>> URL: http://websso.cto.gt.intranet.db.com
>>>
>>>
>>>
>>>
>>> "Sergey Beryozkin" <se...@iona.com>
>>> 12/05/2008 11:34
>>> Please respond to
>>> users@cxf.apache.org
>>>
>>>
>>> To
>>> <us...@cxf.apache.org>
>>> cc
>>> <us...@cxf.apache.org>
>>> Subject
>>> Re: HTTP multipart/form-data and REST
>>>
>>>
>>>
>>>
>>>
>>>
>>> Hi,
>>>
>>>
>>>> Sergey,
>>>>
>>>> Thanks for updating the docs and there's no need to apologise for a
>>> delay
>>>> in responding (in reference to another mail you sent) - your rapid
>>>> feedback on responses is most welcome to those of us in a corporate
>>> world
>>>> trying to demonstrate that open source is often better than close
(BEA
>>>> have a lot to learn!).
>>>
>>> thanks :-)
>>>
>>>>
>>>> So consider my example - I'd like to deserialise the value of
> parameter
>>> X,
>>>> instead of deserialising the body of the POST. How do I go about
> this?
>>> I
>>>> appreciate I need to write a message body reader bu what does the
>>>> deserializing?
>>>
>>> Lets assume a request looks like this :
>>>
>>> POST /service?param1=1¶m2=2
>>>
>>> <someXML/>
>>>
>>> When you say 'deserialise the value of parameter X', do you refer to
>> query
>>> parameters like 'param1' above ?
>>> If yes then yiu just need to use @QueryParam :
>>>
>>> Response post(@QueryParam("param1") String p1)
>>>
>>> The query parameter param1 will be converted into a String or it can
be
>>> converted into other type like Long or Integer which have a
>>> constructor accepting a string and/or valueOf(String) method...
>>>
>>> Or are you referring to deserializing some pieces from the <someXML/>
>> body
>>> ? You were talking about dealing with multipart/form-data
>>> earlier, is it still the problem we're discussing here ?
>>>
>>> Cheers, Sergey
>>>
>>>
>>>>
>>>>
>>>> John Baker
>>>> --
>>>> Web SSO
>>>> IT Infrastructure
>>>> Deutsche Bank London
>>>>
>>>> URL: http://websso.cto.gt.intranet.db.com
>>>>
>>>>
>>>
>>> ----------------------------
>>> 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.
>>
>> ----------------------------
>> 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.
>
> ----------------------------
> 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.
----------------------------
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.
Re: HTTP multipart/form-data and REST
Posted by Sergey Beryozkin <se...@iona.com>.
I don't see it as a viable approach for a *default* JAXB provider for a number of reasons :
* The format of parameters can be arbitrary and there's no standard way to indicate that the value of a query parameter X is an
instance of XML or comma-seperated entity, etc
* Even though I've listed this option I'm not sure body readers, by definition, are good candidates for deserializing query params
* Multiple parameters can have different formats, etc...
Perhaps you may want to raise this issue at a JAX-RS users list and suggest introducing some sort of QueryProviders which will be
called/given an opportunity by the runtime to deserialize a given complex query param..
Cheers, Sergey
> Indeed, encoding is performed - I was just illustrating the concept
> because the browser would encode the XML.
>
> I don't understand option 2 but I'm still not quite sure I've made my
> point clear. CXF currently has no problems using JAXBElementProvider to
> deserialise the contents of a POST, so why can't we make it work for an
> HTTP parameter? Why is it so hard to implement some logic to say, "If
> there's no parameters submitted then take the entire submission and
> deserialise - as is already the case - but if there's name/value
> parameters then use the value of parameter X and process with
> JAXBElementProvider".
>
> Surely this could be achieved through option 1 without a specific valueOf
> method - you have all the code!
>
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
>
>
> "Sergey Beryozkin" <se...@iona.com>
> 12/05/2008 13:28
> Please respond to
> users@cxf.apache.org
>
>
> To
> <us...@cxf.apache.org>
> cc
> <us...@cxf.apache.org>
> Subject
> Re: HTTP multipart/form-data and REST
>
>
>
>
>
>
> Hi,
>
>
>> http://localhost:8080/rest/push?X=<moo />
>>
>> I want to build an interface where a user can paste XML into a web form
>> and press submit. As opposed to doing wget --post-file test.xml
>> http://localhost:8080/rest/push
>
> I'm not sure if XML can be pasted like that, perhaps some escaping will
> need to be done, but either way, when dealing with complex query
> parameters, perhaps two options are available :
>
> 1. Add a static valueOf(String s) method to MyObject :
>
> class MyObject {
> public static MyObject valueOf(String xmlString) {
> // convert that XML into an instance of MyObject somehow
> }
>
> and then just do
>
> Response post(@QueryParam("X") MyObject o) {...}
>
>
> 2. Have a custom MessageBodyReader for MyObject, in its readFrom() method
> ignore the input stream, but instead deserialize the given query parameter
> into MyObject. For this to work, an instance of JAX-RS UriInfo will need
> to be injected into a custom reader's @Context-annotated field of type
> UriInfo by the runtime, UriInfo will provide an access to query
> parameters. CXF though does not support yet the injection of context
> fields so at the tine being option1 would be the way to go.
>
> and then just do
>
> Response post(MyObject o) {...}
>
>
> Cheers, Sergey
>
>>
>>
>> John Baker
>> --
>> Web SSO
>> IT Infrastructure
>> Deutsche Bank London
>>
>> URL: http://websso.cto.gt.intranet.db.com
>>
>>
>>
>>
>> "Sergey Beryozkin" <se...@iona.com>
>> 12/05/2008 11:58
>> Please respond to
>> users@cxf.apache.org
>>
>>
>> To
>> <us...@cxf.apache.org>
>> cc
>> <us...@cxf.apache.org>
>> Subject
>> Re: HTTP multipart/form-data and REST
>>
>>
>>
>>
>>
>>
>> I'm feeling so slow myself :-), it it because it's Monday ?
>>
>>
>>> Hi,
>>>
>>> I'm talking about deserialising to an object - I've been looking at
>>> JAXBElementProvider which I assume is the default provider for:
>>>
>>> public Response post(MyObject o);
>>
>> JAXBElementProvider is a default provider for serializing/deserilizing
>> JAXB-annotated classes, when application/xml media type is
>> used...On input, it will take the whole input body and attempt to
>> deserialize it, on output it will take the response entity and
>> serialize it into the provided output stream...
>>
>>>
>>> and I want to submit the XML with the parameter 'X' and deserialise to
>>> MyObject.
>>
>> I really don't understand it. Can you please elaborate on what does it
>> mean to 'submit the XML with the parameter 'X'' ?
>>
>> Cheers, Sergey
>>
>>>
>>>
>>> John Baker
>>> --
>>> Web SSO
>>> IT Infrastructure
>>> Deutsche Bank London
>>>
>>> URL: http://websso.cto.gt.intranet.db.com
>>>
>>>
>>>
>>>
>>> "Sergey Beryozkin" <se...@iona.com>
>>> 12/05/2008 11:34
>>> Please respond to
>>> users@cxf.apache.org
>>>
>>>
>>> To
>>> <us...@cxf.apache.org>
>>> cc
>>> <us...@cxf.apache.org>
>>> Subject
>>> Re: HTTP multipart/form-data and REST
>>>
>>>
>>>
>>>
>>>
>>>
>>> Hi,
>>>
>>>
>>>> Sergey,
>>>>
>>>> Thanks for updating the docs and there's no need to apologise for a
>>> delay
>>>> in responding (in reference to another mail you sent) - your rapid
>>>> feedback on responses is most welcome to those of us in a corporate
>>> world
>>>> trying to demonstrate that open source is often better than close (BEA
>>>> have a lot to learn!).
>>>
>>> thanks :-)
>>>
>>>>
>>>> So consider my example - I'd like to deserialise the value of
> parameter
>>> X,
>>>> instead of deserialising the body of the POST. How do I go about
> this?
>>> I
>>>> appreciate I need to write a message body reader bu what does the
>>>> deserializing?
>>>
>>> Lets assume a request looks like this :
>>>
>>> POST /service?param1=1¶m2=2
>>>
>>> <someXML/>
>>>
>>> When you say 'deserialise the value of parameter X', do you refer to
>> query
>>> parameters like 'param1' above ?
>>> If yes then yiu just need to use @QueryParam :
>>>
>>> Response post(@QueryParam("param1") String p1)
>>>
>>> The query parameter param1 will be converted into a String or it can be
>>> converted into other type like Long or Integer which have a
>>> constructor accepting a string and/or valueOf(String) method...
>>>
>>> Or are you referring to deserializing some pieces from the <someXML/>
>> body
>>> ? You were talking about dealing with multipart/form-data
>>> earlier, is it still the problem we're discussing here ?
>>>
>>> Cheers, Sergey
>>>
>>>
>>>>
>>>>
>>>> John Baker
>>>> --
>>>> Web SSO
>>>> IT Infrastructure
>>>> Deutsche Bank London
>>>>
>>>> URL: http://websso.cto.gt.intranet.db.com
>>>>
>>>>
>>>
>>> ----------------------------
>>> 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.
>>
>> ----------------------------
>> 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.
>
> ----------------------------
> 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.
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: HTTP multipart/form-data and REST
Posted by John-M Baker <jo...@db.com>.
Indeed, encoding is performed - I was just illustrating the concept
because the browser would encode the XML.
I don't understand option 2 but I'm still not quite sure I've made my
point clear. CXF currently has no problems using JAXBElementProvider to
deserialise the contents of a POST, so why can't we make it work for an
HTTP parameter? Why is it so hard to implement some logic to say, "If
there's no parameters submitted then take the entire submission and
deserialise - as is already the case - but if there's name/value
parameters then use the value of parameter X and process with
JAXBElementProvider".
Surely this could be achieved through option 1 without a specific valueOf
method - you have all the code!
John Baker
--
Web SSO
IT Infrastructure
Deutsche Bank London
URL: http://websso.cto.gt.intranet.db.com
"Sergey Beryozkin" <se...@iona.com>
12/05/2008 13:28
Please respond to
users@cxf.apache.org
To
<us...@cxf.apache.org>
cc
<us...@cxf.apache.org>
Subject
Re: HTTP multipart/form-data and REST
Hi,
> http://localhost:8080/rest/push?X=<moo />
>
> I want to build an interface where a user can paste XML into a web form
> and press submit. As opposed to doing wget --post-file test.xml
> http://localhost:8080/rest/push
I'm not sure if XML can be pasted like that, perhaps some escaping will
need to be done, but either way, when dealing with complex query
parameters, perhaps two options are available :
1. Add a static valueOf(String s) method to MyObject :
class MyObject {
public static MyObject valueOf(String xmlString) {
// convert that XML into an instance of MyObject somehow
}
and then just do
Response post(@QueryParam("X") MyObject o) {...}
2. Have a custom MessageBodyReader for MyObject, in its readFrom() method
ignore the input stream, but instead deserialize the given query parameter
into MyObject. For this to work, an instance of JAX-RS UriInfo will need
to be injected into a custom reader's @Context-annotated field of type
UriInfo by the runtime, UriInfo will provide an access to query
parameters. CXF though does not support yet the injection of context
fields so at the tine being option1 would be the way to go.
and then just do
Response post(MyObject o) {...}
Cheers, Sergey
>
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
>
>
> "Sergey Beryozkin" <se...@iona.com>
> 12/05/2008 11:58
> Please respond to
> users@cxf.apache.org
>
>
> To
> <us...@cxf.apache.org>
> cc
> <us...@cxf.apache.org>
> Subject
> Re: HTTP multipart/form-data and REST
>
>
>
>
>
>
> I'm feeling so slow myself :-), it it because it's Monday ?
>
>
>> Hi,
>>
>> I'm talking about deserialising to an object - I've been looking at
>> JAXBElementProvider which I assume is the default provider for:
>>
>> public Response post(MyObject o);
>
> JAXBElementProvider is a default provider for serializing/deserilizing
> JAXB-annotated classes, when application/xml media type is
> used...On input, it will take the whole input body and attempt to
> deserialize it, on output it will take the response entity and
> serialize it into the provided output stream...
>
>>
>> and I want to submit the XML with the parameter 'X' and deserialise to
>> MyObject.
>
> I really don't understand it. Can you please elaborate on what does it
> mean to 'submit the XML with the parameter 'X'' ?
>
> Cheers, Sergey
>
>>
>>
>> John Baker
>> --
>> Web SSO
>> IT Infrastructure
>> Deutsche Bank London
>>
>> URL: http://websso.cto.gt.intranet.db.com
>>
>>
>>
>>
>> "Sergey Beryozkin" <se...@iona.com>
>> 12/05/2008 11:34
>> Please respond to
>> users@cxf.apache.org
>>
>>
>> To
>> <us...@cxf.apache.org>
>> cc
>> <us...@cxf.apache.org>
>> Subject
>> Re: HTTP multipart/form-data and REST
>>
>>
>>
>>
>>
>>
>> Hi,
>>
>>
>>> Sergey,
>>>
>>> Thanks for updating the docs and there's no need to apologise for a
>> delay
>>> in responding (in reference to another mail you sent) - your rapid
>>> feedback on responses is most welcome to those of us in a corporate
>> world
>>> trying to demonstrate that open source is often better than close (BEA
>>> have a lot to learn!).
>>
>> thanks :-)
>>
>>>
>>> So consider my example - I'd like to deserialise the value of
parameter
>> X,
>>> instead of deserialising the body of the POST. How do I go about
this?
>> I
>>> appreciate I need to write a message body reader bu what does the
>>> deserializing?
>>
>> Lets assume a request looks like this :
>>
>> POST /service?param1=1¶m2=2
>>
>> <someXML/>
>>
>> When you say 'deserialise the value of parameter X', do you refer to
> query
>> parameters like 'param1' above ?
>> If yes then yiu just need to use @QueryParam :
>>
>> Response post(@QueryParam("param1") String p1)
>>
>> The query parameter param1 will be converted into a String or it can be
>> converted into other type like Long or Integer which have a
>> constructor accepting a string and/or valueOf(String) method...
>>
>> Or are you referring to deserializing some pieces from the <someXML/>
> body
>> ? You were talking about dealing with multipart/form-data
>> earlier, is it still the problem we're discussing here ?
>>
>> Cheers, Sergey
>>
>>
>>>
>>>
>>> John Baker
>>> --
>>> Web SSO
>>> IT Infrastructure
>>> Deutsche Bank London
>>>
>>> URL: http://websso.cto.gt.intranet.db.com
>>>
>>>
>>
>> ----------------------------
>> 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.
>
> ----------------------------
> 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.
----------------------------
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.
Re: HTTP multipart/form-data and REST
Posted by Sergey Beryozkin <se...@iona.com>.
Hi,
> http://localhost:8080/rest/push?X=<moo />
>
> I want to build an interface where a user can paste XML into a web form
> and press submit. As opposed to doing wget --post-file test.xml
> http://localhost:8080/rest/push
I'm not sure if XML can be pasted like that, perhaps some escaping will need to be done, but either way, when dealing with complex query parameters, perhaps two options are available :
1. Add a static valueOf(String s) method to MyObject :
class MyObject {
public static MyObject valueOf(String xmlString) {
// convert that XML into an instance of MyObject somehow
}
and then just do
Response post(@QueryParam("X") MyObject o) {...}
2. Have a custom MessageBodyReader for MyObject, in its readFrom() method ignore the input stream, but instead deserialize the given query parameter into MyObject. For this to work, an instance of JAX-RS UriInfo will need to be injected into a custom reader's @Context-annotated field of type UriInfo by the runtime, UriInfo will provide an access to query parameters. CXF though does not support yet the injection of context fields so at the tine being option1 would be the way to go.
and then just do
Response post(MyObject o) {...}
Cheers, Sergey
>
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
>
>
> "Sergey Beryozkin" <se...@iona.com>
> 12/05/2008 11:58
> Please respond to
> users@cxf.apache.org
>
>
> To
> <us...@cxf.apache.org>
> cc
> <us...@cxf.apache.org>
> Subject
> Re: HTTP multipart/form-data and REST
>
>
>
>
>
>
> I'm feeling so slow myself :-), it it because it's Monday ?
>
>
>> Hi,
>>
>> I'm talking about deserialising to an object - I've been looking at
>> JAXBElementProvider which I assume is the default provider for:
>>
>> public Response post(MyObject o);
>
> JAXBElementProvider is a default provider for serializing/deserilizing
> JAXB-annotated classes, when application/xml media type is
> used...On input, it will take the whole input body and attempt to
> deserialize it, on output it will take the response entity and
> serialize it into the provided output stream...
>
>>
>> and I want to submit the XML with the parameter 'X' and deserialise to
>> MyObject.
>
> I really don't understand it. Can you please elaborate on what does it
> mean to 'submit the XML with the parameter 'X'' ?
>
> Cheers, Sergey
>
>>
>>
>> John Baker
>> --
>> Web SSO
>> IT Infrastructure
>> Deutsche Bank London
>>
>> URL: http://websso.cto.gt.intranet.db.com
>>
>>
>>
>>
>> "Sergey Beryozkin" <se...@iona.com>
>> 12/05/2008 11:34
>> Please respond to
>> users@cxf.apache.org
>>
>>
>> To
>> <us...@cxf.apache.org>
>> cc
>> <us...@cxf.apache.org>
>> Subject
>> Re: HTTP multipart/form-data and REST
>>
>>
>>
>>
>>
>>
>> Hi,
>>
>>
>>> Sergey,
>>>
>>> Thanks for updating the docs and there's no need to apologise for a
>> delay
>>> in responding (in reference to another mail you sent) - your rapid
>>> feedback on responses is most welcome to those of us in a corporate
>> world
>>> trying to demonstrate that open source is often better than close (BEA
>>> have a lot to learn!).
>>
>> thanks :-)
>>
>>>
>>> So consider my example - I'd like to deserialise the value of parameter
>> X,
>>> instead of deserialising the body of the POST. How do I go about this?
>> I
>>> appreciate I need to write a message body reader bu what does the
>>> deserializing?
>>
>> Lets assume a request looks like this :
>>
>> POST /service?param1=1¶m2=2
>>
>> <someXML/>
>>
>> When you say 'deserialise the value of parameter X', do you refer to
> query
>> parameters like 'param1' above ?
>> If yes then yiu just need to use @QueryParam :
>>
>> Response post(@QueryParam("param1") String p1)
>>
>> The query parameter param1 will be converted into a String or it can be
>> converted into other type like Long or Integer which have a
>> constructor accepting a string and/or valueOf(String) method...
>>
>> Or are you referring to deserializing some pieces from the <someXML/>
> body
>> ? You were talking about dealing with multipart/form-data
>> earlier, is it still the problem we're discussing here ?
>>
>> Cheers, Sergey
>>
>>
>>>
>>>
>>> John Baker
>>> --
>>> Web SSO
>>> IT Infrastructure
>>> Deutsche Bank London
>>>
>>> URL: http://websso.cto.gt.intranet.db.com
>>>
>>>
>>
>> ----------------------------
>> 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.
>
> ----------------------------
> 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.
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: HTTP multipart/form-data and REST
Posted by John-M Baker <jo...@db.com>.
http://localhost:8080/rest/push?X=<moo />
I want to build an interface where a user can paste XML into a web form
and press submit. As opposed to doing wget --post-file test.xml
http://localhost:8080/rest/push
John Baker
--
Web SSO
IT Infrastructure
Deutsche Bank London
URL: http://websso.cto.gt.intranet.db.com
"Sergey Beryozkin" <se...@iona.com>
12/05/2008 11:58
Please respond to
users@cxf.apache.org
To
<us...@cxf.apache.org>
cc
<us...@cxf.apache.org>
Subject
Re: HTTP multipart/form-data and REST
I'm feeling so slow myself :-), it it because it's Monday ?
> Hi,
>
> I'm talking about deserialising to an object - I've been looking at
> JAXBElementProvider which I assume is the default provider for:
>
> public Response post(MyObject o);
JAXBElementProvider is a default provider for serializing/deserilizing
JAXB-annotated classes, when application/xml media type is
used...On input, it will take the whole input body and attempt to
deserialize it, on output it will take the response entity and
serialize it into the provided output stream...
>
> and I want to submit the XML with the parameter 'X' and deserialise to
> MyObject.
I really don't understand it. Can you please elaborate on what does it
mean to 'submit the XML with the parameter 'X'' ?
Cheers, Sergey
>
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
>
>
> "Sergey Beryozkin" <se...@iona.com>
> 12/05/2008 11:34
> Please respond to
> users@cxf.apache.org
>
>
> To
> <us...@cxf.apache.org>
> cc
> <us...@cxf.apache.org>
> Subject
> Re: HTTP multipart/form-data and REST
>
>
>
>
>
>
> Hi,
>
>
>> Sergey,
>>
>> Thanks for updating the docs and there's no need to apologise for a
> delay
>> in responding (in reference to another mail you sent) - your rapid
>> feedback on responses is most welcome to those of us in a corporate
> world
>> trying to demonstrate that open source is often better than close (BEA
>> have a lot to learn!).
>
> thanks :-)
>
>>
>> So consider my example - I'd like to deserialise the value of parameter
> X,
>> instead of deserialising the body of the POST. How do I go about this?
> I
>> appreciate I need to write a message body reader bu what does the
>> deserializing?
>
> Lets assume a request looks like this :
>
> POST /service?param1=1¶m2=2
>
> <someXML/>
>
> When you say 'deserialise the value of parameter X', do you refer to
query
> parameters like 'param1' above ?
> If yes then yiu just need to use @QueryParam :
>
> Response post(@QueryParam("param1") String p1)
>
> The query parameter param1 will be converted into a String or it can be
> converted into other type like Long or Integer which have a
> constructor accepting a string and/or valueOf(String) method...
>
> Or are you referring to deserializing some pieces from the <someXML/>
body
> ? You were talking about dealing with multipart/form-data
> earlier, is it still the problem we're discussing here ?
>
> Cheers, Sergey
>
>
>>
>>
>> John Baker
>> --
>> Web SSO
>> IT Infrastructure
>> Deutsche Bank London
>>
>> URL: http://websso.cto.gt.intranet.db.com
>>
>>
>
> ----------------------------
> 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.
----------------------------
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.
Re: HTTP multipart/form-data and REST
Posted by Sergey Beryozkin <se...@iona.com>.
I'm feeling so slow myself :-), it it because it's Monday ?
> Hi,
>
> I'm talking about deserialising to an object - I've been looking at
> JAXBElementProvider which I assume is the default provider for:
>
> public Response post(MyObject o);
JAXBElementProvider is a default provider for serializing/deserilizing JAXB-annotated classes, when application/xml media type is
used...On input, it will take the whole input body and attempt to deserialize it, on output it will take the response entity and
serialize it into the provided output stream...
>
> and I want to submit the XML with the parameter 'X' and deserialise to
> MyObject.
I really don't understand it. Can you please elaborate on what does it mean to 'submit the XML with the parameter 'X'' ?
Cheers, Sergey
>
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
>
>
> "Sergey Beryozkin" <se...@iona.com>
> 12/05/2008 11:34
> Please respond to
> users@cxf.apache.org
>
>
> To
> <us...@cxf.apache.org>
> cc
> <us...@cxf.apache.org>
> Subject
> Re: HTTP multipart/form-data and REST
>
>
>
>
>
>
> Hi,
>
>
>> Sergey,
>>
>> Thanks for updating the docs and there's no need to apologise for a
> delay
>> in responding (in reference to another mail you sent) - your rapid
>> feedback on responses is most welcome to those of us in a corporate
> world
>> trying to demonstrate that open source is often better than close (BEA
>> have a lot to learn!).
>
> thanks :-)
>
>>
>> So consider my example - I'd like to deserialise the value of parameter
> X,
>> instead of deserialising the body of the POST. How do I go about this?
> I
>> appreciate I need to write a message body reader bu what does the
>> deserializing?
>
> Lets assume a request looks like this :
>
> POST /service?param1=1¶m2=2
>
> <someXML/>
>
> When you say 'deserialise the value of parameter X', do you refer to query
> parameters like 'param1' above ?
> If yes then yiu just need to use @QueryParam :
>
> Response post(@QueryParam("param1") String p1)
>
> The query parameter param1 will be converted into a String or it can be
> converted into other type like Long or Integer which have a
> constructor accepting a string and/or valueOf(String) method...
>
> Or are you referring to deserializing some pieces from the <someXML/> body
> ? You were talking about dealing with multipart/form-data
> earlier, is it still the problem we're discussing here ?
>
> Cheers, Sergey
>
>
>>
>>
>> John Baker
>> --
>> Web SSO
>> IT Infrastructure
>> Deutsche Bank London
>>
>> URL: http://websso.cto.gt.intranet.db.com
>>
>>
>
> ----------------------------
> 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.
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: HTTP multipart/form-data and REST
Posted by John-M Baker <jo...@db.com>.
Hi,
I'm talking about deserialising to an object - I've been looking at
JAXBElementProvider which I assume is the default provider for:
public Response post(MyObject o);
and I want to submit the XML with the parameter 'X' and deserialise to
MyObject.
John Baker
--
Web SSO
IT Infrastructure
Deutsche Bank London
URL: http://websso.cto.gt.intranet.db.com
"Sergey Beryozkin" <se...@iona.com>
12/05/2008 11:34
Please respond to
users@cxf.apache.org
To
<us...@cxf.apache.org>
cc
<us...@cxf.apache.org>
Subject
Re: HTTP multipart/form-data and REST
Hi,
> Sergey,
>
> Thanks for updating the docs and there's no need to apologise for a
delay
> in responding (in reference to another mail you sent) - your rapid
> feedback on responses is most welcome to those of us in a corporate
world
> trying to demonstrate that open source is often better than close (BEA
> have a lot to learn!).
thanks :-)
>
> So consider my example - I'd like to deserialise the value of parameter
X,
> instead of deserialising the body of the POST. How do I go about this?
I
> appreciate I need to write a message body reader bu what does the
> deserializing?
Lets assume a request looks like this :
POST /service?param1=1¶m2=2
<someXML/>
When you say 'deserialise the value of parameter X', do you refer to query
parameters like 'param1' above ?
If yes then yiu just need to use @QueryParam :
Response post(@QueryParam("param1") String p1)
The query parameter param1 will be converted into a String or it can be
converted into other type like Long or Integer which have a
constructor accepting a string and/or valueOf(String) method...
Or are you referring to deserializing some pieces from the <someXML/> body
? You were talking about dealing with multipart/form-data
earlier, is it still the problem we're discussing here ?
Cheers, Sergey
>
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
----------------------------
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.
Re: HTTP multipart/form-data and REST
Posted by Sergey Beryozkin <se...@iona.com>.
Hi,
> Sergey,
>
> Thanks for updating the docs and there's no need to apologise for a delay
> in responding (in reference to another mail you sent) - your rapid
> feedback on responses is most welcome to those of us in a corporate world
> trying to demonstrate that open source is often better than close (BEA
> have a lot to learn!).
thanks :-)
>
> So consider my example - I'd like to deserialise the value of parameter X,
> instead of deserialising the body of the POST. How do I go about this? I
> appreciate I need to write a message body reader bu what does the
> deserializing?
Lets assume a request looks like this :
POST /service?param1=1¶m2=2
<someXML/>
When you say 'deserialise the value of parameter X', do you refer to query parameters like 'param1' above ?
If yes then yiu just need to use @QueryParam :
Response post(@QueryParam("param1") String p1)
The query parameter param1 will be converted into a String or it can be converted into other type like Long or Integer which have a
constructor accepting a string and/or valueOf(String) method...
Or are you referring to deserializing some pieces from the <someXML/> body ? You were talking about dealing with multipart/form-data
earlier, is it still the problem we're discussing here ?
Cheers, Sergey
>
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: HTTP multipart/form-data and REST
Posted by John-M Baker <jo...@db.com>.
Sergey,
Thanks for updating the docs and there's no need to apologise for a delay
in responding (in reference to another mail you sent) - your rapid
feedback on responses is most welcome to those of us in a corporate world
trying to demonstrate that open source is often better than close (BEA
have a lot to learn!).
So consider my example - I'd like to deserialise the value of parameter X,
instead of deserialising the body of the POST. How do I go about this? I
appreciate I need to write a message body reader bu what does the
deserializing?
John Baker
--
Web SSO
IT Infrastructure
Deutsche Bank London
URL: http://websso.cto.gt.intranet.db.com
"Sergey Beryozkin" <se...@iona.com>
12/05/2008 10:33
Please respond to
users@cxf.apache.org
To
<us...@cxf.apache.org>
cc
<us...@cxf.apache.org>
Subject
Re: HTTP multipart/form-data and REST
Hi John
I've updated the docs a bit, with more info about JAX-RS and custom
providers in particular, have a look please
http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html
>
> What object(s) currently deal with a straight POST submission and
convert
> into the required object? And how would I change this particular object
> for a given post submission? Perhaps I can simply extend it and add the
> code to deal with multipart?
It is message body readers that affect the way a request input stream is
converted into a given parameter type in a method. JAX-RS
mandates the support for some types like String, etc. If your application
needs to support a different type or it needs to override
the way one of the default types is dealt with by the runtime then
creating a custom message body reader is the way to go.
Cheers, Sergey
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
>
>
> "Sergey Beryozkin" <se...@iona.com>
> 08/05/2008 16:18
> Please respond to
> users@cxf.apache.org
>
>
> To
> <us...@cxf.apache.org>
> cc
> <us...@cxf.apache.org>
> Subject
> Re: HTTP multipart/form-data and REST
>
>
>
>
>
>
> Hi,
>
> My understanding is that one would typically use MultivaluedMap to
handle
> HTML form submissions.
> I don't think you can use MultivaluedMap for this kind of conversion.
>
> MessageBodyReaders implement readFrom() method. So if you would not like
> the application code be aware of multipart/form-encoded
> then you'd need to have a custom MessageBodyReader registered which will
> do the conversion from a multipart/form-data into the type
> expected by the application code.
> DataSource may make it easier tp deal with multipart/* requests, but CXF
> does not support it yet...
>
> Cheers, Sergey
>
> ----- Original Message -----
> From: "John-M Baker" <jo...@db.com>
> To: <us...@cxf.apache.org>
> Cc: <us...@cxf.apache.org>
> Sent: Thursday, May 08, 2008 2:57 PM
> Subject: Re: HTTP multipart/form-data and REST
>
>
>> Sergey,
>>
>> Sure, I'll raise a ticket when I get a moment. But can you explain to
> me
>> how I submit a parameter ('xml') and get an object, not the XML, from
> the
>> map?
>>
>> Thanks,
>>
>>
>> John Baker
>> --
>> Web SSO
>> IT Infrastructure
>> Deutsche Bank London
>>
>> URL: http://websso.cto.gt.intranet.db.com
>>
>>
>>
>>
>> "Sergey Beryozkin" <se...@iona.com>
>> 08/05/2008 12:33
>> Please respond to
>> users@cxf.apache.org
>>
>>
>> To
>> <us...@cxf.apache.org>
>> cc
>>
>> Subject
>> Re: HTTP multipart/form-data and REST
>>
>>
>>
>>
>>
>>
>> Hi
>>
>>> Response updateApplicationConfiguration(MultivaluedMap<String,String>
>>> params);
>>
>> This actually should work...
>> Perhaps you can do
>>
>> Response updateApplicationConfiguration(MetadataMap<String,String>
>> params);
>>
>> MetadataMap is the CXF implementation of MultivaluedMap interface...
>> The original signature should also work but I can't tell at the moment
>> whether the bug is in the actual message reader or in the
>> runtime code...Please open a JIRA to track this issue...
>>
>> Cheers, Sergey
>>
>> ----- Original Message -----
>> From: "John-M Baker" <jo...@db.com>
>> To: <us...@cxf.apache.org>
>> Sent: Thursday, May 08, 2008 9:15 AM
>> Subject: Re: HTTP multipart/form-data and REST
>>
>>
>>> My mistake, I meant to say:
>>>
>>> @POST
>>> @PUT
>>> @Path("/push/")
>>> @ConsumeMime("application/x-www-form-urlencoded")
>>> Response updateApplicationConfiguration(MultivaluedMap<String,String>
>>> params);
>>>
>>> However this results in:
>>>
>>> javax.ws.rs.core.MultivaluedMap does not have a no-arg default
>>> constructor.
>>> this problem is related to the following location:
>>> at javax.ws.rs.core.MultivaluedMap
>>> at private javax.ws.rs.core.MultivaluedMap
>>>
com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration.arg0
>>> at
> com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration
>>>
>>> Thoughts?
>>>
>>>
>>> John Baker
>>> --
>>> Web SSO
>>> IT Infrastructure
>>> Deutsche Bank London
>>>
>>> URL: http://websso.cto.gt.intranet.db.com
>>>
>>>
>>>
>>>
>>> John-M Baker <jo...@db.com>
>>> 08/05/2008 08:53
>>> Please respond to
>>> users@cxf.apache.org
>>>
>>>
>>> To
>>> users@cxf.apache.org
>>> cc
>>> users@cxf.apache.org
>>> Subject
>>> Re: HTTP multipart/form-data and REST
>>>
>>>
>>>
>>>
>>>
>>>
>>> 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" <se...@iona.com>
>>> 07/05/2008 17:09
>>> Please respond to
>>> users@cxf.apache.org
>>>
>>>
>>> To
>>> <us...@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" <se...@iona.com>
>>> To: <us...@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.
>>>
>>>
>>> ---
>>>
>>> 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
>>
>>
>>
>> ---
>>
>> 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
>
>
>
> ---
>
> 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
---
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.
Re: HTTP multipart/form-data and REST
Posted by Sergey Beryozkin <se...@iona.com>.
Hi John
I've updated the docs a bit, with more info about JAX-RS and custom providers in particular, have a look please
http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html
>
> What object(s) currently deal with a straight POST submission and convert
> into the required object? And how would I change this particular object
> for a given post submission? Perhaps I can simply extend it and add the
> code to deal with multipart?
It is message body readers that affect the way a request input stream is converted into a given parameter type in a method. JAX-RS
mandates the support for some types like String, etc. If your application needs to support a different type or it needs to override
the way one of the default types is dealt with by the runtime then creating a custom message body reader is the way to go.
Cheers, Sergey
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
>
>
> "Sergey Beryozkin" <se...@iona.com>
> 08/05/2008 16:18
> Please respond to
> users@cxf.apache.org
>
>
> To
> <us...@cxf.apache.org>
> cc
> <us...@cxf.apache.org>
> Subject
> Re: HTTP multipart/form-data and REST
>
>
>
>
>
>
> Hi,
>
> My understanding is that one would typically use MultivaluedMap to handle
> HTML form submissions.
> I don't think you can use MultivaluedMap for this kind of conversion.
>
> MessageBodyReaders implement readFrom() method. So if you would not like
> the application code be aware of multipart/form-encoded
> then you'd need to have a custom MessageBodyReader registered which will
> do the conversion from a multipart/form-data into the type
> expected by the application code.
> DataSource may make it easier tp deal with multipart/* requests, but CXF
> does not support it yet...
>
> Cheers, Sergey
>
> ----- Original Message -----
> From: "John-M Baker" <jo...@db.com>
> To: <us...@cxf.apache.org>
> Cc: <us...@cxf.apache.org>
> Sent: Thursday, May 08, 2008 2:57 PM
> Subject: Re: HTTP multipart/form-data and REST
>
>
>> Sergey,
>>
>> Sure, I'll raise a ticket when I get a moment. But can you explain to
> me
>> how I submit a parameter ('xml') and get an object, not the XML, from
> the
>> map?
>>
>> Thanks,
>>
>>
>> John Baker
>> --
>> Web SSO
>> IT Infrastructure
>> Deutsche Bank London
>>
>> URL: http://websso.cto.gt.intranet.db.com
>>
>>
>>
>>
>> "Sergey Beryozkin" <se...@iona.com>
>> 08/05/2008 12:33
>> Please respond to
>> users@cxf.apache.org
>>
>>
>> To
>> <us...@cxf.apache.org>
>> cc
>>
>> Subject
>> Re: HTTP multipart/form-data and REST
>>
>>
>>
>>
>>
>>
>> Hi
>>
>>> Response updateApplicationConfiguration(MultivaluedMap<String,String>
>>> params);
>>
>> This actually should work...
>> Perhaps you can do
>>
>> Response updateApplicationConfiguration(MetadataMap<String,String>
>> params);
>>
>> MetadataMap is the CXF implementation of MultivaluedMap interface...
>> The original signature should also work but I can't tell at the moment
>> whether the bug is in the actual message reader or in the
>> runtime code...Please open a JIRA to track this issue...
>>
>> Cheers, Sergey
>>
>> ----- Original Message -----
>> From: "John-M Baker" <jo...@db.com>
>> To: <us...@cxf.apache.org>
>> Sent: Thursday, May 08, 2008 9:15 AM
>> Subject: Re: HTTP multipart/form-data and REST
>>
>>
>>> My mistake, I meant to say:
>>>
>>> @POST
>>> @PUT
>>> @Path("/push/")
>>> @ConsumeMime("application/x-www-form-urlencoded")
>>> Response updateApplicationConfiguration(MultivaluedMap<String,String>
>>> params);
>>>
>>> However this results in:
>>>
>>> javax.ws.rs.core.MultivaluedMap does not have a no-arg default
>>> constructor.
>>> this problem is related to the following location:
>>> at javax.ws.rs.core.MultivaluedMap
>>> at private javax.ws.rs.core.MultivaluedMap
>>> com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration.arg0
>>> at
> com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration
>>>
>>> Thoughts?
>>>
>>>
>>> John Baker
>>> --
>>> Web SSO
>>> IT Infrastructure
>>> Deutsche Bank London
>>>
>>> URL: http://websso.cto.gt.intranet.db.com
>>>
>>>
>>>
>>>
>>> John-M Baker <jo...@db.com>
>>> 08/05/2008 08:53
>>> Please respond to
>>> users@cxf.apache.org
>>>
>>>
>>> To
>>> users@cxf.apache.org
>>> cc
>>> users@cxf.apache.org
>>> Subject
>>> Re: HTTP multipart/form-data and REST
>>>
>>>
>>>
>>>
>>>
>>>
>>> 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" <se...@iona.com>
>>> 07/05/2008 17:09
>>> Please respond to
>>> users@cxf.apache.org
>>>
>>>
>>> To
>>> <us...@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" <se...@iona.com>
>>> To: <us...@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.
>>>
>>>
>>> ---
>>>
>>> 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
>>
>>
>>
>> ---
>>
>> 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
>
>
>
> ---
>
> 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
Re: HTTP multipart/form-data and REST
Posted by John-M Baker <jo...@db.com>.
Sergey,
What object(s) currently deal with a straight POST submission and convert
into the required object? And how would I change this particular object
for a given post submission? Perhaps I can simply extend it and add the
code to deal with multipart?
John Baker
--
Web SSO
IT Infrastructure
Deutsche Bank London
URL: http://websso.cto.gt.intranet.db.com
"Sergey Beryozkin" <se...@iona.com>
08/05/2008 16:18
Please respond to
users@cxf.apache.org
To
<us...@cxf.apache.org>
cc
<us...@cxf.apache.org>
Subject
Re: HTTP multipart/form-data and REST
Hi,
My understanding is that one would typically use MultivaluedMap to handle
HTML form submissions.
I don't think you can use MultivaluedMap for this kind of conversion.
MessageBodyReaders implement readFrom() method. So if you would not like
the application code be aware of multipart/form-encoded
then you'd need to have a custom MessageBodyReader registered which will
do the conversion from a multipart/form-data into the type
expected by the application code.
DataSource may make it easier tp deal with multipart/* requests, but CXF
does not support it yet...
Cheers, Sergey
----- Original Message -----
From: "John-M Baker" <jo...@db.com>
To: <us...@cxf.apache.org>
Cc: <us...@cxf.apache.org>
Sent: Thursday, May 08, 2008 2:57 PM
Subject: Re: HTTP multipart/form-data and REST
> Sergey,
>
> Sure, I'll raise a ticket when I get a moment. But can you explain to
me
> how I submit a parameter ('xml') and get an object, not the XML, from
the
> map?
>
> Thanks,
>
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
>
>
> "Sergey Beryozkin" <se...@iona.com>
> 08/05/2008 12:33
> Please respond to
> users@cxf.apache.org
>
>
> To
> <us...@cxf.apache.org>
> cc
>
> Subject
> Re: HTTP multipart/form-data and REST
>
>
>
>
>
>
> Hi
>
>> Response updateApplicationConfiguration(MultivaluedMap<String,String>
>> params);
>
> This actually should work...
> Perhaps you can do
>
> Response updateApplicationConfiguration(MetadataMap<String,String>
> params);
>
> MetadataMap is the CXF implementation of MultivaluedMap interface...
> The original signature should also work but I can't tell at the moment
> whether the bug is in the actual message reader or in the
> runtime code...Please open a JIRA to track this issue...
>
> Cheers, Sergey
>
> ----- Original Message -----
> From: "John-M Baker" <jo...@db.com>
> To: <us...@cxf.apache.org>
> Sent: Thursday, May 08, 2008 9:15 AM
> Subject: Re: HTTP multipart/form-data and REST
>
>
>> My mistake, I meant to say:
>>
>> @POST
>> @PUT
>> @Path("/push/")
>> @ConsumeMime("application/x-www-form-urlencoded")
>> Response updateApplicationConfiguration(MultivaluedMap<String,String>
>> params);
>>
>> However this results in:
>>
>> javax.ws.rs.core.MultivaluedMap does not have a no-arg default
>> constructor.
>> this problem is related to the following location:
>> at javax.ws.rs.core.MultivaluedMap
>> at private javax.ws.rs.core.MultivaluedMap
>> com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration.arg0
>> at
com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration
>>
>> Thoughts?
>>
>>
>> John Baker
>> --
>> Web SSO
>> IT Infrastructure
>> Deutsche Bank London
>>
>> URL: http://websso.cto.gt.intranet.db.com
>>
>>
>>
>>
>> John-M Baker <jo...@db.com>
>> 08/05/2008 08:53
>> Please respond to
>> users@cxf.apache.org
>>
>>
>> To
>> users@cxf.apache.org
>> cc
>> users@cxf.apache.org
>> Subject
>> Re: HTTP multipart/form-data and REST
>>
>>
>>
>>
>>
>>
>> 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" <se...@iona.com>
>> 07/05/2008 17:09
>> Please respond to
>> users@cxf.apache.org
>>
>>
>> To
>> <us...@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" <se...@iona.com>
>> To: <us...@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.
>>
>>
>> ---
>>
>> 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
>
>
>
> ---
>
> 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
---
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.
Re: HTTP multipart/form-data and REST
Posted by Sergey Beryozkin <se...@iona.com>.
Hi,
My understanding is that one would typically use MultivaluedMap to handle HTML form submissions.
I don't think you can use MultivaluedMap for this kind of conversion.
MessageBodyReaders implement readFrom() method. So if you would not like the application code be aware of multipart/form-encoded
then you'd need to have a custom MessageBodyReader registered which will do the conversion from a multipart/form-data into the type
expected by the application code.
DataSource may make it easier tp deal with multipart/* requests, but CXF does not support it yet...
Cheers, Sergey
----- Original Message -----
From: "John-M Baker" <jo...@db.com>
To: <us...@cxf.apache.org>
Cc: <us...@cxf.apache.org>
Sent: Thursday, May 08, 2008 2:57 PM
Subject: Re: HTTP multipart/form-data and REST
> Sergey,
>
> Sure, I'll raise a ticket when I get a moment. But can you explain to me
> how I submit a parameter ('xml') and get an object, not the XML, from the
> map?
>
> Thanks,
>
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
>
>
> "Sergey Beryozkin" <se...@iona.com>
> 08/05/2008 12:33
> Please respond to
> users@cxf.apache.org
>
>
> To
> <us...@cxf.apache.org>
> cc
>
> Subject
> Re: HTTP multipart/form-data and REST
>
>
>
>
>
>
> Hi
>
>> Response updateApplicationConfiguration(MultivaluedMap<String,String>
>> params);
>
> This actually should work...
> Perhaps you can do
>
> Response updateApplicationConfiguration(MetadataMap<String,String>
> params);
>
> MetadataMap is the CXF implementation of MultivaluedMap interface...
> The original signature should also work but I can't tell at the moment
> whether the bug is in the actual message reader or in the
> runtime code...Please open a JIRA to track this issue...
>
> Cheers, Sergey
>
> ----- Original Message -----
> From: "John-M Baker" <jo...@db.com>
> To: <us...@cxf.apache.org>
> Sent: Thursday, May 08, 2008 9:15 AM
> Subject: Re: HTTP multipart/form-data and REST
>
>
>> My mistake, I meant to say:
>>
>> @POST
>> @PUT
>> @Path("/push/")
>> @ConsumeMime("application/x-www-form-urlencoded")
>> Response updateApplicationConfiguration(MultivaluedMap<String,String>
>> params);
>>
>> However this results in:
>>
>> javax.ws.rs.core.MultivaluedMap does not have a no-arg default
>> constructor.
>> this problem is related to the following location:
>> at javax.ws.rs.core.MultivaluedMap
>> at private javax.ws.rs.core.MultivaluedMap
>> com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration.arg0
>> at com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration
>>
>> Thoughts?
>>
>>
>> John Baker
>> --
>> Web SSO
>> IT Infrastructure
>> Deutsche Bank London
>>
>> URL: http://websso.cto.gt.intranet.db.com
>>
>>
>>
>>
>> John-M Baker <jo...@db.com>
>> 08/05/2008 08:53
>> Please respond to
>> users@cxf.apache.org
>>
>>
>> To
>> users@cxf.apache.org
>> cc
>> users@cxf.apache.org
>> Subject
>> Re: HTTP multipart/form-data and REST
>>
>>
>>
>>
>>
>>
>> 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" <se...@iona.com>
>> 07/05/2008 17:09
>> Please respond to
>> users@cxf.apache.org
>>
>>
>> To
>> <us...@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" <se...@iona.com>
>> To: <us...@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.
>>
>>
>> ---
>>
>> 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
>
>
>
> ---
>
> 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
Re: HTTP multipart/form-data and REST
Posted by John-M Baker <jo...@db.com>.
Sergey,
Sure, I'll raise a ticket when I get a moment. But can you explain to me
how I submit a parameter ('xml') and get an object, not the XML, from the
map?
Thanks,
John Baker
--
Web SSO
IT Infrastructure
Deutsche Bank London
URL: http://websso.cto.gt.intranet.db.com
"Sergey Beryozkin" <se...@iona.com>
08/05/2008 12:33
Please respond to
users@cxf.apache.org
To
<us...@cxf.apache.org>
cc
Subject
Re: HTTP multipart/form-data and REST
Hi
> Response updateApplicationConfiguration(MultivaluedMap<String,String>
> params);
This actually should work...
Perhaps you can do
Response updateApplicationConfiguration(MetadataMap<String,String>
params);
MetadataMap is the CXF implementation of MultivaluedMap interface...
The original signature should also work but I can't tell at the moment
whether the bug is in the actual message reader or in the
runtime code...Please open a JIRA to track this issue...
Cheers, Sergey
----- Original Message -----
From: "John-M Baker" <jo...@db.com>
To: <us...@cxf.apache.org>
Sent: Thursday, May 08, 2008 9:15 AM
Subject: Re: HTTP multipart/form-data and REST
> My mistake, I meant to say:
>
> @POST
> @PUT
> @Path("/push/")
> @ConsumeMime("application/x-www-form-urlencoded")
> Response updateApplicationConfiguration(MultivaluedMap<String,String>
> params);
>
> However this results in:
>
> javax.ws.rs.core.MultivaluedMap does not have a no-arg default
> constructor.
> this problem is related to the following location:
> at javax.ws.rs.core.MultivaluedMap
> at private javax.ws.rs.core.MultivaluedMap
> com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration.arg0
> at com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration
>
> Thoughts?
>
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
>
>
> John-M Baker <jo...@db.com>
> 08/05/2008 08:53
> Please respond to
> users@cxf.apache.org
>
>
> To
> users@cxf.apache.org
> cc
> users@cxf.apache.org
> Subject
> Re: HTTP multipart/form-data and REST
>
>
>
>
>
>
> 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" <se...@iona.com>
> 07/05/2008 17:09
> Please respond to
> users@cxf.apache.org
>
>
> To
> <us...@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" <se...@iona.com>
> To: <us...@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.
>
>
> ---
>
> 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
---
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.
Re: HTTP multipart/form-data and REST
Posted by Sergey Beryozkin <se...@iona.com>.
Hi
> Response updateApplicationConfiguration(MultivaluedMap<String,String>
> params);
This actually should work...
Perhaps you can do
Response updateApplicationConfiguration(MetadataMap<String,String> params);
MetadataMap is the CXF implementation of MultivaluedMap interface...
The original signature should also work but I can't tell at the moment whether the bug is in the actual message reader or in the
runtime code...Please open a JIRA to track this issue...
Cheers, Sergey
----- Original Message -----
From: "John-M Baker" <jo...@db.com>
To: <us...@cxf.apache.org>
Sent: Thursday, May 08, 2008 9:15 AM
Subject: Re: HTTP multipart/form-data and REST
> My mistake, I meant to say:
>
> @POST
> @PUT
> @Path("/push/")
> @ConsumeMime("application/x-www-form-urlencoded")
> Response updateApplicationConfiguration(MultivaluedMap<String,String>
> params);
>
> However this results in:
>
> javax.ws.rs.core.MultivaluedMap does not have a no-arg default
> constructor.
> this problem is related to the following location:
> at javax.ws.rs.core.MultivaluedMap
> at private javax.ws.rs.core.MultivaluedMap
> com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration.arg0
> at com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration
>
> Thoughts?
>
>
> John Baker
> --
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL: http://websso.cto.gt.intranet.db.com
>
>
>
>
> John-M Baker <jo...@db.com>
> 08/05/2008 08:53
> Please respond to
> users@cxf.apache.org
>
>
> To
> users@cxf.apache.org
> cc
> users@cxf.apache.org
> Subject
> Re: HTTP multipart/form-data and REST
>
>
>
>
>
>
> 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" <se...@iona.com>
> 07/05/2008 17:09
> Please respond to
> users@cxf.apache.org
>
>
> To
> <us...@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" <se...@iona.com>
> To: <us...@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.
>
>
> ---
>
> 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
Re: HTTP multipart/form-data and REST
Posted by John-M Baker <jo...@db.com>.
My mistake, I meant to say:
@POST
@PUT
@Path("/push/")
@ConsumeMime("application/x-www-form-urlencoded")
Response updateApplicationConfiguration(MultivaluedMap<String,String>
params);
However this results in:
javax.ws.rs.core.MultivaluedMap does not have a no-arg default
constructor.
this problem is related to the following location:
at javax.ws.rs.core.MultivaluedMap
at private javax.ws.rs.core.MultivaluedMap
com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration.arg0
at com.db.websso.rest.server.jaxws_asm.UpdateApplicationConfiguration
Thoughts?
John Baker
--
Web SSO
IT Infrastructure
Deutsche Bank London
URL: http://websso.cto.gt.intranet.db.com
John-M Baker <jo...@db.com>
08/05/2008 08:53
Please respond to
users@cxf.apache.org
To
users@cxf.apache.org
cc
users@cxf.apache.org
Subject
Re: HTTP multipart/form-data and REST
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" <se...@iona.com>
07/05/2008 17:09
Please respond to
users@cxf.apache.org
To
<us...@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" <se...@iona.com>
To: <us...@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.
---
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.
Re: HTTP multipart/form-data and REST
Posted by John-M Baker <jo...@db.com>.
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" <se...@iona.com>
07/05/2008 17:09
Please respond to
users@cxf.apache.org
To
<us...@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" <se...@iona.com>
To: <us...@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.
Re: HTTP multipart/form-data and REST
Posted by Sergey Beryozkin <se...@iona.com>.
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" <se...@iona.com>
To: <us...@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
Re: HTTP multipart/form-data and REST
Posted by Sergey Beryozkin <se...@iona.com>.
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