On 20 Jan 2012, at 17:06, Paul Duffy wrote:
> Thank's Gerard
>
> The Apache CXF wadl2java DOES generate server code, which I am using as a starting point ... thus my question re: that server code forcing return of error codes that may be trivially determined from the WADL.
Yes it should be possible.
>
> Let me ask a further question. I am trying to determine the center of wadl2java activity.
>
> There are multiple JAVA wadl2java implementations, correct? Sun's and Oracle's. Has the activity shifted to Apache CXF?
They appear to be two very different project that just happen to have the same name. The focus of the wadl.java.net project is just client generation at the moment, people don't seem to be asking for WADL->Service; but I guess that would change.
Let me have a look into it and see what I can find out,
Gerard
>
> Etc
>
> Thanks
>
>
>
> On 1/20/2012 4:48 AM, Gerard Davison wrote:
>>
>>
>> Hi,
>>
>> Sorry for the delay in getting back to you email filter issues, I hadn't actually heard of the wadl2Java tool before and from what you are saying it would seem reasonable that if the method always has a non-200 status code the the code generator should indeed generate some suitable boilerplate code, and make it return 405.
>>
>> For more complicated cases I guess the question comes down to what form of code it should generate ether using the response object:
>>
>> ReponseBuilder rb = .....
>> if ( case1 ) {
>> rb = rb.ok();
>> } else {
>> .....
>> }
>>
>> or using exceptions, this is hard to say what is the correct version. It probably comes down to you picking a format that feels right
>> and raising a bug on the tool you are using. It wouldn't be a very difficult change to implement. The wadl2Java tool on this mailing list only generates clients and doesn't yet produces services from a WADL.
>>
>> Gerard
>>
>>
>>
>>
>>
>> On 13/01/2012 05:47, Paul Duffy wrote:
>>> On 1/12/2012 2:52 AM, Gerard Davison wrote:
>>>> Paul,
>>>>
>>>> Can I ask what generator your are using?
>>>
>>> wadl2java Apache CXF 2.5.1
>>>
>>> There are others? Preferred generator?
>>>
>>>>
>>>> Generally you could fix the code to just return a Reponse rather than void, this would give you the control you like, or you can throw WebApplicationException with the status code if your prefer that way of working.
>>>
>>> I assume you mean manually modify the code. I of course could manually code the HTTP method handlers, but such a situation also greatly reduces my need to use WADL.
>>>
>>> What, if any, impact do variations in <response/> elements have on code generation?
>>>
>>> In the wadl example I offered below, why would wadl2java not auto gen the code to always return the 405 error?
>>>
>>> Cheers
>>>
>>>
>>>>
>>>> Gerard
>>>>
>>>>
>>>>
>>>>
>>>> On 11 Jan 2012, at 23:17, Paul Duffy wrote:
>>>>
>>>>> Folks,
>>>>>
>>>>> I'm doing an evaluation before recommending wider adoption of wadl. Appreciate your patience and efforts.
>>>>>
>>>>> First question. I seem unable to impact generated code with the status attribute on the<response/> element.
>>>>>
>>>>> Sample WADL ...
>>>>>
>>>>> <resource path="test">
>>>>> <method name="DELETE">
>>>>> <response status = "405"/>
>>>>> </method>
>>>>> </resource
>>>>>
>>>>> I seem unable to generate any but the following code...
>>>>>
>>>>> /**
>>>>> * Created by Apache CXF WadlToJava code generator
>>>>> **/
>>>>> package application;
>>>>>
>>>>> import javax.ws.rs.DELETE;
>>>>> import javax.ws.rs.Path;
>>>>>
>>>>> @Path("test")
>>>>> public class Test {
>>>>> @DELETE
>>>>> public void DELETETest() {
>>>>> //TODO: implement
>>>>> }
>>>>> }
>>>>>
>>>>> How does one force code generation for specific return status from the wadl?
>>>>>
>>>>> Cheers
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>