@Deprecated public class WadlApplication extends Application
Application
subclass can describe
itself in WADL by introspecting its content, supporting the standard WADL/XML
format or a WADL/HTML one based on a built-in XSLT transformation. You can
obtain this representation with an OPTIONS request addressed exactly to the
application URI (e.g. "http://host:port/path/to/application"). By default,
the returned representation gleans the list of all attached
ServerResource
classes and calls Restlet.getName()
to get the title
and Restlet.getDescription()
the textual content of the WADL document
generated. This default behavior can be customized by overriding the
getApplicationInfo(Request, Response)
method.createWadlRepresentation(ApplicationInfo)
method and return an
instance of an WadlRepresentation
subclass overriding the
WadlRepresentation.getHtmlRepresentation()
method.Router
and for each resource found in the WADL document, it tries to
attach a ServerResource
class to the router using its WADL path. For
this, it looks up the qualified name of the ServerResource
subclass
using the WADL's "id" attribute of the "resource" elements. This is the only
Restlet specific convention on the original WADL document.attachToComponent(Component)
or the
attachToHost(VirtualHost)
methods. In this case, it uses the "base"
attribute of the WADL "resources" element as the URI attachment path to the
virtual host.Constructor and Description |
---|
WadlApplication()
Deprecated.
Creates an application that can automatically introspect and expose
itself as with a WADL description upon reception of an OPTIONS request on
the "*" target URI.
|
WadlApplication(Context context)
Deprecated.
Creates an application that can automatically introspect and expose
itself as with a WADL description upon reception of an OPTIONS request on
the "*" target URI.
|
WadlApplication(Context context,
Representation wadl)
Deprecated.
Creates an application described using a WADL document.
|
WadlApplication(Representation wadl)
Deprecated.
Creates an application described using a WADL document.
|
Modifier and Type | Method and Description |
---|---|
VirtualHost |
attachToComponent(Component component)
Deprecated.
Attaches the application to the given component if the application has a
WADL base reference.
|
void |
attachToHost(VirtualHost host)
Deprecated.
Attaches the application to the given host using the WADL base reference.
|
protected boolean |
canDescribe(java.lang.String remainingPart,
Request request,
Response response)
Deprecated.
Indicates if the application and all its resources can be described using
WADL.
|
protected Finder |
createFinder(Router router,
java.lang.String uriPattern,
ResourceInfo resourceInfo)
Deprecated.
Creates a finder for the given resource info.
|
protected Representation |
createHtmlRepresentation(ApplicationInfo applicationInfo)
Deprecated.
Creates a new HTML representation for a given
ApplicationInfo
instance describing an application. |
protected Representation |
createWadlRepresentation(ApplicationInfo applicationInfo)
Deprecated.
Creates a new WADL representation for a given
ApplicationInfo
instance describing an application. |
protected ApplicationInfo |
getApplicationInfo(Request request,
Response response)
Deprecated.
Returns a WADL description of the current application.
|
Reference |
getBaseRef()
Deprecated.
Returns the WADL base reference.
|
protected Variant |
getPreferredWadlVariant(Request request)
Deprecated.
Returns the preferred WADL variant according to the client preferences
specified in the request.
|
Router |
getRouter()
Deprecated.
Returns the router where the
ServerResource classes created from
the WADL description document are attached. |
protected java.util.List<Variant> |
getWadlVariants()
Deprecated.
Returns the available WADL variants.
|
void |
handle(Request request,
Response response)
Deprecated.
Handles the requests normally in all cases then handles the special case
of the OPTIONS requests that exactly target the application.
|
boolean |
isAutoDescribing()
Deprecated.
Indicates if the application should be automatically described via WADL
when an OPTIONS request handles a "*" target URI.
|
void |
setAutoDescribing(boolean autoDescribed)
Deprecated.
Indicates if the application should be automatically described via WADL
when an OPTIONS request handles a "*" target URI.
|
void |
setBaseRef(Reference baseRef)
Deprecated.
Sets the WADL base reference.
|
protected Representation |
wadlRepresent(Request request,
Response response)
Deprecated.
Represents the resource as a WADL description.
|
protected Representation |
wadlRepresent(Variant variant,
Request request,
Response response)
Deprecated.
Represents the resource as a WADL description for the given variant.
|
createInboundRoot, createOutboundRoot, getConnectorService, getConnegService, getConverterService, getCurrent, getDecoderService, getEncoderService, getInboundRoot, getMetadataService, getOutboundRoot, getRangeService, getRole, getRoles, getServices, getStatusService, getTaskService, getTunnelService, isDebugging, setConnectorService, setConnegService, setContext, setConverterService, setCurrent, setDebugging, setDecoderService, setEncoderService, setInboundRoot, setInboundRoot, setMetadataService, setOutboundRoot, setOutboundRoot, setRangeService, setRoles, setStatusService, setTaskService, setTunnelService, start, stop
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setDescription, setFinderClass, setName, setOwner
public WadlApplication()
public WadlApplication(Context context)
context
- The context to use based on parent component context. This
context should be created using the
Context.createChildContext()
method to ensure a proper
isolation with the other applications.public WadlApplication(Context context, Representation wadl)
setAutoDescribing(boolean)
.context
- The context to use based on parent component context. This
context should be created using the
Context.createChildContext()
method to ensure a proper
isolation with the other applications.wadl
- The WADL description document.public WadlApplication(Representation wadl)
setAutoDescribing(boolean)
.wadl
- The WADL description document.public VirtualHost attachToComponent(Component component)
component
- The parent component to update.public void attachToHost(VirtualHost host)
host
- The virtual host to attach to.protected boolean canDescribe(java.lang.String remainingPart, Request request, Response response)
remainingPart
- The URI remaining part.request
- The request to handle.response
- The response to update.protected Finder createFinder(Router router, java.lang.String uriPattern, ResourceInfo resourceInfo) throws java.lang.ClassNotFoundException
router
- The parent router.resourceInfo
- The WADL resource descriptor.java.lang.ClassNotFoundException
protected Representation createHtmlRepresentation(ApplicationInfo applicationInfo)
ApplicationInfo
instance describing an application.applicationInfo
- The application description.WadlRepresentation
.protected Representation createWadlRepresentation(ApplicationInfo applicationInfo)
ApplicationInfo
instance describing an application.applicationInfo
- The application description.WadlRepresentation
.protected ApplicationInfo getApplicationInfo(Request request, Response response)
request
- The current request.response
- The current response.public Reference getBaseRef()
protected Variant getPreferredWadlVariant(Request request)
request
- The request including client preferences.public Router getRouter()
ServerResource
classes created from
the WADL description document are attached.protected java.util.List<Variant> getWadlVariants()
public void handle(Request request, Response response)
getApplicationInfo(Request, Response)
method.handle
in interface Uniform
handle
in class Application
request
- The request to handle.response
- The response to update.public boolean isAutoDescribing()
public void setAutoDescribing(boolean autoDescribed)
autoDescribed
- True if the application should be automatically described via
WADL.public void setBaseRef(Reference baseRef)
baseRef
- The WADL base reference.protected Representation wadlRepresent(Request request, Response response)
request
- The current request.response
- The current response.protected Representation wadlRepresent(Variant variant, Request request, Response response)
variant
- The WADL variant.request
- The current request.response
- The current response.Copyright © 2005-2024 Restlet.