public interface ByContentSpec
If there is no type registered, or if the client does not accept any of the given types, by default a 406 will be issued with Context.clientError(int).
If you want a different behavior, use noMatch(ratpack.func.Block).
| Modifier and Type | Method and Description |
|---|---|
ByContentSpec |
html(Block block)
Specifies that the given handler should be used if the client wants content of type "text/html".
|
ByContentSpec |
json(Block block)
Specifies that the given handler should be used if the client wants content of type "application/json".
|
ByContentSpec |
noMatch(Block block)
Specifies that the given handler should be used if the client's requested content type cannot be matched with any of the other handlers.
|
ByContentSpec |
noMatch(String mimeType)
Specifies that the handler for the specified content type should be used if the client's requested content type cannot be matched with any of the other handlers.
|
ByContentSpec |
plainText(Block block)
Specifies that the given handler should be used if the client wants content of type "text/plain".
|
ByContentSpec |
type(String mimeType,
Block block)
Specifies that the given handler should be used if the client wants content of the given MIME type.
|
ByContentSpec |
xml(Block block)
Specifies that the given handler should be used if the client wants content of type "application/xml".
|
ByContentSpec type(String mimeType, Block block)
mimeType - The MIME type to register forblock - the code to invoke if the content type matchesByContentSpec plainText(Block block)
block - the code to invoke if the content type matchesByContentSpec html(Block block)
block - the code to invoke if the content type matchesByContentSpec json(Block block)
block - the code to invoke if the content type matchesByContentSpec xml(Block block)
block - the code to invoke if the content type matchesByContentSpec noMatch(Block block)
block - the code to invoke if the content type doesn't matchByContentSpec noMatch(String mimeType)
mimeType - The MIME type to use as a fallback if the requested type can't be matched