Commit Graph

879 Commits

Author SHA1 Message Date
Rob Winch
fadf04e4b4 Add RelativeRedirectFilter 2017-07-19 17:15:33 +02:00
Rob Winch
5f868b493a Add ForwardedHeaderFilter requestOnly
Add an option for ForwardedHeaderFilter to only process the
HttpServletRequest. This means that HttpServletResponse.sendRedirect will
only work when the application is conifgured to use relative redirects
using Servlet Container specific setup.

Issue: SPR-15717
2017-07-19 17:15:33 +02:00
Rossen Stoyanchev
e2ee23bfc5 WebSession supports changeSessionId
Issue: SPR-15571
2017-07-17 11:09:38 +02:00
Rossen Stoyanchev
47b63150d1 Refactor DefaultWebSession
Use copy constructor to refresh a session with lastAccessTime and a
save function referencing the current exchange. As a result both fields
are now final and ConfigurableWebSession is no longer needed.
2017-07-14 22:55:56 +02:00
Rossen Stoyanchev
bf712957f6 Polish WebSession support code 2017-07-14 22:55:56 +02:00
Sebastien Deleuze
f46520e6e8 Add Jackson Smile support to WebFlux
This binary format more efficient than JSON should be useful for server
to server communication, for example in micro-services use cases.

Issue: SPR-15424
2017-07-13 17:57:07 +02:00
Arjen Poutsma
f4180eb359 Removed faulty test 2017-07-12 15:02:50 +02:00
Rossen Stoyanchev
9ac71afbda Fix one failing test and @Ignore another
The failures look like older failures possibly exposed by recent
changes in Reactor.

The one in ViewResolutionResultHandler is very old test error.
The one in Jackson2JsonDecoderTests is more recent but went unreported.
2017-07-12 13:16:51 +02:00
Rossen Stoyanchev
134ceac58e Set all strategies in CNM factory bean
ContentNegotiationManagerFactoryBean now provides an option to
explicitly set the strategies to use vs customizing a fixed
list of default strategies.

Issue: SPR-11114
2017-07-11 21:00:57 +02:00
Rossen Stoyanchev
befacf4a35 ParameterContentNegotiationStrategy uses MediaTypeFactory
Issue: SPR-15649
2017-07-11 17:54:16 +02:00
Rossen Stoyanchev
eb84547894 Fix MockMvc + HttpPutFormContentFilter issue
Issue: SPR-15753
2017-07-11 11:43:48 +02:00
Rossen Stoyanchev
0e370e0703 Separate out URL path parsing in PathContainer
PathContainer now has separate parsePath and parseUrlPath methods each
creating PathSegment and UrlPathSegment respectively.
2017-07-11 10:56:19 +02:00
Rossen Stoyanchev
1d201a55db Refine PathContainer.Segment value representation
Segment.value() now returns the actual original path segment value
including path parameters while semicolonContent() is removed.

valueDecoded() is renamed to valueToMatch() to reflect it is the value
for pattern matching which is not only decoded but also has path
parameters removed.
2017-07-11 10:54:42 +02:00
Rossen Stoyanchev
2f17c5f3b6 From static to instance-based PathContainer#subPath 2017-07-11 06:05:36 +02:00
Rossen Stoyanchev
9f7d57f933 Encapsulate choice of URI encoding within RequestPath
Currently the URI path is always treated as UTF-8 so we can eliminate
the encoding parameter from RequestPath#parse.
2017-07-11 06:05:36 +02:00
Rossen Stoyanchev
9640cedeae Removing remaining use of PathPattern with String path 2017-07-07 19:20:36 +02:00
Juergen Hoeller
00f4c36d7a Nullability fine-tuning (RequestContext, LocaleResolver)
Includes page-level JSTL time zone support for JSP tags.

Issue: SPR-15720
Issue: SPR-15746
2017-07-07 18:46:19 +02:00
Brian Clozel
9c93521512 Leverage PathPatternParser in CORS configuration source
Previously `UrlBasedCorsConfigurationSource` was relying on
`PathMatcher` implementations for matching incoming request lookup paths
with the configured path patterns for CORS configuration.

This commit replaces the use of `PathMatcher` with a `PathPatternParser`
that parses the string patterns into `PathPattenr` instances and allows
for faster matching against lookup paths.

Issue: SPR-15688
2017-07-04 16:01:18 +02:00
Brian Clozel
baaa84e90f Include port info in HTTP headers for Netty client
This commit adds the port information in the "Host" HTTP request header
for the Netty-based HTTP client.

Issue: SPR-15706
2017-07-04 12:13:06 +02:00
Arjen Poutsma
2ccbc55ffd Use PathContainer in web.reactive.function.server
This commit uses the newly introduced `PathContainer` and `RequestPath`
support in the functional web framework. It exposes the path container
as property in `ServerRequest`, and uses that in the path-based
`RequestPredicates`.
2017-07-03 13:36:30 +02:00
Sebastien Deleuze
727ca4514a Stream custom types in Jackson2JsonEncoder
Issue: SPR-15727
2017-07-03 10:25:59 +02:00
Sebastien Deleuze
1fa8410995 Leverage RFC_1123_DATE_TIME formatter in tests
Issue: SPR-15661
2017-07-02 22:33:43 +02:00
Rossen Stoyanchev
850083ca6c Polish 2017-06-30 18:19:35 -04:00
Rossen Stoyanchev
8581afa621 WebFlux compiles after PathPattern/Container changes 2017-06-30 18:19:35 -04:00
Andy Clement
26448a0ebc Rework matching to use PathContainer 2017-06-30 18:19:35 -04:00
Rossen Stoyanchev
fc3fcf05fd Refactor PathSegmentContainer -> PathContainer
The new PathContainer represent the path as a series of elements
including separators. This naturally represents leading/trailing
slashes and empty path segments which in turn makes it easier to match
in PathPattern as well as to reconstruct the path.
2017-06-30 18:19:35 -04:00
Rossen Stoyanchev
9253facf02 Refactor ServerWebExchange#getAttribute options
Issue: SPR-15718
2017-06-29 14:55:30 -04:00
Stephane Nicoll
b1f06fddd2 Polish
Issue: SPR-14528
2017-06-29 10:26:50 +02:00
Arjen Poutsma
31e0e53750 Leverage Jackson non-blocking parser
This commit introduces the Jackson2Tokenizer as a replacement for the
JsonObjectDecoder. The latter was dropped because of its complexity, and
hard dependency on Netty's ByteBuf.

The new Jackson2Tokenizer leverages the new non-blocking JSON parser,
using it to parse the incoming data buffers into TokenBuffers, each
token buffer representing one JSON object. As with JsonObjectDecoder,
it also supports streaming individual JSON array elements.

Issue: SPR-14528
2017-06-28 16:19:01 +02:00
Juergen Hoeller
87430f3cd3 ListenableFuture provides CompletableFuture adaptation via completable()
Issue: SPR-15696
2017-06-27 00:43:37 +02:00
Rossen Stoyanchev
5b8f7f503f Deprecate adapter classes for async interceptors 2017-06-26 15:34:51 -04:00
Violeta Georgieva
e0678ba583 Add onError callback to DeferredResult
Issue: SPR-15614
2017-06-26 14:12:56 -04:00
Rossen Stoyanchev
c37c59f578 Consumer methods for WebHttpHandlerBuilder
Replace the more limited List-based methods to add filtes and exception
handlers with Consumer<List<?>> variants.
2017-06-23 07:12:10 -04:00
Sebastien Deleuze
5c1d8c7c59 Leverage ZonedDateTime in HttpHeaders
This commit introduces 2 new public methods in HttpHeaders in order
to leverage Java 8 ZonedDateTime in addition to the existing long
(with GMT time zone implied) variants:
 - ZonedDateTime getFirstZonedDateTime(String headerName)
 - void setZonedDateTime(String headerName, ZonedDateTime date)

This commit also leverages Java 8 thread-safe DateTimeFormatter for
HttpHeader implementation instead of SimpleDateFormat. As a consequence
of the usage of DateTimeFormatter.RFC_1123_DATE_TIME, HTTP date header
serialization could change slightly for single digit days from for
example "Thu, 01 Jan 1970 00:00:00 GMT" to
"Thu, 1 Jan 1970 00:00:00 GMT".

Issue: SPR-15661
2017-06-23 00:15:51 +02:00
Arjen Poutsma
0a4d3c14db Jackson2JsonDecoder should support empty JSON array
Before this commit, the Jackson2JsonDecoder was not able to decode an
empty JSON array (`[]`). After this commit, it is.

Issue: SPR-15685
2017-06-21 11:14:34 +02:00
Sebastien Deleuze
1e04cdfa7e Add CorsWebFilter
This new WebFilter implementation is designed to allow initial
CORS support when using WebFlux functional API. More high-level
API may be introduced later.

Issue: SPR-15567
2017-06-21 10:50:09 +02:00
Sebastien Deleuze
59e90943e4 Rename CorsProcessor#processRequest to process 2017-06-21 10:50:09 +02:00
Rossen Stoyanchev
4a21fb27fc Fix root path test and add more test cases 2017-06-15 16:14:12 -04:00
Rossen Stoyanchev
67e482aaf8 Fix ROOT_PATH constant to match recent changes
"/" should be 0 segments, isAbsolute=true, hasTrailingSlash=false
2017-06-15 15:40:32 -04:00
Rossen Stoyanchev
53e8ebe6a6 Fix failing test (after previous commit) 2017-06-15 11:07:39 -04:00
Rossen Stoyanchev
97917aa57d Add PathSegmentContainer subPath extracting method 2017-06-14 17:44:56 -04:00
Rossen Stoyanchev
1018bf771b Separate DefaultRequestPath/DefaultPathSegmentContainer 2017-06-14 17:44:56 -04:00
Rossen Stoyanchev
97a97f9bba RequestPath improvements
Static parse methods on PathSegmentContainer and PathSegment plus:

isEmpty() on PathSegmentContainer and PathSegment
isAbsolute() and hasTrailingSlash() on PathSegmentContainer
char[] alternative for valueDecoded() on PathSegment
2017-06-14 17:44:56 -04:00
Sebastien Deleuze
97909f2258 Support date properties in Content-Disposition HTTP header
Issue: SPR-15555
2017-06-13 15:17:48 +02:00
Sebastien Deleuze
e0e6736bc5 Introduce LocaleContextResolver in WebFlux
This commit introduces LocaleContextResolver interface, which is used
at ServerWebExchange level to resolve Locale, TimeZone and other i18n
related informations.

It follows Spring MVC locale resolution patterns with a few differences:
 - Only LocaleContextResolver is supported since LocaleResolver is less
   flexible
 - Support is implemented in the org.springframework.web.server.i18n
   package of spring-web module rather than in spring-webflux in order
   to be able to leverage it at ServerWebExchange level

2 implementations are provided:
 - FixedLocaleContextResolver
 - AcceptHeaderLocaleContextResolver

It can be configured with both functional or annotation-based APIs.

Issue: SPR-15036
2017-06-13 15:10:18 +02:00
Juergen Hoeller
779deb0fa7 Cleanup of duplicate semicolons
Issue: SPR-15654
2017-06-13 11:38:05 +02:00
Stephane Nicoll
58242f2249 Polish 2017-06-13 10:13:14 +02:00
Juergen Hoeller
3ae84d6dd8 Consistent support for Charset/StandardCharsets in UriUtils etc
Issue: SPR-15613
2017-06-12 15:51:45 +02:00
Rossen Stoyanchev
38a12ed4ba Expose RequestPath in ServerHttpRequest
The new structured getPath() method replaces the existing
getContextPath() + getPathWithinApplication().

Issue: SPR-15648
2017-06-11 21:59:24 -04:00
Rossen Stoyanchev
2d17411ec4 Add RequestPath to http/server/reactive
Issue: SPR-15648
2017-06-11 21:59:24 -04:00