public class WadlGeneratorResourceDocSupport extends Object implements WadlGenerator
WadlGenerator
implementation that enhances the generated wadl by
information read from a resourcedoc (containing javadoc information about resource
classes).
The resourcedoc information can either be provided via a File
(setResourceDocFile(File)
) reference or
via an InputStream
(setResourceDocStream(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 |
---|
WadlGeneratorResourceDocSupport() |
WadlGeneratorResourceDocSupport(WadlGenerator wadlGenerator,
ResourceDocType resourceDoc) |
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(javax.ws.rs.core.UriInfo requestInfo) |
WadlGenerator.ExternalGrammarDefinition |
createExternalGrammar()
Perform any post create functions such as generating grammars.
|
Method |
createMethod(AbstractResource r,
AbstractResourceMethod m) |
Param |
createParam(AbstractResource r,
AbstractMethod m,
Parameter p) |
Request |
createRequest(AbstractResource r,
AbstractResourceMethod m) |
Representation |
createRequestRepresentation(AbstractResource r,
AbstractResourceMethod m,
javax.ws.rs.core.MediaType mediaType) |
Resource |
createResource(AbstractResource r,
String path) |
Resources |
createResources() |
List<Response> |
createResponses(AbstractResource r,
AbstractResourceMethod m) |
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 WadlGenerator.getRequiredJaxbContextPath() together with
your required context path (separated by a colon): |
void |
init()
Invoked before all methods related to wadl-building are invoked.
|
void |
setResourceDocFile(File resourceDocFile)
Set the
resourceDocFile to the given file. |
void |
setResourceDocStream(InputStream resourceDocStream)
Set the
resourceDocStream to the given file. |
void |
setWadlGeneratorDelegate(WadlGenerator delegate)
Sets the delegate that is decorated by this wadl generator.
|
public WadlGeneratorResourceDocSupport()
public WadlGeneratorResourceDocSupport(WadlGenerator wadlGenerator, ResourceDocType resourceDoc)
public void setWadlGeneratorDelegate(WadlGenerator delegate)
WadlGenerator
WadlGenerator.init()
or any setter method is invoked.setWadlGeneratorDelegate
in interface WadlGenerator
delegate
- the wadl generator to decoratepublic void setResourceDocFile(File resourceDocFile)
resourceDocFile
to the given file. Invoking this method is only allowed, as long as
the resourceDocStream
is not set, otherwise an IllegalStateException
will be thrown.resourceDocFile
- the resourcedoc file to set.public void setResourceDocStream(InputStream resourceDocStream)
resourceDocStream
to the given file. Invoking this method is only allowed, as long as
the resourceDocFile
is not set, otherwise an IllegalStateException
will be thrown.
The resourcedoc stream must be closed by the client providing the stream.
resourceDocStream
- the resourcedoc stream to set.public void init() throws Exception
WadlGenerator
this.delegate.init()
.init
in interface WadlGenerator
Exception
public String getRequiredJaxbContextPath()
WadlGenerator
WadlGenerator.setWadlGeneratorDelegate(WadlGenerator)
._delegate.getRequiredJaxbContextPath()
,
otherwise return the delegate's WadlGenerator.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 WadlGenerator
WadlGenerator.getRequiredJaxbContextPath()
of the delegate or the
WadlGenerator.getRequiredJaxbContextPath()
+ ":" + ${yourContextPath}.public Application createApplication(javax.ws.rs.core.UriInfo requestInfo)
createApplication
in interface WadlGenerator
Application
created by the delegatecom.sun.jersey.server.wadl.WadlGenerator#createApplication()
public Resource createResource(AbstractResource r, String path)
createResource
in interface WadlGenerator
r
- path
- Resource
WadlGenerator.createResource(com.sun.jersey.api.model.AbstractResource, java.lang.String)
public Method createMethod(AbstractResource r, AbstractResourceMethod m)
createMethod
in interface WadlGenerator
r
- m
- Method
WadlGenerator.createMethod(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod)
public Representation createRequestRepresentation(AbstractResource r, AbstractResourceMethod m, javax.ws.rs.core.MediaType mediaType)
createRequestRepresentation
in interface WadlGenerator
r
- m
- mediaType
- Representation
WadlGenerator.createRequestRepresentation(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod, javax.ws.rs.core.MediaType)
public Request createRequest(AbstractResource r, AbstractResourceMethod m)
createRequest
in interface WadlGenerator
r
- m
- Request
WadlGenerator.createRequest(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod)
public List<Response> createResponses(AbstractResource r, AbstractResourceMethod m)
createResponses
in interface WadlGenerator
r
- m
- Response
WadlGenerator.createResponses(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod)
public Param createParam(AbstractResource r, AbstractMethod m, Parameter p)
createParam
in interface WadlGenerator
r
- m
- p
- Param
WadlGenerator.createParam(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractMethod, com.sun.jersey.api.model.Parameter)
public Resources createResources()
createResources
in interface WadlGenerator
Resources
created by the delegateWadlGenerator.createResources()
public WadlGenerator.ExternalGrammarDefinition createExternalGrammar()
WadlGenerator
createExternalGrammar
in interface WadlGenerator
public void attachTypes(ApplicationDescription egd)
WadlGenerator
attachTypes
in interface WadlGenerator
egd
- The root description used to resolve these entriesCopyright © 2013 Oracle Corporation. All rights reserved.