Commit Graph

560 Commits

Author SHA1 Message Date
Juergen Hoeller
cfa0f6c84b Consistent final logger fields 2016-10-04 23:00:36 +02:00
Sebastien Deleuze
b91c0b3a1a Fix JSON and SSE writer registration
Issue: SPR-14748
2016-09-27 21:56:21 +02:00
Sebastien Deleuze
44ceecc8b3 Imply text/event-stream when serializing ServerSentEvent
Issue: SPR-14748
2016-09-27 09:27:33 +02:00
Juergen Hoeller
89717e1783 Reactive setup refinements 2016-09-21 11:24:20 +02:00
Brian Clozel
578af59f0c Polish byte-range resource handling 2016-09-20 23:46:21 +02:00
Juergen Hoeller
129d7bef6e Polishing 2016-09-20 22:41:20 +02:00
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
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
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
Arjen Poutsma
753bb854aa Rename Configuration to StrategiesSupplier 2016-09-19 12:09:19 +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
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
Sebastien Deleuze
6cda08e94b Add Jackson @JsonView support
Issue: SPR-14693
2016-09-16 12:51:27 +02:00
Sebastien Deleuze
e74c59bf30 Introduce ServerHttpMessageWriter/Reader to resolve hints
Issue: SPR-14693
2016-09-16 12:51:27 +02:00
Brian Clozel
084daa7fb5 Document media type registration for appcache files
Since appcache manifests can have various file extensions, developers
should register the (file extension, media type) mapping in their Spring
MVC / Reactive Web configuration.

This commit adds javadoc on both `AppCacheManifestTransformer` variants
to explain how to do that.

Issue: SPR-14510
2016-09-16 12:04:56 +02:00
Juergen Hoeller
6de4b12992 Adapted recent tests to pass on Windows 2016-09-15 14:12:49 +02:00
Rossen Stoyanchev
33d90747a1 Asynchronous ResourceResolver + ResourceTransformer
Issue: SPR-14521
2016-09-13 18:04:40 -04:00
Juergen Hoeller
915350d0ce Reliable last-modified timestamp tests on Windows 2016-09-13 21:41:11 +02:00
Arjen Poutsma
360ef5f5e3 Remove accidentally added ModelAndView class
Removed accidentally added ModelAndView class.
2016-09-13 20:16:41 +02:00
Sebastien Deleuze
fc52ddcd97 Polish 2016-09-13 15:03:13 +02:00
Arjen Poutsma
61bf6a25b7 Renamed 'and' to 'andSame' and 'andOther' to 'and'
In RoutingFunction, renamed 'and' to 'andSame', and 'andOther' to
'and' to make the commonly used method name shorter.
2016-09-12 15:41:58 +02:00
Arjen Poutsma
96ec18a9aa Merged all Response implementations into one
Merged all *Response implementations into one DefaultResponses class
2016-09-12 15:41:04 +02:00
Arjen Poutsma
35b93b2948 Add template rendering support
This commit introduces template rendering support in the web.reactive
package, through a Response.render method and a Rendering interface.
2016-09-12 15:39:49 +02:00
Sebastien Deleuze
aaba53f76a Allow to pass hints parameter in HttpMessageReader/Writer
Issue: SPR-14557
2016-09-12 11:13:27 +02:00
Sebastien Deleuze
b91867cf45 Update Codec API to use Map<String, Object> for hints
Issue: SPR-14557
2016-09-12 11:08:01 +02:00
Brian Clozel
1881aa5b5b Change default appcache manifest file extension
This commit changes the default file extension configured with
`AppCacheManifestTranformer`. This ResourceTransformer was previously
considering `.manifest` files by default, but this has been changed in
the official spec to `appcache`, in order not to clash with Microsoft's
unregistered application/manifest type.

Issue: SPR-14687
2016-09-09 22:11:20 +02:00
Brian Clozel
4588b6c9f4 Rename ResolvedResource to HttpResource
`ResolvedResource` is a rather generic name - changing the extended
interface to something more meaningful: `HttpResource`.
For now, implementations are linked with the resource handling chain,
but this aspect has been removed from the interface documentation.

Issue: SPR-14264
2016-09-09 18:18:09 +02:00
Arjen Poutsma
5f941c1dd1 Fix using system default charset in view rendering
Prior to this commit, FreeMarkerView used the system default charset to
render. This commit switches this by defaulting to UTF-8, if no charset
is specified in the content type.

 - Add contentType parameter to AbstractView.renderInternal, used to
 determine the charset contained therein
 - Adds a defaultCharset property to AbstractView and
 ViewResolverSupport.
2016-09-09 15:22:22 +02:00
Arjen Poutsma
a746c3c54e Changed View.render method to take Map<String, ?>
Changed View's render method from taking a HandlerResult to taking a
Map<String, ?>, in order to facilitate scenarios where a HandlerResult
is not available (i.e. web.reactive.function).
2016-09-09 15:22:21 +02:00
Arjen Poutsma
ecf5a9f34e Added Response.build(Publisher<Void>) 2016-09-09 12:19:51 +02:00
Arjen Poutsma
f4ae831f7f Polishing
- Changed Response.sse methods to allow for specific Publisher types to
 be returned in Response.
2016-09-09 10:53:45 +02:00
Arjen Poutsma
10e157a5a2 Removed unnecessary Driver file 2016-09-07 17:24:34 +02:00
Arjen Poutsma
f8ac17f278 Polishing
Two changes to web.reactive.function:

 - Changed Response.stream method to allow for specific Publisher types
 to be returned in Response.

 - Router now stores HttpMessageReader|Writer retrieved from
 Configuration in the attributes as supplier, not as stream, to allow
 for multiple reads.
2016-09-07 15:29:20 +02:00
Arjen Poutsma
bebaee9799 Removed attributes() from Request
Removes attributes() method from Request, as it exposes a mutable map.
2016-09-07 10:10:40 +02:00
Brian Clozel
ccb3c44dbc Add ResolvedResource in resource handling chain
Prior to this commit, the resource handling chain and its
`ResourceResolvers` would use specific `Resource` implementations in
order to add resource metadata to the HTTP response. For example,
`VersionedResource` and `EncodedResource` are both adding specific HTTP
response headers.

This commit aims at making this mechanism more stable and reusable,
since the previous implementation would fail in case a resolved resource
would be both a `VersionedResource` wrapping a `EncodedResource` (or the
other way arount). Only one of the specific implementations would
contribute its metadata since the code supporting that in
`ResourceHttpRequestHandler` would only check for `instanceof` tests,
whereas those implementations are acutally delegating calls to
the wrapped resource.

Now both `VersionedResource` and `EncodedResource` have been replaced by
specific implementations of `ResolvedResource`, which directly provides
those HTTP response headers as part of `getResponseHeaders()`.

This commit applies the same changes for the web reactive
implementations and its `ResourceWebHandler`.

Issue: SPR-14264
2016-09-07 09:52:33 +02:00