Package org.restlet.ext.wadl
Class WadlServerResource
- java.lang.Object
-
- org.restlet.resource.Resource
-
- org.restlet.resource.ServerResource
-
- org.restlet.ext.wadl.WadlServerResource
-
@Deprecated public class WadlServerResource extends ServerResource
Deprecated.Will be removed in next major release.Resource that is able to automatically describe itself with WADL. This description can be customized by overriding thedescribe()anddescribeMethod(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, likedescribe()and delegate methods.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanautoDescribingDeprecated.Indicates if the resource should be automatically described via WADL when an OPTIONS request is handled.private java.lang.StringdescriptionDeprecated.The description of this documented resource.private java.lang.StringnameDeprecated.The name of this documented resource.
-
Constructor Summary
Constructors Constructor Description WadlServerResource()Deprecated.Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancanDescribe(Method method)Deprecated.Indicates if the given method exposes its WADL description.protected RepresentationcreateHtmlRepresentation(ApplicationInfo applicationInfo)Deprecated.Creates a new HTML representation for a givenApplicationInfoinstance describing an application.protected RepresentationcreateWadlRepresentation(ApplicationInfo applicationInfo)Deprecated.Creates a new WADL representation for a givenApplicationInfoinstance describing an application.protected Representationdescribe()Deprecated.Describes the resource as a standalone WADL document.voiddescribe(java.lang.String path, ResourceInfo info)Deprecated.Returns a WADL description of the current resource.protected voiddescribe(ApplicationInfo applicationInfo)Deprecated.Updates the description of the parent application.protected RepresentationInfodescribe(MethodInfo methodInfo, java.lang.Class<?> representationClass, Variant variant)Deprecated.Describes a representation class and variant couple as WADL information.protected RepresentationInfodescribe(MethodInfo methodInfo, RequestInfo requestInfo, java.lang.Class<?> representationClass, Variant variant)Deprecated.Describes a representation class and variant couple as WADL information for the given method and request.protected RepresentationInfodescribe(MethodInfo methodInfo, ResponseInfo responseInfo, java.lang.Class<?> representationClass, Variant variant)Deprecated.Describes a representation class and variant couple as WADL information for the given method and response.voiddescribe(ResourceInfo info)Deprecated.Returns a WADL description of the current resource, leveraging thegetResourcePath()method.protected Representationdescribe(Variant variant)Deprecated.Describes the resource as a WADL document for the given variant.protected voiddescribeDelete(MethodInfo info)Deprecated.Describes the DELETE method.protected voiddescribeGet(MethodInfo info)Deprecated.Describes the GET method.
By default, it describes the response with the available variants based on theServerResource.getVariants()method.protected MethodInfodescribeMethod()Deprecated.Returns a WADL description of the current method.protected voiddescribeMethod(Method method, MethodInfo info)Deprecated.Returns a WADL description of the given method.protected voiddescribeOptions(MethodInfo info)Deprecated.Describes the OPTIONS method.
By default it describes the response with the available variants based on thegetWadlVariants()method.protected java.util.List<ParameterInfo>describeParameters()Deprecated.Returns the description of the parameters of this resource.protected voiddescribePatch(MethodInfo info)Deprecated.Describes the Patch method.protected voiddescribePost(MethodInfo info)Deprecated.Describes the POST method.protected voiddescribePut(MethodInfo info)Deprecated.Describes the PUT method.protected voiddoInit()Deprecated.Set-up method that can be overridden in order to initialize the state of the resource.java.lang.StringgetDescription()Deprecated.Returns the description of this documented resource.private Series<Header>getHeaders()Deprecated.Returns the set of headers as a collection ofParameterobjects.java.lang.StringgetName()Deprecated.Returns the name of this documented resource.protected NamedValue<java.lang.String>getParameter(java.lang.String name)Deprecated.Returns the first parameter found in the current context (entity, query, headers, etc) with the given name.protected Series<? extends NamedValue<java.lang.String>>getParameters(java.lang.String name)Deprecated.Returns a collection of parameters found in the current context (entity, query, headers, etc) given a parameter name.private Series<? extends NamedValue<java.lang.String>>getParameters(ParameterInfo parameterInfo)Deprecated.Returns a collection of parameters objects contained in the current context (entity, query, headers, etc) given a ParameterInfo instance.protected VariantgetPreferredWadlVariant()Deprecated.Returns the preferred WADL variant according to the client preferences specified in the request.protected java.lang.StringgetResourcePath()Deprecated.Returns the resource's relative path.protected ReferencegetResourcesBase()Deprecated.Returns the application resources base URI.protected java.util.List<Variant>getWadlVariants()Deprecated.Returns the available WADL variants.booleanisAutoDescribing()Deprecated.Indicates if the resource should be automatically described via WADL when an OPTIONS request is handled.Representationoptions()Deprecated.Indicates the communication options available for this resource.voidsetAutoDescribing(boolean autoDescribed)Deprecated.Indicates if the resource should be automatically described via WADL when an OPTIONS request is handled.voidsetDescription(java.lang.String description)Deprecated.Sets the description of this documented resource.voidsetName(java.lang.String name)Deprecated.Sets the name of this documented resource.-
Methods inherited from class org.restlet.resource.ServerResource
abort, commit, delete, delete, describeVariants, doCatch, doConditionalHandle, doError, doHandle, doHandle, doHandle, doNegotiatedHandle, get, get, getAnnotation, getAnnotation, getAnnotations, getAttribute, getInfo, getInfo, getOnSent, getPreferredVariant, getRole, getVariants, getVariants, handle, hasAnnotations, head, head, isAnnotated, isAutoCommitting, isCommitted, isConditional, isExisting, isInRole, isNegotiated, options, patch, patch, post, post, put, put, redirectPermanent, redirectPermanent, redirectSeeOther, redirectSeeOther, redirectTemporary, redirectTemporary, setAllowedMethods, setAnnotated, setAttribute, setAutoCommitting, setChallengeRequests, setCommitted, setConditional, setCookieSettings, setDimensions, setExisting, setLocationRef, setLocationRef, setNegotiated, setOnSent, setProxyChallengeRequests, setServerInfo, setStatus, setStatus, setStatus, setStatus, updateAllowedMethods, updateDimensions
-
Methods inherited from class org.restlet.resource.Resource
doError, doRelease, getAllowedMethods, getApplication, getChallengeRequests, getChallengeResponse, getClientInfo, getConditions, getConnegService, getContext, getConverterService, getCookies, getCookieSettings, getDimensions, getHostRef, getLocationRef, getLogger, getMatrix, getMatrixValue, getMaxForwards, getMetadataService, getMethod, getOriginalRef, getProtocol, getProxyChallengeRequests, getProxyChallengeResponse, getQuery, getQueryValue, getRanges, getReference, getReferrerRef, getRequest, getRequestAttributes, getRequestCacheDirectives, getRequestEntity, getResponse, getResponseAttributes, getResponseCacheDirectives, getResponseEntity, getRootRef, getServerInfo, getStatus, getStatusService, init, isConfidential, isLoggable, release, setApplication, setQueryValue, setRequest, setResponse, toBoolean, toByte, toDouble, toFloat, toInteger, toLong, toObject, toRepresentation, toRepresentation, toRepresentation, toShort, toString
-
-
-
-
Field Detail
-
autoDescribing
private volatile boolean autoDescribing
Deprecated.Indicates if the resource should be automatically described via WADL when an OPTIONS request is handled.
-
description
private volatile java.lang.String description
Deprecated.The description of this documented resource. Is seen as the text content of the "doc" tag of the "resource" element in a WADL document.
-
name
private volatile java.lang.String name
Deprecated.The name of this documented resource. Is seen as the title of the "doc" tag of the "resource" element in a WADL document.
-
-
Method Detail
-
canDescribe
public boolean canDescribe(Method method)
Deprecated.Indicates if the given method exposes its WADL description. By default, HEAD and OPTIONS are not exposed. This method is called bydescribe(String, ResourceInfo).- Parameters:
method- The method- Returns:
- True if the method exposes its description, false otherwise.
-
createHtmlRepresentation
protected Representation createHtmlRepresentation(ApplicationInfo applicationInfo)
Deprecated.Creates a new HTML representation for a givenApplicationInfoinstance describing an application.- Parameters:
applicationInfo- The application description.- Returns:
- The created
WadlRepresentation.
-
createWadlRepresentation
protected Representation createWadlRepresentation(ApplicationInfo applicationInfo)
Deprecated.Creates a new WADL representation for a givenApplicationInfoinstance describing an application.- Parameters:
applicationInfo- The application description.- Returns:
- The created
WadlRepresentation.
-
describe
protected Representation describe()
Deprecated.Describes the resource as a standalone WADL document.- Returns:
- The WADL description.
-
describe
protected void describe(ApplicationInfo applicationInfo)
Deprecated.Updates the description of the parent application. This is typically used to add documentation on global representations used by several methods or resources. Does nothing by default.- Parameters:
applicationInfo- The parent application.
-
describe
protected RepresentationInfo describe(MethodInfo methodInfo, java.lang.Class<?> representationClass, Variant variant)
Deprecated.Describes a representation class and variant couple as WADL information. The variant contains the target media type that can be converted to by one of the available Restlet converters.- Parameters:
methodInfo- The parent method description.representationClass- The representation bean class.variant- The target variant.- Returns:
- The WADL representation information.
-
describe
protected RepresentationInfo describe(MethodInfo methodInfo, RequestInfo requestInfo, java.lang.Class<?> representationClass, Variant variant)
Deprecated.Describes a representation class and variant couple as WADL information for the given method and request. The variant contains the target media type that can be converted to by one of the available Restlet converters.
By default, it callsdescribe(MethodInfo, Class, Variant).- Parameters:
methodInfo- The parent method description.requestInfo- The parent request description.representationClass- The representation bean class.variant- The target variant.- Returns:
- The WADL representation information.
-
describe
protected RepresentationInfo describe(MethodInfo methodInfo, ResponseInfo responseInfo, java.lang.Class<?> representationClass, Variant variant)
Deprecated.Describes a representation class and variant couple as WADL information for the given method and response. The variant contains the target media type that can be converted to by one of the available Restlet converters.
By default, it callsdescribe(MethodInfo, Class, Variant).- Parameters:
methodInfo- The parent method description.responseInfo- The parent response description.representationClass- The representation bean class.variant- The target variant.- Returns:
- The WADL representation information.
-
describe
public void describe(ResourceInfo info)
Deprecated.Returns a WADL description of the current resource, leveraging thegetResourcePath()method.- Parameters:
info- WADL description of the current resource to update.
-
describe
public void describe(java.lang.String path, ResourceInfo info)Deprecated.Returns a WADL description of the current resource.- Parameters:
path- Path of the current resource.info- WADL description of the current resource to update.
-
describe
protected Representation describe(Variant variant)
Deprecated.Describes the resource as a WADL document for the given variant.- Parameters:
variant- The WADL variant.- Returns:
- The WADL description.
-
describeDelete
protected void describeDelete(MethodInfo info)
Deprecated.Describes the DELETE method.- Parameters:
info- The method description to update.
-
describeGet
protected void describeGet(MethodInfo info)
Deprecated.Describes the GET method.
By default, it describes the response with the available variants based on theServerResource.getVariants()method. Thus in the majority of cases, the method of the super class must be called when overridden.- Parameters:
info- The method description to update.
-
describeMethod
protected MethodInfo describeMethod()
Deprecated.Returns a WADL description of the current method.- Returns:
- A WADL description of the current method.
-
describeMethod
protected void describeMethod(Method method, MethodInfo info)
Deprecated.Returns a WADL description of the given method.- Parameters:
method- The method to describe.info- The method description to update.
-
describeOptions
protected void describeOptions(MethodInfo info)
Deprecated.Describes the OPTIONS method.
By default it describes the response with the available variants based on thegetWadlVariants()method.- Parameters:
info- The method description to update.
-
describeParameters
protected java.util.List<ParameterInfo> describeParameters()
Deprecated.Returns the description of the parameters of this resource. Returns null by default.- Returns:
- The description of the parameters.
-
describePatch
protected void describePatch(MethodInfo info)
Deprecated.Describes the Patch method.- Parameters:
info- The method description to update.
-
describePost
protected void describePost(MethodInfo info)
Deprecated.Describes the POST method.- Parameters:
info- The method description to update.
-
describePut
protected void describePut(MethodInfo info)
Deprecated.Describes the PUT method.- Parameters:
info- The method description to update.
-
doInit
protected void doInit() throws ResourceExceptionDeprecated.Description copied from class:ResourceSet-up method that can be overridden in order to initialize the state of the resource. By default it does nothing.- Overrides:
doInitin classResource- Throws:
ResourceException- See Also:
Resource.init(Context, Request, Response)
-
getDescription
public java.lang.String getDescription()
Deprecated.Returns the description of this documented resource. Is seen as the text content of the "doc" tag of the "resource" element in a WADL document.- Overrides:
getDescriptionin classServerResource- Returns:
- The description of this documented resource.
-
getHeaders
private Series<Header> getHeaders()
Deprecated.Returns the set of headers as a collection ofParameterobjects.- Returns:
- The set of headers as a collection of
Parameterobjects.
-
getName
public java.lang.String getName()
Deprecated.Returns the name of this documented resource. Is seen as the title of the "doc" tag of the "resource" element in a WADL document.- Overrides:
getNamein classServerResource- Returns:
- The name of this documented resource.
-
getParameter
protected NamedValue<java.lang.String> getParameter(java.lang.String name)
Deprecated.Returns the first parameter found in the current context (entity, query, headers, etc) with the given name.- Parameters:
name- The parameter name.- Returns:
- The first parameter found with the given name.
-
getParameters
private Series<? extends NamedValue<java.lang.String>> getParameters(ParameterInfo parameterInfo)
Deprecated.Returns a collection of parameters objects contained in the current context (entity, query, headers, etc) given a ParameterInfo instance.- Parameters:
parameterInfo- The ParameterInfo instance.- Returns:
- A collection of parameters objects
-
getParameters
protected Series<? extends NamedValue<java.lang.String>> getParameters(java.lang.String name)
Deprecated.Returns a collection of parameters found in the current context (entity, query, headers, etc) given a parameter name. It returns null if the parameter name is unknown.- Parameters:
name- The name of the parameter.- Returns:
- A collection of parameters.
-
getPreferredWadlVariant
protected Variant getPreferredWadlVariant()
Deprecated.Returns the preferred WADL variant according to the client preferences specified in the request.- Returns:
- The preferred WADL variant.
-
getResourcePath
protected java.lang.String getResourcePath()
Deprecated.Returns the resource's relative path.- Returns:
- The resource's relative path.
-
getResourcesBase
protected Reference getResourcesBase()
Deprecated.Returns the application resources base URI.- Returns:
- The application resources base URI.
-
getWadlVariants
protected java.util.List<Variant> getWadlVariants()
Deprecated.Returns the available WADL variants.- Returns:
- The available WADL variants.
-
isAutoDescribing
public boolean isAutoDescribing()
Deprecated.Indicates if the resource should be automatically described via WADL when an OPTIONS request is handled.- Returns:
- True if the resource should be automatically described via WADL.
-
options
public Representation options()
Deprecated.Description copied from class:ServerResourceIndicates the communication options available for this resource. This method is only invoked if content negotiation has been disabled as indicated by theServerResource.isNegotiated(), otherwise theServerResource.options(Variant)method is invoked.
The default behavior is to set the response status toStatus.CLIENT_ERROR_METHOD_NOT_ALLOWED.- Overrides:
optionsin classServerResource- Returns:
- The optional response entity.
-
setAutoDescribing
public void setAutoDescribing(boolean autoDescribed)
Deprecated.Indicates if the resource should be automatically described via WADL when an OPTIONS request is handled.- Parameters:
autoDescribed- True if the resource should be automatically described via WADL.
-
setDescription
public void setDescription(java.lang.String description)
Deprecated.Sets the description of this documented resource. Is seen as the text content of the "doc" tag of the "resource" element in a WADL document.- Overrides:
setDescriptionin classServerResource- Parameters:
description- The description of this documented resource.
-
setName
public void setName(java.lang.String name)
Deprecated.Sets the name of this documented resource. Is seen as the title of the "doc" tag of the "resource" element in a WADL document.- Overrides:
setNamein classServerResource- Parameters:
name- The name of this documented resource.
-
-