users@wadl.java.net

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

From: Gerard Davison <gerard.davison_at_oracle.com>
Date: Thu, 12 Jan 2012 10:52:12 +0000

Paul,

Can I ask what generator your are using?

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.

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