public abstract class Restlet extends 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. |
Application |
getApplication()
Returns the parent application if it exists, or null.
|
String |
getAuthor()
Returns the author(s).
|
Context |
getContext()
Returns the context.
|
String |
getDescription()
Returns the description.
|
Logger |
getLogger()
Returns the context's logger.
|
String |
getName()
Returns the display name.
|
String |
getOwner()
Returns the owner(s).
|
void |
handle(Request request,
Response response)
Handles a call.
|
boolean |
isStarted()
Indicates if the Restlet is started.
|
boolean |
isStopped()
Indicates if the Restlet is stopped.
|
void |
setAuthor(String author)
Sets the author(s).
|
void |
setContext(Context context)
Sets the context.
|
void |
setDescription(String description)
Sets the description.
|
void |
setName(String name)
Sets the display name.
|
void |
setOwner(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 Throwable
stop()
the Restlet if it is still started.public Application getApplication()
public String getAuthor()
public Context getContext()
public String getDescription()
public Logger getLogger()
public String getName()
public 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 boolean isStarted()
public boolean isStopped()
public void setAuthor(String author)
author
- The author(s).public void setContext(Context context)
context
- The context.public void setDescription(String description)
description
- The description.public void setName(String name)
name
- The display name.public void setOwner(String owner)
owner
- The owner(s).Copyright © 2005–2016. All rights reserved.