Package org.restlet.service
Class Service
java.lang.Object
org.restlet.service.Service
- Direct Known Subclasses:
ConnectorService,ConnegService,ConverterService,CorsService,DecoderService,EncoderService,LogService,MetadataService,RangeService,StatusService,TaskService,TunnelService
Generic service associated to a component or an application. The life cycle
of a service is tightly related to the one of the associated component or
application.
If you want to use a specific service, you can always disable it before it is actually started via the
If you want to use a specific service, you can always disable it before it is actually started via the
setEnabled(boolean) method.- Author:
- Jerome Louvel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateInboundFilter(Context context) Create the filter that should be invoked for incoming calls.createOutboundFilter(Context context) Create the filter that should be invoked for outgoing calls.Returns the context.booleanIndicates if the service should be enabled.booleanIndicates if the service is started.booleanIndicates if the service is stopped.voidsetContext(Context context) Sets the context.voidsetEnabled(boolean enabled) Indicates if the service should be enabled.voidstart()Starts the Restlet.voidstop()Stops the Restlet.
-
Constructor Details
-
Service
public Service()Constructor. Enables the service by default. -
Service
public Service(boolean enabled) Constructor.- Parameters:
enabled- True if the service has been enabled.
-
-
Method Details
-
createInboundFilter
Create the filter that should be invoked for incoming calls.- Parameters:
context- The current context.- Returns:
- The new filter or null.
-
createOutboundFilter
Create the filter that should be invoked for outgoing calls.- Parameters:
context- The current context.- Returns:
- The new filter or null.
- See Also:
-
getContext
Returns the context.- Returns:
- The context.
-
isEnabled
public boolean isEnabled()Indicates if the service should be enabled.- Returns:
- True if the service should be enabled.
-
isStarted
public boolean isStarted()Indicates if the service is started.- Returns:
- True if the service is started.
-
isStopped
public boolean isStopped()Indicates if the service is stopped.- Returns:
- True if the service is stopped.
-
setContext
Sets the context.- Parameters:
context- The context.
-
setEnabled
public void setEnabled(boolean enabled) Indicates if the service should be enabled.- Parameters:
enabled- True if the service should be enabled.
-
start
Starts the Restlet.- Throws:
Exception
-
stop
Stops the Restlet.- Throws:
Exception
-