public static interface Body.Parser
Modifier and Type | Method and Description |
---|---|
boolean |
canParse(com.google.inject.TypeLiteral<?> type)
Test if the HTTP request body or parameter can be converted to the given type.
|
<T> T |
parse(com.google.inject.TypeLiteral<T> type,
Body.Reader reader)
Attempt to read a message from HTTP request body.
|
List<MediaType> |
types()
The
Content-Type header is tested against this type in order to decided if this
parser accept or not a type. |
List<MediaType> types()
Content-Type
header is tested against this type in order to decided if this
parser accept or not a type.boolean canParse(@Nonnull com.google.inject.TypeLiteral<?> type)
type
- The candidate Type.@Nonnull <T> T parse(@Nonnull com.google.inject.TypeLiteral<T> type, @Nonnull Body.Reader reader) throws Exception
For text format (json, yaml, xml, etc.) a converter usually call to
Body.Reader.text(Body.Reader.Text)
in order to apply correct charset and close
resources.
For binary format a converter usually call to Body.Reader.bytes(Body.Reader.Bytes)
in order to close resources.
T
- Target type.type
- A type of message.reader
- A read context.Exception
- If read operation fail.Copyright © 2014. All rights reserved.