...
No Format |
---|
wadl2java -p <package-name> -sp <[schema-namespace =]package-name>* -tMap <schema-type = java-type>* -repMap <media-type = java-type>* -resource <resource-name> -b <binding-file-name>* -catalog <catalog-file-name> -d <output-directory> -compile -classdir <compile-classes-directory> -interface -impl -noTypes -inheritResourceParams -generateEnums -supportMultipleXmlReps -async<methodNames>* -responseType<methodNames>* -async<methodNames>* -xjc<xjc-arguments>* -h -v -verbose -quiet <wadl> |
Note 'tMap', 'repMap', 'noTypes' and 'inheritResourceParams' options are supported starting from CXF 2.6.3, 'noVoidForEmptyResponses' - from 2.6.4, '-async' - from 2.7.1, '-xjc' - from 2.7.4, 'responseType' - from 2.7.12/3.0.0
The options are reviewed in the following table.
Option | Interpretation |
---|---|
| Displays the online help for this utility and exits. |
| Specifies the package name of root resource classes |
| Specifies one or more package names corresponding to individual schema namespaces |
| Specifies a full name of root resource class if WADL contains a single resource |
| Default option unless -impl option is used - Java interfaces with JAX-RS annotations are generated |
| Generates starting implementation code. Can also be used with -interface option |
| Requests that no schema generation is needed. Can also be used with -tMap option |
| Provides mapping between schema elements and java types |
| Provides mapping between media types and java types |
| Specifies JAXB binding files. Use multiple -b flags to specify multiple entries. |
| Specifies catalog file to map referenced wadl/schemas |
| Specifies the directory into which the generated code files are written. |
| Compiles generated Java files. |
| Specifies the directory into which the compiled class files are written. |
| Generate JAX-RS Response instead of 'void' for methods with no response representations. |
| Get current resource-level path or matrix parameters added to generated methods for all descendant resources. |
| Generates Java enums for parameters with options. |
| Generates separate method for every XML representation in a single WADL request element. |
-generateResponse methodNames | Generates JAX-RS Response method response type, methodNames is a comma-separated list of WADL method name or id attributes |
| Adds JAX-RS 2.0 AsyncResponse parameter to generated methods, methodNames is a comma-separated list of WADL method name or id attributes |
| Specifies a comma separated list of arguments that are passed directly to the XJC processor, example -xjc-Xts. |
wadlurl | The path and name of the WADL file to use in generating the code. |
...
The 'repMap' option is similar and provides a mapping between the representations of a given media type and Java type. For example, if one has to process different XML representations in one method, a mapping like '-repMap application/xml=javax.xml.transform.Source' will work, affecting declarations like "<wadl:representation mediaTpe='application/xml'". Similarly CXF org.apache.cxf.jaxrs.ext.multipart.MultipartBody class can be linked to 'multipart/form-data' representations, etc.
The 'generateResponse' and 'async' options accept a comma separated list of method names, providing a single '*' (no quotes) as a method name will get these options affecting all of the generated methods.
JAXB customizations
At the moment it is possible to apply external JAXB customizations to WADL grammars however it is not possible yet to restrict a given customization to a specific WADL document or explicitly inlined schema. Linking binding to external schemas works, for example, the following bindings file can be used:
...