com.genexus.ws.JAXRSObjectMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gxwrapperjakarta Show documentation
Show all versions of gxwrapperjakarta Show documentation
Core classes for the runtime used by Java and Android apps generated with GeneXus
The newest version!
package com.genexus.ws;
import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.ws.rs.ext.ContextResolver;
import jakarta.ws.rs.ext.Provider;
@Provider
public class JAXRSObjectMapper implements ContextResolver {
private final ObjectMapper mapper;
public JAXRSObjectMapper() {
this.mapper = createObjectMapper();
}
@Override
public ObjectMapper getContext(Class> type) {
return mapper;
}
private ObjectMapper createObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
String bodyLengthLimit = System.getProperty("gx.jackson.bodylengthlimit");
if (bodyLengthLimit != null)
mapper.getFactory().setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(Integer.parseInt(bodyLengthLimit)).build());
return mapper;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy