Skip to content

Commit

Permalink
fix: increase maxStringLength for ObjectMapper to max int to allow ca…
Browse files Browse the repository at this point in the history
…ching large payload
  • Loading branch information
wbabyte committed Dec 3, 2024
1 parent 07110b8 commit e0afc1e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
package io.gravitee.policy.cache.mapper;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonFactoryBuilder;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.module.SimpleModule;
import io.gravitee.gateway.api.buffer.Buffer;
Expand All @@ -36,6 +37,11 @@ public class CacheResponseMapper extends ObjectMapper {
private SerializationMode serializationMode = null;

public CacheResponseMapper() {
super(
new JsonFactoryBuilder()
.streamReadConstraints(StreamReadConstraints.builder().maxStringLength(Integer.MAX_VALUE).build())
.build()
);
registerModule(new BufferModule());

enable(SerializationFeature.INDENT_OUTPUT);
Expand Down

0 comments on commit e0afc1e

Please sign in to comment.