Package net.officefloor.web.json
Class JacksonHttpObjectResponderFactory
java.lang.Object
net.officefloor.web.json.JacksonHttpObjectResponderFactory
- All Implemented Interfaces:
HttpObjectResponderFactory
Jackson
HttpObjectResponderFactory.- Author:
- Daniel Sagenschneider
-
Constructor Summary
ConstructorsConstructorDescriptionJacksonHttpObjectResponderFactory(com.fasterxml.jackson.databind.ObjectMapper mapper) Initiate with theObjectMapper. -
Method Summary
Modifier and TypeMethodDescription<E extends Throwable>
HttpEscalationResponder<E>createHttpEscalationResponder(Class<E> escalationType, boolean isOfficeFloorEscalation) Creates theHttpObjectResponderfor theEscalationtype.<T> HttpObjectResponder<T>createHttpObjectResponder(Class<T> objectType) Creates theHttpObjectResponderfor theObjecttype.Obtains theContent-Typesupported by the createHttpObjectResponderinstances.static StringObtains the entity for theEscalation.
-
Constructor Details
-
JacksonHttpObjectResponderFactory
public JacksonHttpObjectResponderFactory(com.fasterxml.jackson.databind.ObjectMapper mapper) Initiate with theObjectMapper.- Parameters:
mapper-ObjectMapper.
-
-
Method Details
-
getEntity
public static String getEntity(Throwable escalation, com.fasterxml.jackson.databind.ObjectMapper mapper) throws IOException Obtains the entity for theEscalation.- Parameters:
escalation-ThrowableEscalation.mapper-ObjectMapperto write entity.- Returns:
- Entity for the
Escalation. - Throws:
IOException- If fails to writeEscalation.
-
getContentType
Description copied from interface:HttpObjectResponderFactoryObtains theContent-Typesupported by the createHttpObjectResponderinstances.- Specified by:
getContentTypein interfaceHttpObjectResponderFactory- Returns:
Content-Type.
-
createHttpObjectResponder
Description copied from interface:HttpObjectResponderFactoryCreates the
HttpObjectResponderfor theObjecttype.Should this not handle the
Objecttype, it should returnnull.- Specified by:
createHttpObjectResponderin interfaceHttpObjectResponderFactory- Type Parameters:
T- Object type.- Parameters:
objectType-Objecttype.- Returns:
HttpObjectResponderfor theObjecttype.
-
createHttpEscalationResponder
public <E extends Throwable> HttpEscalationResponder<E> createHttpEscalationResponder(Class<E> escalationType, boolean isOfficeFloorEscalation) Description copied from interface:HttpObjectResponderFactoryCreates the
HttpObjectResponderfor theEscalationtype.Should this not handle the
Escalationtype, it should returnnull.- Specified by:
createHttpEscalationResponderin interfaceHttpObjectResponderFactory- Type Parameters:
E-Escalationtype.- Parameters:
escalationType-Escalationtype.isOfficeFloorEscalation- Indicates ifEscalationis handled byOfficeFloor. Continuing to provide aHttpEscalationResponderindicates a custom response is being provided.- Returns:
HttpObjectResponderfor theEscalationtype.
-