Commit Graph

13307 Commits

Author SHA1 Message Date
Juergen Hoeller d94ce0a1b2 Avoid package dependency cycles 2016-09-20 22:41:11 +02:00
Juergen Hoeller 65e01eabf0 DispatcherHandler.toWebHandler/toHttpHandler convenience methods 2016-09-20 22:40:43 +02:00
Brian Clozel 5b33e02fb4 Add ClientHttpRequestInterceptor in WebClient
This commit adds a new chain-based, interception contract to be used
with `WebClient`. This is the HTTP client equivalent of the `WebFilter`
contract already implemented in web reactive server.

A `ClientHttpRequestInterceptor` implementation can transform the
outgoing HTTP request (method, URI or headers) before delegating it to
the next interceptor in the chain, or bypass the request processing
altogether and return a (cached) HTTP response.

Issue: SPR-14502
2016-09-20 18:15:07 +02:00
Brian Clozel c608103140 Add client HTTP request and response Mocks 2016-09-20 18:15:07 +02:00
Sebastien Deleuze f918a2b192 Rename beforeRead/Write() to resolveRead/WriteHints()
This commit also removes the ServerHttpResponse parameter, not
needed here since it is possible to override the write() method.

Issue: SPR-14557
2016-09-20 17:52:31 +02:00
Brian Clozel e3da8b5e9c Polish ResourceHttpRequestHandler, ResourceEncoder 2016-09-20 16:49:14 +02:00
Brian Clozel 3596e72050 Add range requests support in ResourceWebHandler
This commit handles range requests in `ResourceWebHandler`, using the
`ResourceHttpMessageWriter` configured within the handler.

This `WebHandler` will add a `HTTP_RANGE_REQUEST_HINT` writer hint
containing all the HTTP Range information of the request.

Issue: SPR-14664
2016-09-20 16:46:03 +02:00
Brian Clozel a7a9e36ca0 Add ResourceRegionHttpMessageWriter
This new `HttpMessageWriter` leverages the `ResourceRegionEncoder` to
write `ResourceRegion` to HTTP responses, thus supporting HTTP Range
requests.

Whenever possible, this message writer uses the zero copy support for
single range requests.

This `HttpMessageWriter` is never used directly, but is used as a
delegate by the `ResourceHttpMessageWriter`. When provided with the
`BOUNDARY_STRING_HINT`, the `ResourceRegionHttpMessageWriter`
adapts its behavior in order to write a single/multiple byte ranges.

Issue: SPR-14664
2016-09-20 16:18:45 +02:00
Brian Clozel 55d6f88dcd Add ResourceRegionEncoder
This commit adds the necessary infrastructure for the support of HTTP
Range requests. The new `ResourceRegionEncoder` can write
`ResourceRegion` objects as streams of bytes.

The `ResourceRegionEncoder` relies on an encoding hint
`BOUNDARY_STRING_HINT`. If present, the encoder infers that multiple
`ResourceRegion`s should be encoded and that the provided boundary
String should be used to separate ranges by mime boundaries.
If that hint is absent, only a single resource region is encoded.

Issue: SPR-14664
2016-09-20 16:14:22 +02:00
Sebastien Deleuze 1d46b8d7e1 Polish 2016-09-20 14:28:12 +02:00
Sebastien Deleuze 857e77eec2 Make ServerHttpMessageReader/Writer more powerful and flexible
This commit makes it possible, in addition to provide hints, to
perform additional operations with the request and the response
at ServerHttpMessageReader/Writer level.

AbstractServerHttpMessageReader/Writer now provide
convenient beforeRead/beforeWrite abstract methods for such need.

Issue: SPR-14557
2016-09-20 11:55:51 +02:00
Sebastien Deleuze 38f3d12e45 Do not provide hints for can*() methods anymore
Issue: SPR-14557
2016-09-20 11:55:51 +02:00
Arjen Poutsma b83a6daf4b Javadoc 2016-09-20 11:19:40 +02:00
Rossen Stoyanchev adc69097fa Fix startup exception related to ResourceWebHandler
Issue: SPR-14735
2016-09-19 21:15:42 -04:00
Juergen Hoeller d71f6fe366 Latest dependency updates (EclipseLink 2.6.4, Jackson 2.8.3, JavaMail 1.5.6) 2016-09-19 21:51:34 +02:00
Sebastien Deleuze 1bf828a149 Polish 2016-09-19 16:32:50 +02:00
Rossen Stoyanchev 99c7917124 Reset connection before delegating to handler
Resetting the connection first before invoking a failure callback on
the application handler ensures that any checks to isConnected will
return false.

Issue: SPR-14721
2016-09-19 09:04:23 -04:00
Stephane Nicoll d8a771356c Merge pull request #1180 from kosmaty:doc-formatting-fix
* pr/1180:
  Polish
  Documentation formatting fix
2016-09-19 14:58:15 +02:00
Stephane Nicoll ec865d27d8 Polish 2016-09-19 14:58:00 +02:00
Krzysztof Kosmatka 0ada3f2dab Documentation formatting fix
Removed unnecessary quotation marks that caused improper rendering
of in-line code.

Closes gh-1180
2016-09-19 14:52:06 +02:00
Stephane Nicoll 3e11a30c64 Merge pull request #1181 from kosmaty:validation-doc-formatting-fix
* pr/1181:
  Add missing quotation mark
2016-09-19 14:46:30 +02:00
Krzysztof Kosmatka 906827ea92 Add missing quotation mark
Closes gh-1181
2016-09-19 14:46:05 +02:00
Arjen Poutsma 753bb854aa Rename Configuration to StrategiesSupplier 2016-09-19 12:09:19 +02:00
Juergen Hoeller bf6653b837 Adapted to 4.3.3 backport
Issue: SPR-14728
2016-09-18 21:33:58 +02:00
Juergen Hoeller f532de92aa Revised checkResource implementation
Issue: SPR-14729
(cherry picked from commit ca17edd)
2016-09-18 21:33:52 +02:00
Brian Clozel 9e5435e6f2 Check template availability in ScriptTemplateView
This commit overrides the `checkResource` implementation in
`ScriptTemplateView` in order to check if the template file resource is
available and if the resolver can then proceed with rendering the
template.

Issue: SPR-14729
Cherry-picked from: 66b370e10
2016-09-17 22:30:54 +02:00
Sam Brannen b521aa879f Clean up warnings related to forthcoming removals in Tomcat 9 2016-09-17 16:16:06 +02:00
Sam Brannen 8f62b63663 Introduce 'value' alias for @Bean's 'name' attribute
In order to simplify configuration for use cases involving @Bean where
only a bean name or aliases are supplied as an attribute, this commit
introduces a new 'value' attribute that is an @AliasFor 'name' in @Bean.

Issue: SPR-14728
2016-09-17 16:16:06 +02:00
Arjen Poutsma 778ef02680 Rename BodyInsertor to BodyInserter 2016-09-17 16:07:00 +02:00
Arjen Poutsma b6035ce9ae Refactor BodyInsertor
Refactor BodyInsertor to expose insertion logic directly, rather than
exposing a writer function and supplier.
2016-09-17 11:48:53 +02:00
Arjen Poutsma 3f55706413 Rename BodyPopulator to BodyInsertor 2016-09-17 11:29:04 +02:00
Arjen Poutsma 1bf75e330c Fix tangle
Fixed package tangle between w.r.f.RequestPredicates and w.r.f.support.RequestWrapper.
2016-09-17 11:05:05 +02:00
Rossen Stoyanchev b2ccdfbc9e Polish error logging for HTTP reactive server classes 2016-09-16 16:09:44 -04:00
Violeta Georgieva 80ff5ae9c5 Improve exception handling when clients disconnect.
Issue: SPR-14538
2016-09-16 16:09:43 -04:00
Brian Clozel c4b9b92247 Polish ResponseExtractors 2016-09-16 21:39:38 +02:00
Rob Winch b58a06208f Add HttpBasic ClientWebRequestPostProcessor
Issue: SPR-14682
2016-09-16 21:29:59 +02:00
Rossen Stoyanchev 0bace1b0ae Add getContextPath to ServerHttpRequest
Issue: SPR-14726
2016-09-16 15:21:48 -04:00
Juergen Hoeller 3772398700 Explicit sun.nio.ch export for Netty's NioEventLoopGroup on JDK 9
Issue: SPR-14645
2016-09-16 18:59:14 +02:00
Juergen Hoeller b60af42e23 Polishing
(cherry picked from commit ace25d4)
2016-09-16 18:59:14 +02:00
Rossen Stoyanchev cf2112f539 Update intializer for the reactive servlet adapter
Move the AbstractServletHttpHandlerAdapterInitializer together with
the other two base classes in spring-web-reactive. Since the
interface is in the web package, this avoids a package cycle.
Also add a mention in the reference.

Issue: SPR-14713
2016-09-16 12:57:16 -04:00
Arjen Poutsma 2b57a4d618 Add WebApplicationInitializers for Web Reactive
This commit introduces three new WebApplicationInitializers for use with
Spring Web Reactive:

 - The AbstractServletHttpHandlerAdapterInitializer registers a
 ServletHttpHandlerAdapter that wraps a user-provided HttpHandler.

 - The AbstractDispatcherHandlerInitializer registers a
 ServletHttpHandlerAdapter that wraps a DispatcherHandler (or any
 WebHandler). The handler is provided with an application context.

 - The AbstractAnnotationConfigDispatcherHandlerInitializer is a
 subclass of the above, creating an
 AnnotationConfigApplicationContext based no provided @Configuration
 classes.

Issue: SPR-14713
2016-09-16 12:57:16 -04:00
Arjen Poutsma b703dbf6ab Polishing 2016-09-16 18:44:35 +02:00
Arjen Poutsma de3e07b320 Move instance methods before static methods 2016-09-16 18:44:35 +02:00
Arjen Poutsma c57beef95e Rename RoutingFunction to RouterFunction 2016-09-16 18:44:35 +02:00
Arjen Poutsma 228a01b298 Polishing 2016-09-16 18:44:34 +02:00
Arjen Poutsma 8072497ce2 Extract body extraction logic in w.r.f
This commit refactors the response body extraction logic into a separate
function: BodyExtractor. Standard populators can be found in
BodyExtractors.
2016-09-16 18:44:34 +02:00
Arjen Poutsma 5e730408fd Extract body population logic in w.r.f
This commit extracts the response body insertion logic into a separate
strategy interface: BodyPopulator. Standard populators can be found in
BodyPopulators.
2016-09-16 18:44:34 +02:00
Arjen Poutsma 91bde2e6b2 Refactor Router to RoutingFunctions
This commit refactors the Router into a RoutingFunctions class, by:

  - Renaming the class :)
  - Moving all Configuration logic into a separate, top-level
  Configuration class with mutable builder.
2016-09-16 18:44:34 +02:00
Rossen Stoyanchev aaa1281809 Remove Exception declaration in abstract Encoder 2016-09-16 12:20:15 -04:00
Sebastien Deleuze 9d8c089a21 Polish 2016-09-16 16:17:37 +02:00