|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.Handler
org.restlet.resource.Resource
org.restlet.ext.wadl.WadlResource
public class WadlResource
Resource that is able to automatically describe itself with WADL. This
description can be customized by overriding the describe()
and
describeMethod(Method, MethodInfo)
methods.
When used to describe a class of resources in the context of a parent
application, a special instance will be created using the default constructor
(with no request, response associated). In this case, the resource should do
its best to return the generic information when the WADL description methods
are invoked, like describe()
and delegate methods.
Constructor Summary | |
---|---|
WadlResource()
Constructor. |
|
WadlResource(Context context,
Request request,
Response response)
Constructor. |
Method Summary | |
---|---|
boolean |
allowOptions()
Indicates if OPTIONS calls are allowed by checking the "readable" property. |
protected Representation |
describe()
Describes the resource as a WADL document. |
void |
describe(java.lang.String path,
ResourceInfo info)
Returns a WADL description of the current resource. |
protected Representation |
describe(Variant variant)
Describes the resource as a WADL document for the given variant. |
protected void |
describeDelete(MethodInfo info)
Describes the DELETE method. |
protected void |
describeGet(MethodInfo info)
Describes the GET method. By default, it describes the response with the available variants based on the Resource.getVariants() method. |
protected void |
describeMethod(Method method,
MethodInfo info)
Returns a WADL description of the given method. |
protected void |
describeOptions(MethodInfo info)
Describes the OPTIONS method. By default it describes the response with the available variants based on the getWadlVariants() method. |
protected void |
describePost(MethodInfo info)
Describes the POST method. |
protected void |
describePut(MethodInfo info)
Describes the PUT method. |
protected java.util.List<ParameterInfo> |
getParametersInfo()
Returns the description of the parameters of this resource. |
protected Variant |
getPreferredWadlVariant()
Returns the preferred WADL variant according to the client preferences specified in the request. |
protected java.lang.String |
getResourcePath()
Returns the resource's relative path. |
protected Reference |
getResourcesBase()
Returns the application resources base URI. |
java.lang.String |
getTitle()
Returns the title of this documented resource. |
protected java.util.List<Variant> |
getWadlVariants()
Returns the available WADL variants. |
void |
handleOptions()
|
boolean |
isAutoDescribed()
Indicates if the resource should be automatically described via WADL when an OPTIONS request is handled. |
boolean |
isDescribable(Method method)
Indicates if the given method exposes its WADL description. |
void |
setAutoDescribed(boolean autoDescribed)
Indicates if the resource should be automatically described via WADL when an OPTIONS request is handled. |
void |
setTitle(java.lang.String title)
Sets the title of this documented resource. |
Methods inherited from class org.restlet.resource.Resource |
---|
acceptRepresentation, allowDelete, allowGet, allowPost, allowPut, delete, getPreferredRepresentation, getPreferredVariant, getRepresentation, getVariants, handleDelete, handleGet, handlePost, handlePut, init, isAvailable, isModifiable, isNegotiateContent, isReadable, post, put, removeRepresentations, represent, represent, setAvailable, setModifiable, setNegotiateContent, setReadable, setVariants, storeRepresentation |
Methods inherited from class org.restlet.Handler |
---|
allowHead, generateRef, getAllowedMethods, getApplication, getContext, getLogger, getMatrix, getQuery, getRequest, getResponse, handleHead, setContext, setRequest, setResponse, updateAllowedMethods |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WadlResource()
public WadlResource(Context context, Request request, Response response)
context
- The parent context.request
- The request to handle.response
- The response to return.Method Detail |
---|
public boolean allowOptions()
allowOptions
in class Handler
protected Representation describe()
public void describe(java.lang.String path, ResourceInfo info)
path
- Path of the current resource.info
- WADL description of the current resource to update.protected Representation describe(Variant variant)
variant
- The WADL variant.
protected void describeDelete(MethodInfo info)
info
- The method description to update.protected void describeGet(MethodInfo info)
Resource.getVariants()
method. Thus in the majority of cases, the
method of the super class must be called when overriden.
info
- The method description to update.protected void describeMethod(Method method, MethodInfo info)
method
- The method to describe.info
- The method description to update.protected void describeOptions(MethodInfo info)
getWadlVariants()
method.
info
- The method description to update.protected void describePost(MethodInfo info)
info
- The method description to update.protected void describePut(MethodInfo info)
info
- The method description to update.protected java.util.List<ParameterInfo> getParametersInfo()
protected Variant getPreferredWadlVariant()
protected java.lang.String getResourcePath()
protected Reference getResourcesBase()
public java.lang.String getTitle()
protected java.util.List<Variant> getWadlVariants()
public void handleOptions()
handleOptions
in class Handler
public boolean isAutoDescribed()
public boolean isDescribable(Method method)
describe(String, ResourceInfo)
.
method
- The method
public void setAutoDescribed(boolean autoDescribed)
autoDescribed
- True if the resource should be automatically described via
WADL.public void setTitle(java.lang.String title)
title
- The title of this documented resource.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |