Package ninja.bodyparser
Class BodyParserEngineJson
- java.lang.Object
-
- ninja.bodyparser.BodyParserEngineJson
-
- All Implemented Interfaces:
BodyParserEngine
public class BodyParserEngineJson extends Object implements BodyParserEngine
Built in Json body parser.- Author:
- Raphael Bauer, Thibault Meyer
- See Also:
BodyParserEngine
-
-
Constructor Summary
Constructors Constructor Description BodyParserEngineJson(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getContentType()
The content type this BodyParserEngine can handle MUST BE THREAD SAFE TO CALL!<T> T
invoke(Context context, Class<T> classOfT)
Invoke the parser and get back a Java object populated with the content of this request.
-
-
-
Method Detail
-
invoke
public <T> T invoke(Context context, Class<T> classOfT)
Description copied from interface:BodyParserEngine
Invoke the parser and get back a Java object populated with the content of this request. MUST BE THREAD SAFE TO CALL!- Specified by:
invoke
in interfaceBodyParserEngine
- Parameters:
context
- The contextclassOfT
- The class we expect- Returns:
- The object instance populated with all values from raw request
-
getContentType
public String getContentType()
Description copied from interface:BodyParserEngine
The content type this BodyParserEngine can handle MUST BE THREAD SAFE TO CALL!- Specified by:
getContentType
in interfaceBodyParserEngine
- Returns:
- the content type. this parser can handle - eg. "application/json"
-
-