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
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
ConstructorsConstructorDescriptionDefault constructor enables registering Jackson's exception mappers -
Method Summary
Modifier and TypeMethodDescriptionboolean
configure
(FeatureContext context) jaxrsFeature
(JaxRSFeature feature, boolean state) RegisterJaxRSFeature
with the Jackson providers.maxStringLength
(int maxStringLength) Sets theMessageProperties.JSON_MAX_STRING_LENGTH
property to a provided value.static JacksonFeature
Create JacksonFeature with working Jackson's exception mappersstatic JacksonFeature
Create JacksonFeature without registered Jackson's exception mappersMethods inherited from class org.glassfish.jersey.jackson.internal.JaxrsFeatureBag
hasJaxrsFeature
-
Constructor Details
-
JacksonFeature
public JacksonFeature()Default constructor enables registering Jackson's exception mappers
-
-
Method Details
-
withExceptionMappers
Create JacksonFeature with working Jackson's exception mappers- Returns:
- JacksonFeature with working Jackson's exception mappers
-
withoutExceptionMappers
Create JacksonFeature without registered Jackson's exception mappers- Returns:
- JacksonFeature without registered Jackson's exception mappers
-
maxStringLength
Sets the
MessageProperties.JSON_MAX_STRING_LENGTH
property to a provided value. The property value alreadyconfigured
takes priority.Both uses of
maxStringLength(int)
andMessageProperties.JSON_MAX_STRING_LENGTH
override StreamReadConstraints defined on Jackson'sObjectMapper's JsonFactory
provided 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_LEN
set.
-
jaxrsFeature
RegisterJaxRSFeature
with the Jackson providers.- Overrides:
jaxrsFeature
in classJaxrsFeatureBag<JacksonFeature>
- Parameters:
feature
- theJaxRSFeature
to be enabled or disabled.state
-true
for enabling the feature,false
for disabling.- Returns:
- JacksonFeature with
JaxRSFeature
registered to be set on a created Jackson provider.
-
configure
-