Package org.restlet.resource
Annotation Interface Status
Annotation for
Example:
Throwable that map to HTTP error statuses. Its
semantics is equivalent to an HTTP status line plus a related HTTP entity for
errors.Example:
@Get
public MyBean represent() throws MyServerError, MyNotFoundError;
@Status(500)
public class MyServerError implements Throwable{
...
}
@Status(404, serialize = false)
public class MyNotFoundError extends RuntimeException{
...
}
@Status(value = 400)
public class MyBadParameterError extends RuntimeException{
public String getParameterName() {
...
};
...
}
- Author:
- Jerome Louvel
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
int valueSpecifies the HTTP status code associated to the annotatedThrowable. Default is 500.- Returns:
- The result HTTP status code.
- Default:
- 500
-
serialize
boolean serializeIndicates if the annotatedThrowableshould be serialized in the HTTP response entity.- Returns:
- True if
Throwableshould be serialized in the HTTP response entity.
- Default:
- true
-