Commit Graph

1281 Commits

Author SHA1 Message Date
Rossen Stoyanchev
f6e2c585c8 Refactor tests to use toExchange() shortcuts
Issue: SPR-15350
2017-03-16 11:55:09 -04:00
Arjen Poutsma
1dc38660e5 Support ResponseStatusException in WebFlux fn
This commit introduces support for the ResponseStatusException in the
functional web framework.

Issue: SPR-15344
2017-03-16 09:40:48 +01:00
Rossen Stoyanchev
d39da1d06d Polish + minor HttpHandler refactoring
CompositeHttpHandler is public and called ContextPathCompositeHandler.

Also an overhaul of the Javadoc on HttpHandler, WebHttpHandlerAdapter,
and ContextPathCompositeHandler.
2017-03-15 17:05:20 -04:00
Sebastien Deleuze
170057005e Use .nest() instead of .route() in Kotlin Web DSL
The goal is to have better consistency between Java
and Kotlin functional Web API.
2017-03-15 17:21:04 +01:00
Sebastien Deleuze
abc0c6e3e8 Replace RouterFunction.route() by a router() Kotlin helper 2017-03-15 17:17:31 +01:00
Rossen Stoyanchev
164204ca04 Reactive type checks for all argument method resolvers
All method argument resolvers now explicitly check for the presence
of a reactive type wrapper and reject it where not expected.

Issue: SPR-15297
2017-03-14 19:56:31 -04:00
Rossen Stoyanchev
a04fef8450 Rename AbstractHandlerResultHandler to HRHSupport 2017-03-14 19:56:31 -04:00
Rossen Stoyanchev
a7582fcc23 Polish method parameter handling 2017-03-13 15:38:08 -04:00
Rossen Stoyanchev
5ae9afd5a5 Refactor SyncInvocableHandlerMethod
Switch from extension to delegation model, i.e. delegating to
InvocableHandlerMethod, so that only sync invocation is exposed and
only resolvers of type SyncHandlerMethodArgumentResolver are allowed
to be configured in a cleaner fashion.
2017-03-13 15:38:03 -04:00
Rossen Stoyanchev
f490f3ca63 Polish SyncHandlerMethodArgumentResolver hiearchy 2017-03-13 15:37:40 -04:00
Sebastien Deleuze
3c26e7f014 Add seeOther shortcut to ServerResponse.BodyBuilder 2017-03-13 11:32:49 +01:00
Rossen Stoyanchev
2cd6240dab Polish WebHttpHandlerBuilder 2017-03-10 17:04:11 -05:00
Brian Clozel
b799013567 Update to Reactor Aluminium SNAPSHOT
Currently the BOM versions are:

* reactor-core 3.0.6.BUILD-SNAPSHOT
* reactor-netty 0.6.2.BUILD-SNAPSHOT

This commit fixes as well a few deprecations in reactor-core.
2017-03-10 15:20:40 +01:00
Sebastien Deleuze
9963c4a495 Fix Kotlin warnings 2017-03-10 10:35:30 +01:00
Rossen Stoyanchev
9aa25c3982 Polish ServerSentEventHttpMessageReader 2017-03-08 16:38:58 -05:00
Rossen Stoyanchev
d57d3efc89 Polish default config for ExchangeStrategies
Add default readers and writers from separate methods instead of
having them interleaved which is hard to read and easy to miss.

Issue: SPR-15331
2017-03-08 14:33:44 -05:00
Rossen Stoyanchev
37726f4214 Improved annnotation support in ResolvableMethod 2017-03-06 09:19:57 -05:00
Rossen Stoyanchev
0296d003af Improved generics support in ResolvableMethod 2017-03-06 09:19:57 -05:00
Rossen Stoyanchev
cdf19d1db1 @RequestParam tests use ResolvableMethod 2017-03-03 23:43:01 -05:00
Rossen Stoyanchev
6950cc0e64 Move ResolvableMethod
From spring-webflux to spring-web test sources since it is perfectly
usable for testing Spring MVC annotation method support.

Potentially to be promoted further up for use in any module that has
annotation method support. It has spring-core dependencies only
2017-03-03 22:12:33 -05:00
Rossen Stoyanchev
8ed22394cf Refactor ResolvableMethod 2017-03-03 22:12:28 -05:00
Rossen Stoyanchev
ccb2c6530e Support for @ControllerAdvice in WebFlux
Issue: SPR-15132
2017-03-02 03:30:34 -05:00
Rossen Stoyanchev
24034447f6 Polish ExceptionHandler initialization
In preparation for SPR-15132
2017-03-01 18:08:41 -05:00
Rossen Stoyanchev
d8b150e83d Refactor BindingContext initialization
In preparation for SPR-15132.

Turn the BindingContextFactory into ModelInitializer (both package
private) since creating BindingContext itself is quite simple.

The ModelInitializer also has only one field and no need to be aware
of fields the RequestMappingHandlerAdapter.
2017-03-01 18:08:41 -05:00
Rossen Stoyanchev
c1086f4114 Polish BindingContext
In preparation for SPR-15132.
2017-03-01 18:08:41 -05:00
Juergen Hoeller
2b3fb2f5cc Polishing 2017-02-28 18:37:33 +01:00
Arjen Poutsma
56d669f849 Add permanent/temporary redirect to ServerResponse
This commit adds the temporaryRedirect(URI) and permanentRedirect(URI)
static creation methods to ServerResponse.
2017-02-28 15:47:19 +01:00
Rossen Stoyanchev
5237e47e66 Polish 2017-02-27 17:26:20 -05:00
Rossen Stoyanchev
226c9f9a73 Add WebFlux redirect integration test case
Issue: SPR-15291
2017-02-27 17:14:56 -05:00
Sebastien Deleuze
40ae8d41a4 Introduce ServerResponse Kotlin extensions
Issue: SPR-15293
2017-02-27 19:46:07 +01:00
Sebastien Deleuze
710702acdc Polish Kotlin routing DSL
- typealias to replace types like RouterDsl.() -> Unit by Routes
 - String.invoke() as path("/foo") shortcut
 - String.route() as pathPrefix("/foo").route() shortcut
 - Avoid requiring PathPredicates.* import

Issue: SPR-15292
2017-02-27 19:14:24 +01:00
stonio
7d062df992 Use String#isEmpty()
Closes gh-1335
2017-02-22 11:55:17 +01:00
Juergen Hoeller
d2cc97af47 Polishing 2017-02-21 22:41:40 +01:00
Juergen Hoeller
6242e30539 Polishing 2017-02-21 15:27:21 +01:00
Arjen Poutsma
7582adc0bc Fix trailing slash in nested path
This commit adds a trailing slash to the nested path if the request path
also ends with a slash. For instance, given the request "/foo/bar/", and
nested path pattern "/foo/**", we expect the nested path to be “/bar/”,
not “/bar".
2017-02-21 13:46:27 +01:00
Juergen Hoeller
1ddf8ec625 Polishing 2017-02-21 00:04:08 +01:00
Juergen Hoeller
73493bc490 Revised imports in tests (org.jetbrains.annotations.NotNull etc) 2017-02-20 23:00:22 +01:00
Arjen Poutsma
4221a344dc Treat empty Accept header as "*/*"
This commit changes the `accept` RequestPredicate so that it treats an
empty `Accept` header as having the value `*/*`, as per the HTTP spec.
2017-02-20 15:40:24 +01:00
Arjen Poutsma
1efcf26559 Defer evaluation of right-hand route in composed route 2017-02-20 10:59:53 +01:00
Arjen Poutsma
9ab8bd046c Improved logging in functional web framework
This commit improves predicate and route logging in the functional web
framework.
2017-02-20 10:59:23 +01:00
Sebastien Deleuze
4d48fde795 Fix RequestPredicate.route() implementation
Issue: SPR-14954
2017-02-16 23:34:28 +01:00
Sebastien Deleuze
305f303d46 Rename RouterDsl to Routes 2017-02-16 17:23:06 +01:00
Sebastien Deleuze
03f34e24ca Add nested route support to Kotlin DSL
Issue: SPR-14954
2017-02-16 17:22:55 +01:00
Arjen Poutsma
0922943c12 Rename RouterFunctions.subroute() to nest()
This commit renames the `RouterFunctions.subroute()` method to `nest()`, to
better represent what it does.

Issue: SPR-14954
2017-02-16 14:12:25 +01:00
Arjen Poutsma
1d589eb639 Add pathPrefix predicate
Added the `pathPrefix` predicate that tests the start of the request
path against a given pattern.

Issue: SPR-14954
2017-02-16 10:17:04 +01:00
Arjen Poutsma
36db6b2753 Removed json(), html() and xml() predicates
Removed `json()`, `html()` and `xml()` from `RequestPredicates`, since
they were confusingly named and would also require a counterpart that
reads the request `Content-Type` instead of the `Accept` header.
2017-02-15 11:06:08 +01:00
Sebastien Deleuze
7dd0f358ed Avoid using callable reference to stay Kotlin 1.0 compatible 2017-02-14 23:52:58 +01:00
Arjen Poutsma
bb9d3e1680 Renamed RouterFunction composition methods
Renamed `RouterFunction.andSame()` to `and()`, and `and()` to
`andOther()`. The reason for this change is that we can expect most
RouterFunctions to be parameterized over ServerResponse, and thus it
makes sense to use the shortest composition method (`and()`) for
composing router functions of the same type.

When a user composes different response types, such as composing a
`RouterFunction<RenderingResponse>` with an
`RouterFunction<EntityResponse<?>`, the `andOther` method is to be used,
but this is a less common scenario.
2017-02-14 15:51:57 +01:00
Arjen Poutsma
fcaf42507a Synchronise PathPatternParser access
This commit adds a synchronized block around the PathPatternParser,
since it is not thread-safe.
2017-02-14 12:11:48 +01:00
Sebastien Deleuze
f380ab9d90 Polish RouterFunctionExtensions
Issue: SPR-15065
2017-02-13 23:08:56 +01:00