Commit Graph

13811 Commits

Author SHA1 Message Date
Rossen Stoyanchev 558d7f3f3e Fix package cycle
HandshakeInfo has been promoted to the top-level socket package next to
WebSocketSession which exposes it.
2016-12-18 20:37:05 -05:00
Juergen Hoeller 7867e56494 Polishing 2016-12-19 02:00:28 +01:00
Juergen Hoeller 3ee6286eb5 Support for functional instance supplier callback at BeanDefinition level
Issue: SPR-14832
2016-12-18 21:05:45 +01:00
Juergen Hoeller 12aa14ddbc Support @Nullable annotations as indicators for optional injection points
Issue: SPR-15028
2016-12-18 21:04:08 +01:00
Rossen Stoyanchev 8be791c4ff Add reactive WebSocketClient and RxNetty implementation
Issue: SPR-14527
2016-12-18 10:49:52 -05:00
Rossen Stoyanchev bcf6f6e75f Refactoring in reactive WebSocketSession and adapters
The WebSocketHander adapters are now neutral for client vs server-side
use with the adapters for RxNetty and Reactor Netty (server-side only)
completely removed.

A new HandshakeInfo carries information about the handshake including
URI, headers, and principal from the upgrade strategy, to the adapter,
and then to the session.

WebSocketSession exposes the HandshakeInfo as well reducing its overall
number of methods.
2016-12-18 10:49:52 -05:00
Rossen Stoyanchev edcf04911f Refactoring in reactive WebSocketMessage
Move WebSocketMessage factory methods to the WebSocketSession which
has the bufferFactory() needed to create message payloads.

WebSocketMessage is left with one public constructor.

WebSocketMessage exposes convenience retain/releasePayload methods.
2016-12-18 10:49:47 -05:00
Rossen Stoyanchev 6cd92c69cf Refactoring in reactive WebSocketSession hierarchy
Expose bufferFactory() at the WebSocketSession level for creating
payloads like ReactiveHttpOutputMessage does.

Promote getId(), getUri(), and bufferFactory() to the base class
WebSocketSessionSupport.
2016-12-18 10:46:28 -05:00
Rossen Stoyanchev 140ff7ce8f Polish reactive WebSocket integration tests 2016-12-18 10:41:05 -05:00
Juergen Hoeller 4c005e6336 ResolvableType-based matching respects generic factory method return type
Includes consistent use of ResolvableType.resolve() wherever applicable.

Issue: SPR-15011
2016-12-17 23:10:48 +01:00
Juergen Hoeller e9b4cac47f Latest dependency updates (EhCache 3.2, TestNG 6.10, SLF4J 1.7.22, RxJava 1.2.4, Kotlin 1.0.5-3) 2016-12-17 13:01:18 +01:00
Juergen Hoeller 9ba4b47bee Defensive processing of timeout callback and timeout result
Issue: SPR-14978
2016-12-17 12:57:18 +01:00
Rossen Stoyanchev 9376748c9c Apply getAcceptLanguageAsLocale and encodeUrl
Apply the new HttpHeaders#getAcceptLanguageAsLocale() in places where
it was hardcoded or defaulting.

Apply ServerHttpResponse.encodeUrl in RequestContext.

Issue: SPR-15024
2016-12-16 17:33:39 -05:00
Rossen Stoyanchev bd8af55bc7 getAcceptLanguageAsLocale(s) returns most preferred Locale
An update on the last commit switching from:
List<Locale> getAcceptLanguageAsLocales() to
Locale getAcceptLanguageAsLocale()

This best supports the scenario for the most preferred Locale.
If there is a need to look at the prioritized list of languages it's
best to use Locale.filter with the LocaleRange's.

This is explained in the Javadoc for getAcceptLanguage().

Issue: SPR-15024
2016-12-16 17:15:43 -05:00
Rossen Stoyanchev fa56361ad2 Add getAcceptLanguageAsLocales
The use of Locale.LanguageRange for the Accept-Language header makes
sense as it gives the most flexibility for a client to set a weighted
list and for a server to do filtering via Locale#filter.

This commit adds an additional convenience method that turns
the LangugeRange list to a list of Locale's also filtering out a
wildcard (i.e. "*"). A List<Locale> is the most basic way to access
prefered languages and needed when filtering is not required.

Issue: SPR-15024
2016-12-16 16:20:06 -05:00
Rossen Stoyanchev c85d768b3c WebExchangeDataBinder uses the new "requestParams" 2016-12-16 16:20:06 -05:00
Stephane Maldini 7d9e8def44 uncomment reactor-netty in tests 2016-12-16 20:09:32 +00:00
Rossen Stoyanchev 95818609fc Minor refactoring
Consolidate into one method potentially re-using UriComponentsBuilder
for the location. Also use StringUtils#applyRelativePath.

Issue: SPR-15020
2016-12-15 19:34:33 -05:00
Rob Winch db2ebd30da Add Support for ForwardedHeaderFilter sendRedirect
Previously ForwrdedHeaderFilter did not ensure that
HttpServletResponse.sendRedirect worked properly based on
X-Forwarded-* headers.

This commit updates ForwardedHeaderFilter to overrided the
HttpServletResponse.sendRedirect method to ensure
X-Forwarded-* headers are honored.

Issue SPR-15020
2016-12-15 17:04:57 -05:00
Rossen Stoyanchev 96474405dc Refactor ServerWebExchange/ServerHttpRequest builders
ServerWebExchange.Builder has an additional Consumer-style shortcut
method that accepts a builder for modifying the request.

ServerWebExchange and ServerHttpRequest builders have fewer methods,
more use-case focused vs matching directly to properties.
2016-12-15 17:02:05 -05:00
Rossen Stoyanchev 6119415427 Support for "request parameters"
ServerWebExchange now provides access to "requestParams" as a
MulitValueMap with query parameters and form data combined.

The combined map is then used for the params condition of
@RequestMapping purposes () and also for @RequestParam arguments.

Issue: SPR-15000
2016-12-15 14:24:39 -05:00
Sebastien Deleuze 36da299f96 Add set/getContentLanguage() to HttpHeaders
Issue: SPR-14536
2016-12-15 17:30:53 +01:00
Sebastien Deleuze 9764d57433 Add set/getAcceptLanguage() to HttpHeaders
Issue: SPR-15024
2016-12-15 17:19:37 +01:00
Juergen Hoeller 8a7467020f Polishing 2016-12-15 15:44:16 +01:00
Juergen Hoeller 37c734ec90 Consistent DeferredResultHandler invocation outside of result lock
Issue: SPR-14978
2016-12-15 15:43:47 +01:00
Juergen Hoeller 23f0418337 LocaleContextHolder provides support for framework-level default settings
Issue: SPR-15017
2016-12-15 15:43:40 +01:00
Arjen Poutsma 36a6580638 Remove copyright notice from package-info.java files. 2016-12-15 13:22:11 +01:00
Arjen Poutsma 97558ab4de Move Body[Inserter|Extractor] to web.reactive.function 2016-12-15 13:22:11 +01:00
Arjen Poutsma aac20b3fd1 Move functional web framework to web.reactive.function.server 2016-12-15 13:22:11 +01:00
Arjen Poutsma aa8f531526 Move WebClient to web.reactive.function.client 2016-12-15 13:22:11 +01:00
Sebastien Deleuze dfcd5b9ed9 Add a test to validate Reactor Netty automatic flushing
Issue: SPR-14992
2016-12-15 13:08:36 +01:00
Stephane Maldini c201a14ea2 Temp disabling reactor-netty to unblock pipeline 2016-12-15 04:11:34 +00:00
Rossen Stoyanchev 257318eb87 Minor refactoring + polish in server reactive package
Renamed:
AbstractListenerFlushProcessor -> AbstractListenerWriteFlushProcessor
2016-12-14 17:43:07 -05:00
Rossen Stoyanchev 4738a61e98 Early registration of ReadListener
This is similar to the WriteListener changes on the ServerHttpResponse
where we are more naturally exposed to a delayed write. Nevertheless
we could also have a delayed read and should be consistent. The early
initialization of the RequestBodyPublisher also simplifies the
internal implementation a bit.
2016-12-14 16:17:46 -05:00
Juergen Hoeller 3370f41c61 Defensively catch IllegalStateException from match attempts (for compatibility with AspectJ 1.8.10)
Issue: SPR-15019
2016-12-14 22:06:13 +01:00
Juergen Hoeller 29543856ec OkHttpClientHttpRequestFactory allows POST request without body
Issue: SPR-15015
2016-12-14 22:05:34 +01:00
Juergen Hoeller 6d1cae2f57 Avoid proxy replacement for generic return type signatures
Issue: SPR-15010
2016-12-14 22:00:41 +01:00
Juergen Hoeller 58eccfe5bd Remove setExtractOldValueForEditor at DataBinder level (to be deprecated in 4.3.5)
Issue: SPR-15009
2016-12-14 22:00:05 +01:00
Juergen Hoeller b366e159f8 Fine-tuned handling of running state
Issue: SPR-14527
2016-12-14 21:59:49 +01:00
Rossen Stoyanchev 5a29069798 Refactor AsyncListener registration + polish
Instead of registering an AsyncListener in ServletHttpHandlerAdapter
we now register an AsyncListener in each of the request and response
where the events need to be handled anyway. This allows removing the
package private delegation methods in the request and response.
2016-12-14 15:34:58 -05:00
Rossen Stoyanchev 70f14c14c8 Polish Undertow reactive server support 2016-12-14 14:51:33 -05:00
Rossen Stoyanchev c3621bf153 Merge pull request #1268 from violetagg/undertow-byte-buffer-pool 2016-12-14 13:51:35 -05:00
Rossen Stoyanchev d3e05296e1 Replace close method with Undertow exchange listener
The Undertow HttpServerExchange has a complete listener which we can
use instead of the close() method UndertowServerHttpRequest.
2016-12-14 13:48:40 -05:00
Violeta Georgieva 8d786e8bba Refactor the usage of Undertow ByteBufferPool
- lazy allocate the PooledByteBuffer, only if there is a request body
  for reading
- close the PooledByteBuffer once the request finishes
2016-12-14 12:49:09 -05:00
Juergen Hoeller 35eaeb5636 Merge pull request #1269 from moores-expedia/use-rowmapper-hook
SPR-15018 - Construct RowMapper using the impl hook
2016-12-14 18:25:51 +01:00
Arjen Poutsma 582e625fcf Allow HandlerFunction to return Mono<ServerResponse>
This commit makes it possible for handler functions to return
asynchronous status codes and headers, by making HandlerFunction.handle
return a Mono<ServerResponse> instead of a ServerResponse. As a
consequence, all other types that deal with HandlerFunctions
(RouterFunction, HandlerFilterFunction, etc.) had to change as well.

However, when combining the above change with method references (a very
typical use case), resulting signatures would have been something like:

```
public Mono<ServerResponse<Mono<Person>>> getPerson(ServerRequest request)
```

which was too ugly to consider, especially the two uses of Mono. It was
considered to merge ServerResponse with the last Mono, essentialy making
ServerResponse always contain a Publisher, but this had unfortunate
consequences in view rendering.

It was therefore decided to drop the parameterization of ServerResponse,
as the only usage of the extra type information was to manipulate the
response objects in a filter. Even before the above change this was
suggested; it just made the change even more necessary.

As a consequence, `BodyInserter` could be turned into a real
`FunctionalInterface`, which resulted in changes in ClientRequest.

We did, however, make HandlerFunction.handle return a `Mono<? extends
ServerResponse>`, adding little complexity, but allowing for
future `ServerResponse` subtypes that do expose type information, if
it's needed. For instance, a RenderingResponse could expose the view
name and model.

Issue: SPR-14870
2016-12-14 16:52:36 +01:00
mmoores 79c202ab14 Call getColumnRowMapper() to create the row mapper; prevents requirement to override extractReturnedResults(). 2016-12-14 07:48:32 -08:00
Sebastien Deleuze 4021d239ab Fix JsonObjectDecoder with '[' starting chunk
Issue: SPR-15013
2016-12-14 14:53:12 +01:00
Rossen Stoyanchev b70071fdda Remove temporary workaround in ReactorServertHttpResponse
We no longer should need the workaround for:
https://github.com/reactor/reactor-netty/issues/2

Issue: SPR-14643
2016-12-14 08:50:37 -05:00
Rossen Stoyanchev 2633b4e9ec RedirectView applies encodeUri + polish 2016-12-14 05:54:53 -05:00