@Component public class DefaultStatus extends java.lang.Object implements Status
Constructor and Description |
---|
DefaultStatus(javax.servlet.http.HttpServletResponse response,
Result result,
Configuration config,
Proxifier proxifier,
Router router) |
Modifier and Type | Method and Description |
---|---|
void |
accepted()
Return Accepted (202) Status
|
void |
badRequest(java.util.List<?> errors)
Returns a Bad Request (400) status
Notifies the client that he should not try to execute the same request
again: part of its representation is somehow invalid.
|
void |
badRequest(java.lang.String message)
Returns a Bad Request (400) status
Notifies the client that he should not try to execute the same request
again: part of its representation is somehow invalid.
|
void |
conflict()
Returns a Conflict (409) status
|
void |
created()
Returns a Created status (201)
|
void |
created(java.lang.String location)
Sets the status to 201 and sets the location to the server's location +
the location content.
created("/order/2") ==> http://localhost:8080/my_context/order/2 |
void |
forbidden(java.lang.String message)
Returns a Forbidden (403) status.
|
void |
header(java.lang.String key,
java.lang.String value) |
void |
methodNotAllowed(java.util.EnumSet<HttpMethod> allowedMethods) |
<T> T |
movedPermanentlyTo(java.lang.Class<T> controller)
same as movedPermanentlyTo(String), but will use the url for
controller.method(args);
Example:
result.use(http()).movedPermanentlyTo(ClientsController.class).list();
|
void |
movedPermanentlyTo(java.lang.String location)
Send redirect with Moved Permanently (301) Header Example:
result.use(http()).movedPermanentlyTo("/clients"); will move to
/
|
void |
noContent()
Returns a No Content status (204)
|
void |
notAcceptable()
The accepted media type is not supported.(406)
|
void |
notFound()
Returns a Not Found (404) status
|
void |
notModified()
Returns a Not Modified (304) status
|
void |
ok()
Returns a Ok status (200)
|
void |
unsupportedMediaType(java.lang.String message)
The media type sent to the server is not supported.(415)
|
public DefaultStatus(javax.servlet.http.HttpServletResponse response, Result result, Configuration config, Proxifier proxifier, Router router)
public void notFound()
Status
public void header(java.lang.String key, java.lang.String value)
public void created()
Status
public void created(java.lang.String location)
Status
public void ok()
Status
public void conflict()
Status
public void methodNotAllowed(java.util.EnumSet<HttpMethod> allowedMethods)
methodNotAllowed
in interface Status
public void movedPermanentlyTo(java.lang.String location)
Status
movedPermanentlyTo
in interface Status
public <T> T movedPermanentlyTo(java.lang.Class<T> controller)
Status
movedPermanentlyTo
in interface Status
public void unsupportedMediaType(java.lang.String message)
Status
unsupportedMediaType
in interface Status
public void badRequest(java.lang.String message)
Status
badRequest
in interface Status
public void badRequest(java.util.List<?> errors)
Status
result.use(representation()).from(errors, "errors").serialize();
badRequest
in interface Status
public void forbidden(java.lang.String message)
Status
public void noContent()
Status
public void notAcceptable()
Status
notAcceptable
in interface Status
public void accepted()
Status
public void notModified()
Status
notModified
in interface Status
Copyright © 2013 Caelum. All Rights Reserved.