users@wadl.java.net

Re: Forcing specific return codes with <response status="XYZ">?

From: Paul Duffy <paduffy_at_cisco.com>
Date: Thu, 12 Jan 2012 21:47:54 -0800

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
>>
>>
>>
>