Package org.glassfish.jersey.jackson
Class JacksonFeature
- java.lang.Object
-
- org.glassfish.jersey.jackson.internal.JaxrsFeatureBag<JacksonFeature>
-
- org.glassfish.jersey.jackson.JacksonFeature
-
- All Implemented Interfaces:
Feature
public class JacksonFeature extends JaxrsFeatureBag<JacksonFeature> implements Feature
Feature used to register Jackson JSON providers.- Author:
- Stepan Kopriva, Michal Gajdos
-
-
Field Summary
-
Fields inherited from class org.glassfish.jersey.jackson.internal.JaxrsFeatureBag
JAXRS_FEATURE
-
-
Constructor Summary
Constructors Constructor Description JacksonFeature()Default constructor enables registering Jackson's exception mappers
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanconfigure(FeatureContext context)JacksonFeaturejaxrsFeature(JaxRSFeature feature, boolean state)RegisterJaxRSFeaturewith the Jackson providers.JacksonFeaturemaxStringLength(int maxStringLength)Sets theMessageProperties.JSON_MAX_STRING_LENGTHproperty to a provided value.static JacksonFeaturewithExceptionMappers()Create JacksonFeature with working Jackson's exception mappersstatic JacksonFeaturewithoutExceptionMappers()Create JacksonFeature without registered Jackson's exception mappers-
Methods inherited from class org.glassfish.jersey.jackson.internal.JaxrsFeatureBag
hasJaxrsFeature
-
-
-
-
Method Detail
-
withExceptionMappers
public static JacksonFeature withExceptionMappers()
Create JacksonFeature with working Jackson's exception mappers- Returns:
- JacksonFeature with working Jackson's exception mappers
-
withoutExceptionMappers
public static JacksonFeature withoutExceptionMappers()
Create JacksonFeature without registered Jackson's exception mappers- Returns:
- JacksonFeature without registered Jackson's exception mappers
-
maxStringLength
public JacksonFeature maxStringLength(int maxStringLength)
Sets the
MessageProperties.JSON_MAX_STRING_LENGTHproperty to a provided value. The property value alreadyconfiguredtakes priority.Both uses of
maxStringLength(int)andMessageProperties.JSON_MAX_STRING_LENGTHoverride StreamReadConstraints defined on Jackson'sObjectMapper's JsonFactoryprovided viaContextResolver<ObjectMapper>.- Parameters:
maxStringLength- the integer value to override the default Jackson'sStreamReadConstraints.DEFAULT_MAX_STRING_LEN.- Returns:
- JacksonFeature that has the Jackson's
StreamReadConstraints.DEFAULT_MAX_STRING_LENset.
-
jaxrsFeature
public JacksonFeature jaxrsFeature(JaxRSFeature feature, boolean state)
RegisterJaxRSFeaturewith the Jackson providers.- Overrides:
jaxrsFeaturein classJaxrsFeatureBag<JacksonFeature>- Parameters:
feature- theJaxRSFeatureto be enabled or disabled.state-truefor enabling the feature,falsefor disabling.- Returns:
- JacksonFeature with
JaxRSFeatureregistered to be set on a created Jackson provider.
-
configure
public boolean configure(FeatureContext context)
-
-