users@jersey.java.net

Re: [Jersey] Is Jersey capable of Implementing File Post

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 19 Nov 2009 13:49:06 +0100

On Nov 19, 2009, at 1:15 PM, Anil Kumar Veeramalli wrote:
> in this case how my REST URL look like.

I am not sure what you mean by the above.

You might be interesting in watching my presentation i did last year
on JAX-RS @ Devoxx:

http://www.parleys.com/display/PARLEYS/
Home#slide=1;talk=30670858;title=JAX-RS%20the%20Java%20API%20for
%20RESTful%20Web%20Services


> I would like to explore more in this area. can you send me any links
> or resources which will help me to explore more.
>

You can look at the simple JAXB sample for using JAXB:

  http://download.java.net/maven/2/com/sun/jersey/samples/jaxb/1.1.4/jaxb-1.1.4-project.zip

See the following sample for adding your own reading/writing
functionality:

  http://download.java.net/maven/2/com/sun/jersey/samples/entity-provider/1.1.4/entity-provider-1.1.4-project.zip

We do not have a good file upload example available yet, but you can
find one here:

  http://markmail.org/message/quaoa3s73544vxfp?q=list:net.java.dev.jersey.users+fileupload+order:date-backward&page=1

Paul.

> Thanks,
> Anil
>
>
> Paul Sandoz wrote:
>>
>> On Nov 19, 2009, at 12:43 PM, Anil Kumar Veeramalli wrote:
>>
>>> Hi,
>>>
>>> Here is my requirement, Please suggest me whether Jersey API's are
>>> capable enough or not.
>>>
>>>
>>> 1) Build RESTful webservice which will consume the inbound XML
>>> documents. XML documents will be different every time when we
>>> invoke webserice.
>>
>> Yes. What XML API do you want to use to parse the XML documents?
>>
>> Although the XML documents will be different will the structure be
>> well-defined, namly will there be a schema or will it be possible
>> to unmarshall such documents using JAXB?
>>
>> JAX-RS/Jersey supports the types org.w3c.dom.Document as well as
>> StreamSource, SAXSource and DOMSource for processing request
>> entities.
>>
>> For example:
>>
>> @POST
>> public ... post(Document d) { ... }
>>
>> JAX-RS/Jersey also supports JAXB and is also capable of utilizing
>> the Object type if there is an unmarshaller capable of supporting
>> that by declaring a ContextResolver<JAXBContext> or
>> ContextResolver<Unmarshaller> that returns JAXBContext or
>> Unmarshaller for the type Object. I can send more details on that
>> if you require.
>>
>> You can also plug in your own API using the JAX-RS
>> MessageBodyWriter for any other XML-based APIs you might want to use.
>>
>>
>>> 2) Parse XML document and populate Mysql database.
>>>
>>> Step2 is possible its nothing to do with Jersey.
>>
>> Correct. That step could be very tricky of the structure if the set
>> of XML documents you consume is not defined by a schema (or does
>> not conform a well-defined structural pattern).
>>
>> Paul.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>