public class WadlGeneratorGrammarsSupport extends Object implements WadlGenerator
WadlGenerator adds the provided Grammars element to the
generated wadl-file.
The Grammars content can either be provided via a File (setGrammarsFile(File)) reference or
via an InputStream (setGrammarsStream(InputStream)).
The File should be used when using the maven-wadl-plugin for generating wadl offline,
the InputStream should be used when the extended wadl is generated by jersey at runtime, e.g.
using the WadlGeneratorConfig for configuration.
WadlGenerator.ExternalGrammarDefinition, WadlGenerator.Resolver| Constructor and Description |
|---|
WadlGeneratorGrammarsSupport() |
WadlGeneratorGrammarsSupport(WadlGenerator delegate,
Grammars grammars) |
| Modifier and Type | Method and Description |
|---|---|
void |
attachTypes(ApplicationDescription egd)
Process the elements in the WADL definition to attach schema types
as required.
|
Application |
createApplication() |
WadlGenerator.ExternalGrammarDefinition |
createExternalGrammar()
Perform any post create functions such as generating grammars.
|
Method |
createMethod(Resource ar,
ResourceMethod arm) |
Param |
createParam(Resource ar,
ResourceMethod am,
Parameter p) |
Request |
createRequest(Resource ar,
ResourceMethod arm) |
Representation |
createRequestRepresentation(Resource ar,
ResourceMethod arm,
javax.ws.rs.core.MediaType mt) |
Resource |
createResource(Resource ar,
String path) |
Resources |
createResources() |
List<Response> |
createResponses(Resource ar,
ResourceMethod arm) |
String |
getRequiredJaxbContextPath()
The jaxb context path that is used when the generated wadl application is marshalled
to a file.
This method is used in a decorator like manner. The result return the path (or a colon-separated list of package names) containing jaxb-beans that are added to wadl elements by this WadlGenerator, additionally to the context path of the decorated WadlGenerator (set by WadlGenerator.setWadlGeneratorDelegate(WadlGenerator).If you do not use custom jaxb beans, then simply return _delegate.getRequiredJaxbContextPath(),
otherwise return the delegate's #getRequiredJaxbContextPath() together with
your required context path (separated by a colon): |
void |
init()
Invoked before all methods related to wadl-building are invoked.
|
void |
setGrammarsFile(File grammarsFile) |
void |
setGrammarsStream(InputStream grammarsStream) |
void |
setOverrideGrammars(Boolean overrideGrammars) |
void |
setWadlGeneratorDelegate(WadlGenerator delegate)
Sets the delegate that is decorated by this wadl generator.
|
public WadlGeneratorGrammarsSupport()
public WadlGeneratorGrammarsSupport(WadlGenerator delegate, Grammars grammars)
public void setWadlGeneratorDelegate(WadlGenerator delegate)
WadlGeneratorWadlGenerator.init() or any setter method is invoked.setWadlGeneratorDelegate in interface WadlGeneratordelegate - the wadl generator to decoratepublic void setOverrideGrammars(Boolean overrideGrammars)
public String getRequiredJaxbContextPath()
WadlGeneratorWadlGenerator.setWadlGeneratorDelegate(WadlGenerator)._delegate.getRequiredJaxbContextPath(),
otherwise return the delegate's #getRequiredJaxbContextPath() together with
your required context path (separated by a colon):_delegate.getRequiredJaxbContextPath() == null
? ${yourContextPath}
: _delegate.getRequiredJaxbContextPath() + ":" + ${yourContextPath};
If you add the path for your custom jaxb beans, don't forget to add an
ObjectFactory (annotated with XmlRegistry) to this package.getRequiredJaxbContextPath in interface WadlGeneratorWadlGenerator.getRequiredJaxbContextPath() of the delegate or the
#getRequiredJaxbContextPath() + ":" + ${yourContextPath}.public void setGrammarsFile(File grammarsFile)
public void setGrammarsStream(InputStream grammarsStream)
public void init()
throws Exception
WadlGeneratorthis.delegate.init().init in interface WadlGeneratorIllegalStateExceptionJAXBExceptionExceptionpublic Application createApplication()
createApplication in interface WadlGeneratorWadlGenerator.createApplication()public Method createMethod(Resource ar, ResourceMethod arm)
createMethod in interface WadlGeneratorar - abstract resourcearm - abstract resource methodWadlGenerator.createMethod(org.glassfish.jersey.server.model.Resource,
org.glassfish.jersey.server.model.ResourceMethod)public Request createRequest(Resource ar, ResourceMethod arm)
createRequest in interface WadlGeneratorar - abstract resourcearm - abstract resource methodWadlGenerator.createRequest(org.glassfish.jersey.server.model.Resource,
org.glassfish.jersey.server.model.ResourceMethod)public Param createParam(Resource ar, ResourceMethod am, Parameter p)
createParam in interface WadlGeneratorar - abstract resourceam - abstract methodp - parameterWadlGenerator.createParam(org.glassfish.jersey.server.model.Resource,
org.glassfish.jersey.server.model.ResourceMethod, org.glassfish.jersey.server.model.Parameter)public Representation createRequestRepresentation(Resource ar, ResourceMethod arm, javax.ws.rs.core.MediaType mt)
createRequestRepresentation in interface WadlGeneratorar - abstract resourcearm - abstract resource methodmt - media typeWadlGenerator.createRequestRepresentation(org.glassfish.jersey.server.model.Resource,
org.glassfish.jersey.server.model.ResourceMethod, javax.ws.rs.core.MediaType)public Resource createResource(Resource ar, String path)
createResource in interface WadlGeneratorar - abstract resourcepath - resource pathWadlGenerator.createResource(org.glassfish.jersey.server.model.Resource, String)public Resources createResources()
createResources in interface WadlGeneratorWadlGenerator.createResources()public List<Response> createResponses(Resource ar, ResourceMethod arm)
createResponses in interface WadlGeneratorar - abstract resourcearm - abstract resource methodWadlGenerator.createResponses(org.glassfish.jersey.server.model.Resource,
org.glassfish.jersey.server.model.ResourceMethod)public WadlGenerator.ExternalGrammarDefinition createExternalGrammar()
WadlGeneratorcreateExternalGrammar in interface WadlGeneratorpublic void attachTypes(ApplicationDescription egd)
WadlGeneratorattachTypes in interface WadlGeneratoregd - The root description used to resolve these entriesCopyright © 2007-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.