Hi Pascal

> I would like to know if i should create method like this :
>
>
> upload(String id, byte[] content, List<String> metadata)
>
> or
> upload(Report report)
>
> and if so how can I handle method like this :
>
> uploadAndProcess(Report report, List<DataContext> data, Options options);
>

As far as JAX-RS is concerned, you can have methods with multiple
parameters (including explicit collections)
but only a single method parameter can be mapped to a request payload,
other parameters, if any, can be mapped to various URI parts or HTTP
headers or JAX-RS Contexts.
Multipart attachment parts or form name/value pairs can be mapped to
multiple parameters, but generally speaking, a request payload has to
be represented by a single method parameter.

>
> So far I have no solution for the last case.
>
> I don't really want to create a custom request object for each method I
> create.

You don't have to. It seems that this issue is somewhat orthogonal to
the issue of how many input parameters a given resource method has.

thanks, Sergey

>



>
> Cheers, Pascal.
>
> 2011/6/7 Sergey Beryozkin <[email protected]>
>
>> Hi
>>
>>
>>
>> Would you like to have a shared signature for SOAP and REST services ?
>> You may want to have a method dedicated to serving SOAP requests only
>> and which would return say DataSource. That method may work for JAX-RS
>> too.
>>
>> And you may also try introducing a method which returns a JAXB bean
>> capturing the data - this will work for SOAP but also use CXF JAX-RS
>> RequestDispatcherProvider  to redirect to HTML-aware handlers or use
>> XSLTJaxbProvider
>>
>>
>> http://cxf.apache.org/docs/jax-rs-redirection.html#JAX-RSRedirection-WithRequestDispatcherProvider
>>
>> http://cxf.apache.org/docs/jax-rs-advanced-xml.html#JAX-RSAdvancedXML-XSLTsupport
>>
>> RequestDispatcherProvider and XSLTJaxbProvider are not 'intrusive' and
>> can help with separating the presentation logic from the main
>> controller code.
>>
>> Some users are combining Struts with CXF as well - but I've no experience
>> there
>>
>> Cheers, Sergey
>>
>> >
>> >
>> > --
>> > Pascal Leclercq
>> >
>>
>>
>>
>> --
>> Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>>
>
>
>
> --
> Pascal Leclercq
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Reply via email to