users@jersey.java.net

Re: [Jersey] Client java stubs with Jersey

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 02 Sep 2009 09:28:41 -0400

Looks like a bug in the wadl2java tool, I guess it needs to somehow
include the request media type in the method name like it does for
response media types.

Marc.

On Sep 2, 2009, at 6:19 AM, xworker wrote:

>
> Hi
>
> One issue seems to be that the put operations gets generated twice,
> one for
> xml and one for json, but the method signature is the same, and
> therefore
> compiler gives errors. Ex:
>
> <code>
>
> public void put(DataSource input)
> throws IOException,
> MalformedURLException
> {
> HashMap<String, Object>
> _queryParameterValues = new HashMap<String, Object>();
> HashMap<String, Object>
> _headerParameterValues = new HashMap<String, Object>();
> String _url =
> _uriBuilder.buildUri(_templateAndMatrixParameterValues,
> _queryParameterValues);
> DataSource _retVal =
> _dsDispatcher.doPUT(input, "application/xml", _url,
> _headerParameterValues,
> null);
> return ;
> }
>
> public void put(DataSource input)
> throws IOException,
> MalformedURLException
> {
> HashMap<String, Object>
> _queryParameterValues = new HashMap<String, Object>();
> HashMap<String, Object>
> _headerParameterValues = new HashMap<String, Object>();
> String _url =
> _uriBuilder.buildUri(_templateAndMatrixParameterValues,
> _queryParameterValues);
> DataSource _retVal =
> _dsDispatcher.doPUT(input, "application/json", _url,
> _headerParameterValues,
> null);
> return ;
> }
>
> </code>
>
> I have generated my backend with the REST services from Netbeans
> with the
> "Creates RESTful web services from a set of entity classes." tool. The
> poduces code like this:
>
> @POST
> @Consumes({"application/xml", "application/json"})
> public Response post(ActivityConverter data) {
>
> It doesn't create two post methods, instead the above consumes both
> xml and
> json. The get methods gets generated correctly. I makes two methods,
> one for
> xml and one for json.
>
> /Andreas
>
>
>
> Paul Sandoz wrote:
>>
>> Hi,
>>
>> When you say IDE does not like, do you really mean the Java compiler
>> does not like i.e. the Java source cannot be compiled?
>>
>> You might be experiencing a bug in the wadl 2 Java conversion that
>> needs to be fixed.
>>
>> Have you tried emailing the users_at_wadl.dev.java.net?
>>
>> Paul.
>>
>> P.S. the WADL creator, Marc, is listening in on this list.
>>
>> On Sep 2, 2009, at 10:20 AM, xworker wrote:
>>>
>>> Hi
>>>
>>> Thanks for the swift reply. I have used the wadl2java tool, but it
>>> generates
>>> an Endpoint class wich my IDE (netbeans) doesn't like. It finds
>>> strange
>>> errors on every line. For example:
>>>
>>> Error postAs(javax.activation.DataSource) is already defined in
>>> xxx.ws.Endpoint.Industries Endpoint.java
>>>
>>> and
>>>
>>> Error xxx.ws.Endpoint.Industries.IndustryId.ActivitySet.ActivityId
>>> is
>>> already defined in xxx.ws.Endpoint.Industries.IndustryId.ActivitySet
>>> Endpoint.java
>>>
>>>
>>> The reason want entitys is that I use them on my JSF pages, for
>>> examples in
>>> datatables.
>>>
>>>
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/Client-java-stubs-with-Jersey-tp3565216p3565415.html
>>> Sent from the Jersey mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/Client-java-stubs-with-Jersey-tp3565216p3565893.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>