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.NoArgAction)
.
Modifier and Type | Method and Description |
---|---|
ByContentSpec |
html(Handler handler)
Specifies that the given handler should be used if the client wants content of type "text/html".
|
ByContentSpec |
html(NoArgAction handler)
Specifies that the given handler should be used if the client wants content of type "text/html".
|
ByContentSpec |
json(Handler handler)
Specifies that the given handler should be used if the client wants content of type "application/json".
|
ByContentSpec |
json(NoArgAction handler)
Specifies that the given handler should be used if the client wants content of type "application/json".
|
ByContentSpec |
noMatch(Handler handler)
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(NoArgAction handler)
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(Handler handler)
Specifies that the given handler should be used if the client wants content of type "text/plain".
|
ByContentSpec |
plainText(NoArgAction handler)
Specifies that the given handler should be used if the client wants content of type "text/plain".
|
ByContentSpec |
type(String mimeType,
Handler handler)
Specifies that the given handler should be used if the client wants content of the given MIME type.
|
ByContentSpec |
type(String mimeType,
NoArgAction handler)
Specifies that the given handler should be used if the client wants content of the given MIME type.
|
ByContentSpec |
xml(Handler handler)
Specifies that the given handler should be used if the client wants content of type "application/xml".
|
ByContentSpec |
xml(NoArgAction handler)
Specifies that the given handler should be used if the client wants content of type "application/xml".
|
ByContentSpec type(String mimeType, NoArgAction handler)
mimeType
- The MIME type to register forhandler
- The handler to invoke if the content type matchesByContentSpec type(String mimeType, Handler handler)
mimeType
- The MIME type to register forhandler
- The handler to invoke if the content type matchesByContentSpec plainText(NoArgAction handler)
handler
- The handler to invoke if the content type matchesByContentSpec plainText(Handler handler)
handler
- The handler to invoke if the content type matchesByContentSpec html(NoArgAction handler)
handler
- The handler to invoke if the content type matchesByContentSpec html(Handler handler)
handler
- The handler to invoke if the content type matchesByContentSpec json(NoArgAction handler)
handler
- The handler to invoke if the content type matchesByContentSpec json(Handler handler)
handler
- The handler to invoke if the content type matchesByContentSpec xml(NoArgAction handler)
handler
- The handler to invoke if the content type matchesByContentSpec xml(Handler handler)
handler
- The handler to invoke if the content type matchesByContentSpec noMatch(NoArgAction handler)
handler
- The handler to invoke if the content type doesn't matchByContentSpec noMatch(Handler handler)
handler
- The handler 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