Package org.restlet.util
Class WrapperRestlet
- java.lang.Object
-
- org.restlet.Restlet
-
- org.restlet.util.WrapperRestlet
-
- All Implemented Interfaces:
Uniform
public class WrapperRestlet extends Restlet
Restlet wrapper. Useful for application developer who need to wrap a Restlet instance.- Author:
- Thierry Boileau
- See Also:
- The decorator (aka wrapper) pattern
-
-
Constructor Summary
Constructors Constructor Description WrapperRestlet(Restlet wrappedRestlet)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ApplicationgetApplication()Returns the parent application if it exists, or null.java.lang.StringgetAuthor()Returns the author(s).ContextgetContext()Returns the context.java.lang.StringgetDescription()Returns the description.java.util.logging.LoggergetLogger()Returns the context's logger.java.lang.StringgetName()Returns the display name.java.lang.StringgetOwner()Returns the owner(s).voidhandle(Request request, Response response)Handles a call.booleanisStarted()Indicates if the Restlet is started.booleanisStopped()Indicates if the Restlet is stopped.voidsetAuthor(java.lang.String author)Sets the author(s).voidsetContext(Context context)Sets the context.voidsetDescription(java.lang.String description)Sets the description.voidsetName(java.lang.String name)Sets the display name.voidsetOwner(java.lang.String owner)Sets the owner(s).voidstart()Starts the Restlet.voidstop()Stops the Restlet.-
Methods inherited from class org.restlet.Restlet
createFinder, finalize, getFinderClass, handle, handle, handle, setFinderClass
-
-
-
-
Constructor Detail
-
WrapperRestlet
public WrapperRestlet(Restlet wrappedRestlet)
Constructor.- Parameters:
wrappedRestlet- The wrapped Restlet instance.
-
-
Method Detail
-
getApplication
public Application getApplication()
Description copied from class:RestletReturns the parent application if it exists, or null.- Overrides:
getApplicationin classRestlet- Returns:
- The parent application if it exists, or null.
-
getAuthor
public java.lang.String getAuthor()
Description copied from class:RestletReturns the author(s).
-
getContext
public Context getContext()
Description copied from class:RestletReturns the context.- Overrides:
getContextin classRestlet- Returns:
- The context.
-
getDescription
public java.lang.String getDescription()
Description copied from class:RestletReturns the description.- Overrides:
getDescriptionin classRestlet- Returns:
- The description
-
getLogger
public java.util.logging.Logger getLogger()
Description copied from class:RestletReturns the context's logger.
-
getName
public java.lang.String getName()
Description copied from class:RestletReturns the display name.
-
getOwner
public java.lang.String getOwner()
Description copied from class:RestletReturns the owner(s).
-
handle
public void handle(Request request, Response response)
Description copied from class:RestletHandles a call. The default behavior is to initialize the Restlet by setting the current context using theContext.setCurrent(Context)method and by attempting to start it, unless it was already started. If an exception is thrown during the start action, then the response status is set toStatus.SERVER_ERROR_INTERNAL.Subclasses overriding this method should make sure that they call super.handle(request, response) before adding their own logic.
-
isStarted
public boolean isStarted()
Description copied from class:RestletIndicates if the Restlet is started.
-
isStopped
public boolean isStopped()
Description copied from class:RestletIndicates if the Restlet is stopped.
-
setAuthor
public void setAuthor(java.lang.String author)
Description copied from class:RestletSets the author(s).
-
setContext
public void setContext(Context context)
Description copied from class:RestletSets the context.- Overrides:
setContextin classRestlet- Parameters:
context- The context.
-
setDescription
public void setDescription(java.lang.String description)
Description copied from class:RestletSets the description.- Overrides:
setDescriptionin classRestlet- Parameters:
description- The description.
-
setName
public void setName(java.lang.String name)
Description copied from class:RestletSets the display name.
-
setOwner
public void setOwner(java.lang.String owner)
Description copied from class:RestletSets the owner(s).
-
start
public void start() throws java.lang.ExceptionDescription copied from class:RestletStarts the Restlet. By default its only sets "started" internal property to true. WARNING: this method must be called at the end of the starting process by subclasses otherwise concurrent threads could enter into the call handling logic too early.
-
stop
public void stop() throws java.lang.ExceptionDescription copied from class:RestletStops the Restlet. By default its only sets "started" internal property to false. WARNING: this method must be called at the beginning of the stopping process by subclasses otherwise concurrent threads could continue to (improperly) handle calls.
-
-