public class StatusService extends Service
getStatus(Throwable, Request, Response)
method is first invoked to
obtain the status that you want to set on the response. If this method isn't
overridden or returns null, the Status.SERVER_ERROR_INTERNAL
constant
will be set by default.Status.isError()
, the
getRepresentation(Status, Request, Response)
method is then invoked
to give your service a chance to override the default error page.Constructor and Description |
---|
StatusService()
Constructor.
|
StatusService(boolean enabled)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Filter |
createInboundFilter(Context context)
Create the filter that should be invoked for incoming calls.
|
java.lang.String |
getContactEmail()
Returns the email address to contact in case of error.
|
Reference |
getHomeRef()
Returns the home URI to propose in case of error.
|
Representation |
getRepresentation(Status status,
Request request,
Response response)
Returns a representation for the given status.
In order to customize the default representation, this method can be overridden. |
Status |
getStatus(java.lang.Throwable throwable,
Request request,
Response response)
Returns a status for a given exception or error.
|
Status |
getStatus(java.lang.Throwable throwable,
UniformResource resource)
Returns a status for a given exception or error.
|
boolean |
isOverwrite()
Deprecated.
Use
isOverwriting() instead. |
boolean |
isOverwriting()
Indicates if an existing entity should be overwritten.
|
void |
setContactEmail(java.lang.String contactEmail)
Sets the email address to contact in case of error.
|
void |
setHomeRef(Reference homeRef)
Sets the home URI to propose in case of error.
|
void |
setOverwrite(boolean overwriting)
Deprecated.
Use
setOverwriting(boolean) instead. |
void |
setOverwriting(boolean overwriting)
Indicates if an existing entity should be overwritten.
|
createOutboundFilter, getContext, isEnabled, isStarted, isStopped, setContext, setEnabled, start, stop
public StatusService()
public StatusService(boolean enabled)
enabled
- True if the service has been enabled.public Filter createInboundFilter(Context context)
Service
createInboundFilter
in class Service
context
- The current context.public java.lang.String getContactEmail()
public Reference getHomeRef()
public Representation getRepresentation(Status status, Request request, Response response)
status
- The status to represent.request
- The request handled.response
- The response updated.public Status getStatus(java.lang.Throwable throwable, Request request, Response response)
ResourceException
. For other exceptions or errors,
it returns an Status.SERVER_ERROR_INTERNAL
status.throwable
- The exception or error caught.request
- The request handled.response
- The response updated.public Status getStatus(java.lang.Throwable throwable, UniformResource resource)
Status.SERVER_ERROR_INTERNAL
status and logs a severe message.throwable
- The exception or error caught.resource
- The parent resource.@Deprecated public boolean isOverwrite()
isOverwriting()
instead.public boolean isOverwriting()
public void setContactEmail(java.lang.String contactEmail)
contactEmail
- The email address to contact in case of error.public void setHomeRef(Reference homeRef)
homeRef
- The home URI to propose in case of error.@Deprecated public void setOverwrite(boolean overwriting)
setOverwriting(boolean)
instead.overwriting
- True if an existing entity should be overwritten.public void setOverwriting(boolean overwriting)
overwriting
- True if an existing entity should be overwritten.Copyright © 2005-2012. All Rights Reserved.