Commit Graph

13376 Commits

Author SHA1 Message Date
Stephane Nicoll
6fb4352e5c Merge pull request #1204 from marschall:SPR-14809
* pr/1204:
  Remove OracleLobHandler from documentation
2016-10-14 18:00:58 +03:00
Philippe Marschall
eee742da7f Remove OracleLobHandler from documentation
Now that OracleLobHandler has finally been removed it should also be
removed from the documentation.

This commit includes the following changes:

 * remove OracleLobHandler references from Javadoc
 * remove OracleLobHandler references from Asciidoctor

Issue: SPR-14809
Closes gh-1204
2016-10-14 18:00:26 +03:00
Rossen Stoyanchev
960cc42060 Fix test failure in WebSessionIntegrationTests 2016-10-13 18:02:41 -04:00
Rossen Stoyanchev
d4446c79b6 Restore state field in AbstractServerHttpResponse
This commit fixes test failures introduced earlier in commit 9f8e84.
2016-10-13 17:10:51 -04:00
Rossen Stoyanchev
8eeda746e3 Merge pull request #1194 from violetagg/async-timeout 2016-10-13 16:33:22 -04:00
Rossen Stoyanchev
c1e5e3a87e Polish AsyncListener in ServletHttpHandlerAdapter 2016-10-13 16:31:53 -04:00
Violeta Georgieva
7e94377382 Handle async operation events
Problem:
The following exception is observed on an async timeout:
"java.lang.IllegalStateException: It is invalid to call
isReady() when the response has not been put into non-blocking mode"

Current Implementation:
The async operation events sent by the web container are not propagated
to the internal implementation. When timeout/error happens and if the
application does not complete the async operation, the web container
will complete it. At that point if the application tries to read/write,
the operation will fail with an exception (above) that there is not
async operation started.

Proposed Solution:
On async timeout or error, make calls to:
- AbstractRequestBodyPublisher.onError,
- AbstractResponseBodyProcessor.onError,
- AbstractResponseBodyFlushProcessor.onError
As a result of these calls the async operation will be completed and no
more invocations of read/write will be made.
2016-10-13 16:14:33 -04:00
Rossen Stoyanchev
9f8e8458c1 Polish AbstractServerHttpResponse
This commit simplifies the logic for applying beforeCommit actions
replacing the use of chained Mono.then calls with a single
Flux.concat.

Also renamed writeStatusCode, writeHeaders, and writeCookies to
applyStatusCode, applyHeaders, and applyCookies respectively to
better reflect we're simply setting them on the underlying response
(not necessarily written yet).
2016-10-13 16:04:30 -04:00
Brian Clozel
336b4d2fb8 Polish 2016-10-13 20:57:15 +02:00
Rossen Stoyanchev
e3ecf012f9 Add docs on error handling in REST scenarios 2016-10-13 13:56:40 -04:00
Rossen Stoyanchev
71201e1a43 Relax generic type detection for ResponseEntity
Before this change the getHttpEntityType method in
HttpEntityMethodProcessor raised an ISE if the generic type cannot be
detected. That made sense for resolving a controller method argument
where the target body type is crucial. However for a return value
the generic type should not be required since we either have an
actual body or no body at all in which case it doesn't even matter.

This change relaxes the checks and defaults to Object.class for the
ResponseEntity generic type on the return value side.

Issue: SPR-14799
2016-10-13 13:31:47 -04:00
Sam Brannen
a795fd4714 Add support for URI templates in redirectedUrl() & forwardedUrl()
Prior to this commit, the redirectedUrl() and forwardedUrl() methods in
MockMvcResultMatchers supported fully constructed URLs and URLs
containing Ant-style path patterns. However, URI templates were not
supported for these result matchers even though the request path can be
built using URL templates -- for example, via the get() and post()
methods in MockMvcRequestBuilders.

This commit addresses this shortcoming by allowing users to supply a
URL template instead of a fully constructed URL to redirectedUrl() and
forwardedUrl(). To populate the URL template, template variables may be
supplied to redirectedUrl() and forwardedUrl() as var-args.

Issue: SPR-14790
2016-10-13 17:02:00 +02:00
Sam Brannen
509796a4b5 Polish MockMvcResultMatchers[Tests] 2016-10-13 17:01:47 +02:00
Sam Brannen
8cf1933148 Only print request/response body if char enc is present in MVC Test
Commit e65a1a4372 introduced support in PrintingResultHandler for only
printing the request or response body in the Spring MVC Test framework
if the content type is known to be text-based (e.g., plain text, HTML,
XHTML, XML, JSON, etc.). For unknown content types the body is assumed
to be text-based and is therefore always printed. The latter behavior,
however, is undesirable since the content may in fact not be text-based.

This commit addresses this issue by making the printing of the request
or response body an opt-in feature. Specifically, if a character
encoding has been set, the request or response body will be printed by
the PrintingResultHandler. Note, however, that the character encoding
is set to ISO-8859-1 in MockHttpServletResponse by default.

In addition, MockHttpServletRequest's getContentAsString() method now
throws an IllegalStateException if the character encoding has not been
set.

Issue: SPR-14776
2016-10-13 16:55:14 +02:00
Juergen Hoeller
69116c2acc Documentation for InjectionPoint argument on @Bean method
Issue:  SPR-14797
2016-10-12 17:14:24 +02:00
Juergen Hoeller
a29188a191 Upgrade to Hibernate Validator 5.3 (as well as Log4J 2.7, Protobuf 3.1, Tomcat 8.5.6)
Issue: SPR-13965
2016-10-12 17:13:07 +02:00
Juergen Hoeller
eafaaa5cb8 Polishing 2016-10-12 17:11:04 +02:00
Juergen Hoeller
a32b52555a @Primary not marked as inherited anymore
Issue: SPR-14780
2016-10-12 17:10:29 +02:00
Juergen Hoeller
74b6a5b6d7 BindingResult does not hold on to ConversionService when serialized in session
Issue: SPR-8282
2016-10-12 17:08:55 +02:00
Juergen Hoeller
66722afda0 StompSubProtocolHandler does not insist on SimpMessageHeaderAccessor
Issue: SPR-14791
2016-10-12 17:08:05 +02:00
Rossen Stoyanchev
aff43c29fd BindingContext implements TypeConverter 2016-10-12 09:01:15 -04:00
Rossen Stoyanchev
bd69390c0f Fix failing test 2016-10-12 08:56:52 -04:00
Rossen Stoyanchev
8a043ae9aa Replace direct use of Validator and ConversionService
This commit replaces direct use of Validator and ConversionService in
the reactive @RequestMapping infrustructure in favor of using the
BindingContext.

Issue: SPR-14541
2016-10-11 20:53:52 -04:00
Rossen Stoyanchev
d87aa40efe Add BindingContext
This commit adds a BindingContext to be used in spring-web-reactive
@RequestMapping infrastructure (comparable to WebDataBinderFactory in
spring-web-mvc) for access to the default model, data binding,
validation, and type conversion purposes.

Issue: SPR-14541
2016-10-11 20:50:59 -04:00
Rossen Stoyanchev
cabb253269 Replace "mvc" in web rective config bean names 2016-10-11 20:20:40 -04:00
Rossen Stoyanchev
1de73b9b4f Polish 2016-10-11 20:20:40 -04:00
Rossen Stoyanchev
b28b3e8877 Add WebExchangeDataBinder
Issue: SPR-14541
2016-10-11 20:20:40 -04:00
Sam Brannen
580b8b92f8 Fix punctuation in Javadoc 2016-10-11 20:40:12 +02:00
Sam Brannen
e65a1a4372 Print only printable request/response body in MVC Test
Prior to this commit, PrintingResultHandler always printed the request
or response body regardless of its content type. For binary content,
however, the output was unreadable and therefore useless.

This commit addresses this issue by only printing the request or
response body if it is "printable" (i.e., if its content type is known
to be text-based such as plain text, HTML, XHTML, XML, JSON, etc.). If
the content type is unknown (e.g., unspecified for the HTTP request in
the test), it is assumed that the body is printable.

Issue: SPR-14776
2016-10-11 20:19:26 +02:00
Brian Clozel
7ae729480e Resolve absolute resource links in ResourceTransformers
This commit adapts the fix for SPR-14597 commited to spring-webmvc to
the spring-web-reactive module.

Issue: SPR-14597
2016-10-11 17:45:34 +02:00
Brian Clozel
679b661e19 Resolve absolute resource links in ResourceTransformers
Prior to this commit, `ResourceTransformer` implementations would
resolve internal links to other resources: both relative and absolute
request paths.
For relative request paths, those transformers would call
`ResourceTransformerSupport.resolveUrlPath` with the resource path,
as provided in the original file. This can cause problems when a
`CachingResourceResolver` is configured in the resolver chain, because
this resolver is caching resources, deriving the cache key from the
given resource path — this can cause collisions for cases like this:

    resources/
    |--foo/
    |  |--foo.css (imports style.css)
    |  |--style.css
    |--bar/
    |  |--bar.css (imports style.css)
    |  |--style.css

The first "style.css" resolved resource is then cached and will be given
to any request asking for "style.css".

To avoid those issues, this commit improves the `ResourceTransformer`
implementations to calculate the absolute request path before asking the
chain to resolve the resource URL, thus avoiding duplications.
The resource chain will be then asked to resolve "/foo/style/css" or
"/bar/style.css".

Issue: SPR-14597
2016-10-11 17:45:34 +02:00
Sebastien Deleuze
9bf8489afd Remove duplicated elements in CorsConfiguration#combine()
Issue: SPR-14792
2016-10-11 10:38:34 +02:00
Sebastien Deleuze
196c73fa50 Polish CorsConfigurationTests 2016-10-11 10:03:12 +02:00
Stephane Nicoll
ab232a5386 Polish EnableAsync javadoc
Issue: SPR-14793
2016-10-11 08:21:52 +02:00
Rossen Stoyanchev
1f6f0dc101 Add getHandler in reactive AbstractHandlerMapping 2016-10-10 18:00:11 -04:00
Rossen Stoyanchev
33c48e7a17 Polish reactive CORS support 2016-10-10 18:00:11 -04:00
Sebastien Deleuze
e31a2f778b Add Reactive CORS support
This is a port of Spring MVC CORS support for Spring Web Reactive:
 - CORS classes keep the same name but are in the
   web.cors.reactive package
 - CorsConfiguration is reused because not tied to Servlet API
 - CORS HandlerMapping integration is done at
   AbstractHandlerMapping level
 - AbstractUrlHandlerMapping and AbstractHandlerMethodMapping
   have been slightly modified to call
   AbstractHandlerMapping#processCorsRequest()
 - Both global CORS configuration + @CrossOrigin support have
   been implemented

Issue: SPR-14545
2016-10-10 18:00:05 -04:00
Sebastien Deleuze
0cc330e8fc Fix HttpRequest#getURI() with Netty based engines
Host and port are now properly retrieved from Reactor
Netty and RxNetty (the scheme is not available).

Issue: SPR-14794
2016-10-10 23:35:23 +02:00
Brian Clozel
ea5ff87f8e Fix NumberFormatException with X-Forwarded-Host
This commit fixes `NumberFormatException`s that were thrown when parsing
IPv6 host values in `X-Forwarded-Host` request headers.

Issue: SPR-14761
2016-10-07 23:11:34 +02:00
Brian Clozel
53441f8962 Configure default SSL context in Netty RequestFactory
This commit configures a default SslContext if none has been provided.
This also enforces separate Netty bootstrap instances for cleartext and
TLS exchanges.

Issue: SPR-14744
2016-10-06 15:57:26 +02:00
Stephane Nicoll
715006d5df Fix table layout 2016-10-06 15:26:26 +02:00
Sebastien Deleuze
0ba7ea5f92 Upgrade to Reactor Netty 0.5.2.RELEASE
This new Reactor Netty release fix a critical issue that could
prevent proper connection handling.
2016-10-06 15:16:25 +02:00
Juergen Hoeller
ebed7b77c3 SpringValidatorAdapter declares ResolvableAttribute as serializable
Issue: SPR-14778
2016-10-05 21:54:56 +02:00
Juergen Hoeller
ffc781b163 Explicit calls on Buffer base type (for compatibility with covariant return type on JDK 9's ByteBuffer)
Issue: SPR-14645
2016-10-05 00:10:06 +02:00
Juergen Hoeller
2fea1f7da3 Upgrade to RxJava 2.0 RC3 (as well as EhCache 3.1.3 and Hibernate ORM 5.2.3) 2016-10-05 00:04:51 +02:00
Juergen Hoeller
cfa0f6c84b Consistent final logger fields 2016-10-04 23:00:36 +02:00
Juergen Hoeller
684d6ab553 @Lookup reference documentation
Issue: SPR-14765
2016-10-04 22:39:08 +02:00
Sebastien Deleuze
324c310cbd Log unresolved exceptions at error level 2016-10-04 16:08:59 +02:00
Brian Clozel
11aa920785 Remove RxJava 1.x variants of WebClient adapters
Issue: SPR-14743
2016-10-04 14:47:55 +02:00
Brian Clozel
ee17f56626 Fix missing ETag/LastModified headers in responses
Prior to this commit, the `HttpEntityMethodProcessor` would avoid
writing ETag/Last-Modified response headers before calling
`ServletWebRequest` to process conditional requests. This was done to
avoid duplicate response header values due to headers being already
written to the underlying servlet response.

This is still necessary for GET/HEAD requests, since this is properly
handled by `ServletWebRequest` for those cases. But
`HttpEntityMethodProcessor` should not make that decision for
PUT/PATCH/POST responses since developers are adding response headers on
purpose and should be in control of the situation — whereas
`ServletWebRequest` does not write those headers in those cases.

Issue: SPR-14767
2016-10-04 12:08:09 +02:00