Skip to content

Commit 93b4c32

Browse files
Add a new JaxRsFeature to consume all content, on by default (#170)
Fixes #108
1 parent 7163fdd commit 93b4c32

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

base/src/main/java/com/fasterxml/jackson/jaxrs/base/ProviderBase.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,9 @@ protected EP_CONFIG _configForReading(MAPPER mapper,
458458
} else {
459459
r = mapper.reader();
460460
}
461+
if (JaxRSFeature.READ_FULL_STREAM.enabledIn(_jaxRSFeatures)) {
462+
r = r.withFeatures(DeserializationFeature.FAIL_ON_TRAILING_TOKENS);
463+
}
461464
return _configForReading(r, annotations);
462465
}
463466

base/src/main/java/com/fasterxml/jackson/jaxrs/cfg/JaxRSFeature.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ public enum JaxRSFeature implements ConfigFeature
2727
*/
2828
ALLOW_EMPTY_INPUT(true),
2929

30+
/**
31+
* For HTTP keep-alive or multipart content to work correctly, Jackson must read the entire HTTP input
32+
* stream up until reading EOF (-1).
33+
* <a href="https://github.com/FasterXML/jackson-jaxrs-providers/issues/108">Issue #108</a>
34+
* If set to true, always consume all input content. This has a side-effect of failing on trailing content.
35+
*/
36+
READ_FULL_STREAM(true),
37+
3038
/*
3139
/**********************************************************
3240
/* HTTP headers

0 commit comments

Comments
 (0)