public abstract class Restlet extends java.lang.Object implements Uniform
Constructor and Description |
---|
Restlet()
Constructor with null context.
|
Restlet(Context context)
Constructor with the Restlet's context which can be the parent's
application context, but shouldn't be the parent Component's context for
security reasons.
|
Modifier and Type | Method and Description |
---|---|
protected void |
finalize()
Attempts to
stop() the Restlet if it is still started. |
java.lang.String |
getAuthor()
Returns the author(s).
|
Context |
getContext()
Returns the context.
|
java.lang.String |
getDescription()
Returns the description.
|
java.util.logging.Logger |
getLogger()
Returns the context's logger.
|
java.lang.String |
getName()
Returns the display name.
|
java.lang.String |
getOwner()
Returns the owner(s).
|
void |
handle(Request request,
Response response)
Handles a call.
|
void |
handle(Request request,
Response response,
Uniform onResponseCallback)
Handles a call.
|
void |
handle(Request request,
Uniform onReceivedCallback)
Handles a call.
|
boolean |
isStarted()
Indicates if the Restlet is started.
|
boolean |
isStopped()
Indicates if the Restlet is stopped.
|
void |
setAuthor(java.lang.String author)
Sets the author(s).
|
void |
setContext(Context context)
Sets the context.
|
void |
setDescription(java.lang.String description)
Sets the description.
|
void |
setName(java.lang.String name)
Sets the display name.
|
void |
setOwner(java.lang.String owner)
Sets the owner(s).
|
void |
start()
Starts the Restlet.
|
void |
stop()
Stops the Restlet.
|
public Restlet()
public Restlet(Context context)
context
- The context of the Restlet.Context.createChildContext()
protected void finalize() throws java.lang.Throwable
stop()
the Restlet if it is still started.finalize
in class java.lang.Object
java.lang.Throwable
public java.lang.String getAuthor()
public Context getContext()
public java.lang.String getDescription()
public java.util.logging.Logger getLogger()
public java.lang.String getName()
public java.lang.String getOwner()
public void handle(Request request, Response response)
Context#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 to Status.SERVER_ERROR_INTERNAL
.
Subclasses overriding this method should make sure that they call super.handle(request, response) before adding their own logic.
public final void handle(Request request, Response response, Uniform onResponseCallback)
request
- The request to handle.response
- The response to update.onResponseCallback
- The callback invoked upon response reception.public final void handle(Request request, Uniform onReceivedCallback)
request
- The request to handle.onReceivedCallback
- The callback invoked upon request reception.public boolean isStarted()
public boolean isStopped()
public void setAuthor(java.lang.String author)
author
- The author(s).public void setContext(Context context)
context
- The context.public void setDescription(java.lang.String description)
description
- The description.public void setName(java.lang.String name)
name
- The display name.public void setOwner(java.lang.String owner)
owner
- The owner(s).public void start() throws java.lang.Exception
java.lang.Exception
public void stop() throws java.lang.Exception
java.lang.Exception
Copyright © 2005-2024 Restlet.