Skip to content

Commit

Permalink
add ability to override mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Feb 3, 2021
1 parent d957b09 commit fc415a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/qrest/src/main/java/org/jpos/qrest/SendResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class SendResponse implements AbortParticipant, Configurable {
private String contentType;
private boolean jsonIncludeNulls= true;
private String corsHeader;
public static final String MAPPER = ".mapper";

@Override
public int prepare(long id, Serializable context) {
Expand Down Expand Up @@ -104,7 +105,9 @@ private FullHttpResponse getResponse (Context ctx) {
if (response.body() instanceof String)
responseBody = String.valueOf(response.body()).getBytes();
else {
ObjectMapper m= jsonIncludeNulls ? mapper : Mapper.getMapperNoNulls();
ObjectMapper m = ctx.get(MAPPER);
if (m == null)
m = jsonIncludeNulls ? mapper : Mapper.getMapperNoNulls();
responseBody = m.writeValueAsBytes(response.body());
isJson = true;
}
Expand Down

0 comments on commit fc415a6

Please # to comment.