Commit Graph

2178 Commits

Author SHA1 Message Date
Juergen Hoeller 7baf33fea0 Avoid multiple warnings related to jackson-module-kotlin
Issue: SPR-16497
2018-02-14 21:19:57 +01:00
Rossen Stoyanchev 1aeae5d40d Fix compiler error 2018-02-14 12:23:52 -05:00
Rossen Stoyanchev 0ead0503eb AbstractJackson2Encoder uses private fields
Make the protected fields in AbstractJackson2Encoder private plus
minor refactoring to the way streaming separators are applied.

The current (5.0.3) behavior is to always use '\n', but in 5.0.4 the
newly supported "application/stream+x-jackson-smile" needs to be
excluded from that. For now, separator determination remains private
in the abstract base class, but current behavior remains which is to
apply '\n' by default.

Issue: SPR-15424
2018-02-14 12:15:01 -05:00
Sam Brannen 24adc7d3c6 Delete unused imports 2018-02-14 16:55:57 +01:00
igor-suhorukov 7826567df6 Polish: lamdbas containing only one statement should not nest this statement in a block 2018-02-14 01:22:01 +01:00
Juergen Hoeller 99662bc702 Polishing 2018-02-13 23:32:10 +01:00
igor-suhorukov 45e520ed86 Polish: remove unused private fields, remove empty operator 2018-02-13 23:00:18 +01:00
Rossen Stoyanchev 8c37ad7ac5 Startup/shutdown log messages for AbstractHttpServer
Issue: SPR-16494
2018-02-13 14:58:10 -05:00
Juergen Hoeller 0c78c9c6f7 Refined javadoc and exception messages 2018-02-13 15:25:42 +01:00
Vladimir Sitnikov 659f13be1c Avoid creating message arguments to Assert.isABC calls
See 67f184293b
2018-02-13 12:31:49 +01:00
Juergen Hoeller a5a069c5b1 Upgrade to JavaMail 1.6.1 2018-02-13 00:02:43 +01:00
igor-suhorukov 0ee505b73e Polish: assertion arguments should be passed in the correct order,
use assertNull instead of assertEquals(null, value),
declare delta as double value in assertEquals
2018-02-10 17:17:28 +01:00
Juergen Hoeller 39201adca4 Consistent handling of InterruptedException
Issue: SPR-16479
2018-02-10 13:03:33 +01:00
igor-suhorukov 6ea0af3540 Polish: Lambdas should be replaced with method references 2018-02-10 12:09:46 +01:00
igor-suhorukov 9a6fbf59c5 Polish: follow name convention - make immutable fields final 2018-02-10 12:09:19 +01:00
Stephane Nicoll 991eb4858e Update copyright header 2018-02-09 10:16:58 +01:00
igor-suhorukov c0b4b5787f Change this "try" to a try-with-resources
Closes gh-1671
2018-02-09 10:12:55 +01:00
igor-suhorukov e381514b07 Collection.isEmpty() should be used to test for emptiness
Closes gh-1670
2018-02-09 10:11:44 +01:00
igor-suhorukov 4c888d0f32 Polish
Closes gh-1669
2018-02-09 10:10:05 +01:00
Arjen Poutsma fb61af1882 Allow "release on close" for DataBuffer.asInputStream
This commit introduces DataBuffer.asInputStream(boolean), that can
release the underlying buffer when the stream is closed.

Furthermore, this commit adds additional javadoc.

Issue: SPR-16444
2018-02-08 10:11:53 +01:00
Rossen Stoyanchev 1b98d09855 Fix copy+paste error 2018-02-06 15:43:05 -05:00
Rossen Stoyanchev efdfe9ad8d Minor Javadoc update 2018-02-06 11:23:53 -05:00
Rossen Stoyanchev 1653a32a04 Stabilize Flux.interval emissions in integration tests
After this commit the use of interval in tests is combined with
take(n).onBackpressureBuffer(n) to ensure emissions don't fail if the
fixed rate is exceeded (e.g. on slow CI server).

Tests that verify N number of items followed by verifyOnComplete()
should set the number of emissions to N.

Tests that verify N number of items followed by thenCancel() should
set the number of buffered to an arbitrary number greater than N.
2018-02-06 11:01:19 -05:00
Juergen Hoeller 5c813a366b Consistent use of @throws instead of @exception 2018-02-05 22:51:51 +01:00
Juergen Hoeller 817a836960 Consistent object type exposure for JSON rendering (workaround for Gson)
Issue: SPR-16461
2018-02-05 22:51:33 +01:00
sdeleuze 196f3f8cc1 Improve WebFlux exception logging
This commit updates HttpWebHandlerAdapter and
ResponseStatusExceptionHandler in order to specify the method/uri in the
logged message.

It also logs a WARN message for bad request (400) HTTP responses in
order to get some logs when an exception is thrown due to client error
(unable to deserialize request body for example).

Issue: SPR-16447
2018-02-05 16:08:22 +01:00
Arjen Poutsma 609f173ebc StringDecoder shouldn't chop off strings randomly
Issue: SPR-16337
2018-02-02 15:59:21 +01:00
Juergen Hoeller c5a33d62dd TypeVariablesVariableResolver compares variables by full equality again
Issue: SPR-16456
2018-02-02 12:41:43 +01:00
Juergen Hoeller b3e21ec737 MockHttpServletRequest leniently handles invalid Accept-Language header
Issue: SPR-16454
2018-02-02 11:34:22 +01:00
Juergen Hoeller 4a1cc9ced7 Constructor-provided field values get recorded for failed binding result
Also, TypeMismatchExceptions get registered via BindingErrorProcessor.

Issue: SPR-16449
2018-02-02 11:33:56 +01:00
Rossen Stoyanchev 6d909b013e Do not commit response on access to content
MockHttpServletResponse no longer calls flushBuffer on calls to
getContentAsByteArray and getContentAsString. The flushing doesn't
actually do anything useful but does commit the response leading to
unexpected side effects.

Issue: SPR-16430
2018-01-30 16:19:08 -05:00
sdeleuze d02e4fb545 Add Vary:Access-Control-Request-Method/Headers CORS headers
This commit adds these 2 Vary headers in addition to the existing
Origin one to avoid caching of Access-Control-Request-Method and
Access-Control-Request-Headers headers which can be an issue
when allowed methods or headers are unbounded and only the
requested method or headers are returned in the response.

Issue: SPR-16413
2018-01-30 17:00:32 +01:00
Rossen Stoyanchev f4de8615aa Fix encoding issue in ServerHttpRequest.mutate()
Issue: SPR-16434
2018-01-30 10:23:02 -05:00
Rossen Stoyanchev 4f28c28287 Update Javadoc on uriTemplateHandler property
Issue: SPR-16419
2018-01-29 21:53:22 -05:00
sdeleuze 32f6ccece8 Add WebFlux support for Smile streaming
The commit brings following changes:
 - Move getDecodableMimeTypes() to AbstractJackson2Decoder
 - Move getEncodableMimeTypes() to AbstractJackson2Encoder
 - Add support for application/stream+x-jackson-smile
 - Avoid streaming line separator when Smile encoder is used
 - Use double null token in Jackson2Tokenizer to identify documents

Issue: SPR-16151
2018-01-29 18:56:25 +01:00
Juergen Hoeller e49198d49f Polishing 2018-01-25 22:12:29 +01:00
Juergen Hoeller ef3f93e84a Language tag parsing support in StringUtils and StringToLocaleConverter
Issue: SPR-16188
2018-01-25 19:10:31 +01:00
Juergen Hoeller c6b0d85a7c Consistent available() support in DelegatingServletInputStream
Issue: SPR-16416
2018-01-25 19:06:20 +01:00
Rossen Stoyanchev b948e7cf75 Polish 2018-01-24 19:58:14 -05:00
Rossen Stoyanchev 84cc7ffdf6 Fix test failure 2018-01-24 19:55:46 -05:00
Juergen Hoeller 0e6f8df0a8 ServletServerHttpRequest.getURI() ignores malformed query string
The resolved URI instance is also being cached now. This should not make a difference in a real Servlet environment but does affect tests which assumed they could modify an HttpServletRequest path behind a pre-created ServletServerHttpRequest instance. Our WebSocket test base class has been revised accordingly, re-creating the ServletServerHttpRequest in such a case.

Issue: SPR-16414
2018-01-24 22:13:40 +01:00
Stephane Nicoll 42a2081e8c Polish "Remove an unnecessary intermediate variable"
Closes gh-1650
2018-01-24 09:18:46 +01:00
Johnny Lim 826db88509 Remove an unnecessary intermediate variable
See gh-1650
2018-01-24 09:18:24 +01:00
Juergen Hoeller 91e6274b7d Upgrade to Apache HttpClient 4.5.5 and Tomcat 8.5.27 2018-01-22 22:11:00 +01:00
Arjen Poutsma b47491695e Support array of scalar values in Jackson2Tokenizer
Issue: SPR-16407
2018-01-22 17:08:08 +01:00
Juergen Hoeller 9d0e62ef68 Javadoc format and related polishing 2018-01-22 11:43:21 +01:00
Arjen Poutsma 0befc60c8f Renamed DataBufferUtils/DataBufferFactory.compose to join
Issue: SPR-16365
2018-01-22 10:51:07 +01:00
Arjen Poutsma 646fcc5c2f Support Custom Headers for Multipart Async Data
This commit makes sure there is no custom Content-Disposition header
before setting one automatically.

This commit also adds a headers(Consumer<HttpHeaders>) method, so that
one can user the nicer methods of HttpHeaders, as opposed to basic
strings.

Issue: SPR-16376
2018-01-20 15:18:20 +01:00
Juergen Hoeller 395c9bd723 Consistently call HttpURLConnection.setFixedLengthStreamingMode(long)
Issue: SPR-16404
2018-01-20 14:29:40 +01:00
andrm 142f1ab42f Removed unnecessary cast to int
Since Java7 HttpURLConnection offers setFixedLengthStreamingMode method with long parameter which should be prefered over version with int argument, therefore casting ContentLength to int is no longer needed. Moreover it makes impossible to stream payload larger than Integer.MAX_VALUE
2018-01-20 14:11:15 +01:00
Rossen Stoyanchev 283811b16b Ensure filename is written
Now that SPR-16307 makes it possible to write a part with a Publisher
we need to ensure we get the filename correctly when writing with
Publisher<Resource>.

Issue: SPR-16376
2018-01-19 22:12:53 -05:00
Rossen Stoyanchev afd248da8a MultipartHttpMessageWriter consumes source once only
The previous fix #09f1f7 did not actually address the issue but only
moved it further down, so instead of the subscribe(), it was consuming
it inside the MultipartHttpMessageWriter#write method which returned
this.body.then(), and then again for the actual request body writing.

In this commit MultipartHttpMessageWriter#write returns Mono.empty()
since we don't actually want to write the part content from there, but
only want to access it as soon as it is availabele, for writing to
the request body.

Issue: SPR-16402
2018-01-19 20:55:22 -05:00
Juergen Hoeller 572c668726 Polishing 2018-01-19 21:30:37 +01:00
Arjen Poutsma 5520e730f1 DataBufferUtils.read should not take input stream/channel as parameter
Fixed by creating `Callable`-based variants, as explained in the JIRA
issue.

Issue: SPR-16403
2018-01-19 17:38:14 +01:00
Rossen Stoyanchev 09f1f727a7 Remove explicit subscribe in MultipartHttpMessageWriter
Issue: SPR-16402
2018-01-19 10:41:08 -05:00
Juergen Hoeller 40127bd9ad Polishing 2018-01-19 12:30:10 +01:00
Juergen Hoeller 9623cdec48 Functional response builders allow for non-standard HTTP status codes
Issue: SPR-16366
2018-01-14 17:45:58 +01:00
Juergen Hoeller 06e6386dc9 CollectionUtils.lastElement for common Set/List extraction
Issue: SPR-16374
2018-01-12 18:23:52 +01:00
Juergen Hoeller 93f645800b Test for non-equality after URI normalization
Issue: SPR-16364
2018-01-12 16:46:06 +01:00
Arjen Poutsma 67e7c784e8 Use DataBufferUtils.compose and remove writeAggregator
Use DataBufferUtils.compose instead of writeAggregator to combine
multiple data buffers into one, as the write aggregator would not work
when the initial data buffer did not have enough capacity to contain
all subsequent buffers.

Removed writeAggregator, as it is no longer needed.

Issue: SPR-16365
2018-01-12 10:36:09 +01:00
Rossen Stoyanchev c60313de3f Refine UriTemplate match pattern
The match/matches methods of UriTemplate use a regex with (.*) in place
of URI variables, which work fine except in the end where such a
pattern can match greedily more than one segment.

This commit updates the regex to use ([^/]*) instead since URI
variables are only meant to be used within a single path segment.

Issue: SPR-16169
2018-01-11 16:36:35 -05:00
Arjen Poutsma 8a129ef3da Use write aggregator from DataBufferUtils
This commit uses the newly introduced write aggregator from
DataBufferUtils throughout WebFlux.

Issue: SPR-16351
2018-01-10 11:15:47 +01:00
Rossen Stoyanchev 5ed0cf9027 Fix init issues in AbstractReactiveWebInitializer
Issue: SPR-16290
2018-01-09 17:32:40 -05:00
Rossen Stoyanchev 018469286d Polish 2018-01-09 16:39:40 -05:00
Jeff Nelson 30e40210a8 Extract protected method in AbstractRequestLoggingFilter
Issue: SPR-16245
2018-01-09 16:38:21 -05:00
sdeleuze 9c7de232b8 Polishing
Optimize same origin check when the request is an instance of
ServletServerHttpRequest and when there is no forwarded headers.

This commit also optimizes the getPort methods and ForwardedHeaderFilter
forwarded headers checks.

Issue: SPR-16262
2018-01-09 14:33:54 +01:00
sdeleuze c326e44488 Refine forwarded protocol support
This commit refines forwarded protocol support in order to support
proxies that only set "X-Forwarded-Proto" header and not
"X-Forwarded-Port" by performing a reset of the port in such case.

"Forwarded" header support has been updated accordingly since it
also supports similar use case, as described in SPR-15504.

Issue: SPR-16262
2018-01-09 14:33:54 +01:00
Rossen Stoyanchev 446e7ed25c Links from @RequestMapping to reference docs
Issue: SPR-16266
2018-01-08 09:29:52 -05:00
Juergen Hoeller 4a57e26d76 Polishing 2018-01-07 23:33:35 +01:00
Rossen Stoyanchev 37f0e8c6e5 Access to ApplicationContext via ServerWebExchange
Issue: SPR-16298
2018-01-05 15:46:45 -05:00
Juergen Hoeller a49123a72b Upgrade to RxJava 2.1.8 (and Protobuf 3.5.1) 2017-12-31 18:51:22 +01:00
sdeleuze d2616b7996 Fix RestOperations extensions parameters nullability
Issue: SPR-16328
2017-12-27 17:54:38 +01:00
sdeleuze deac8e556e Improve Kotlin extensions doc about type erasure
Since type erasure can be fixed only when using
ParameterizedTypeReference based Java methods, RestOperations and
WebFlux API documentation should be updated to specify which extensions
are subject to type erasure, and which are not.

Issue: SPR-16273
2017-12-27 17:49:18 +01:00
Arjen Poutsma 6c3a64578c Move ResolvableType from HttpEntity to PublisherEntity
This commit moves the ResolvableType field from HttpEntity to
PublisherEntity, a new entity type defined in MultipartBodyBuilder.
With this change, the scope of the ResolvableType is limited to
multipart-related code, instead of becoming part of the complete
HttpEntity hierarchy.

Issue: SPR-16307
2017-12-22 13:44:01 +01:00
Arjen Poutsma f23612c3a3 Add ResolvableType to HttpEntity for multipart Publishers
This commit adds a ResolvableType field to HttpEntity, in order to
support Publishers as multipart data. Without the type, the
MultipartHttpMessageWriter does not know which delegate writer to use to
write the part.

Issue: SPR-16307
2017-12-21 17:40:27 +01:00
Juergen Hoeller 4577a19190 Upgrade to Commons Pool 2.5 (and Jackson Kotlin Module 2.9.3) 2017-12-21 13:52:00 +01:00
sdeleuze 0075f13126 Improve CORS list properties combination logic
This commit allows CorsConfiguration#combine()
to differentiate permit default values set by
CorsConfiguration#applyPermitDefaultValues()
from values configured explicitly by the user.

Those permit default values will be overridden
by any user-provided ones while user-provided values
will be combined in an additive way, including
when "*" is specified.

Documentation has been improved accordingly.

Issue: SPR-15772
2017-12-20 22:38:01 +01:00
Rossen Stoyanchev a8cf275aed MockServerHttpRequest builder supports query params
Issue: SPR-16280
2017-12-19 15:38:12 -05:00
Rossen Stoyanchev 6df1a7874a MockHttpServletResponse uses correct language header
Issue: SPR-16311
2017-12-19 13:56:16 -05:00
Arjen Poutsma 8e253a316d Support top-level scalar values in Jackson2Tokenizer
Issue: SPR-16166
2017-12-14 16:44:40 +01:00
Juergen Hoeller 05988193b7 Upgrade to Jackson 2.9.3 and Netty 4.1.18 2017-12-13 17:55:50 +01:00
sdeleuze 6a7b197af7 Improve Jackson codecs documentation 2017-12-13 12:07:43 +01:00
sdeleuze 73a81f98d4 Allow interceptors to add existing header values
Additional commit to provide support of requests
that have a body.

Issue: SPR-15066
2017-12-13 10:08:24 +01:00
Rossen Stoyanchev f05175586e Refine behavior on error after response committed
If the response is set and we can't change the status through
ServerHttpResponse any more, allow the error signal to propagate and
let the individual server adapters handle it. Ultimately that should
result in closing the connection.

On Servlet containers, we check one last time if the response is
committed (we may not have filled the buffer). If not then save
the exception as a request attribute, dispatch, and re-throw it on the
container thread.

On Undertow access the connection and close it.

On Netty just let the error through to Reactor Netty.

Issue: SPR-16051
2017-12-12 14:51:24 -05:00
Christoph Dreis 260ebeca3a Improve performance of some string operations
Issue: SPR-16293
2017-12-12 17:14:24 +01:00
sdeleuze 554662ebab Allow interceptors to add existing header values
Provide a fully mutable HttpHeaders to ClientHttpRequestInterceptors
of a RestTemplate when headers are set using HttpEntity. This avoids
UnsupportedOperationException if both HttpEntity and
ClientHttpRequestInterceptor add values for the same HTTP header.

Issue: SPR-15066
2017-12-11 15:01:20 +01:00
Juergen Hoeller d198626618 Upgrade to Gradle 4.4 (and Apache HttpClient 4.5.4)
Issue: SPR-16237
2017-12-07 07:28:07 +01:00
Rossen Stoyanchev 203370a810 Handle absolute URI in Reactor request.uri()
The request URI returned from HttpServerRequest.uri() typically
contains contains an absolute path but could also contain an
absolute URI. This commit adds handling for the latter, effectively
taking only the absolute path portion.

Issue: SPR-16243
2017-12-01 23:34:35 -05:00
Rossen Stoyanchev b9a1168580 Consistently return null if certificates not available
Issue: SPR-16244
2017-12-01 21:38:40 -05:00
Rossen Stoyanchev e99b0038a0 Polish 2017-12-01 21:18:13 -05:00
Rossen Stoyanchev dd0d270ba2 Improve error handling when response is committed
ResponseStatusExceptionHandler lets the error through if it can't
change the status while HttpWebHandlerAdapter logs a more helpful
message (including status code) but without a full stack trace.

Issue: SPR-16231
2017-11-29 12:39:06 -05:00
Juergen Hoeller 873cb4e58b Remove unnecessary deprecation suppression 2017-11-29 15:44:08 +01:00
Sam Brannen 2b68212c20 Fix grammar 2017-11-29 14:44:21 +01:00
Rossen Stoyanchev 3650ecc3bb Polish 2017-11-28 22:16:07 -05:00
Rossen Stoyanchev dc3d834026 Refinements related to a committed response
1. setComplete checks the isCommitted flag to avoid an unnecessary
debug message. This method is meant to be safe to call many times.

2. setStatusCode lowers log message to TRACE, since the return value
communicates the outcome it's arguably much less critical.

3. Add comment and test case for ResponseStatusExceptionHandler.
A ResponseStatusException is clearly meant to be handled by this
handler so don't let it pass through even if the respones is
committed.

Issue: SPR-16231
2017-11-27 16:31:49 -05:00
Juergen Hoeller a8323f6a27 Latest dependency updates (OkHttp 3.9.1, JRuby 9.1.14, Rome 1.9) 2017-11-26 16:03:48 +01:00
sdeleuze 3b96690e69 Add missing RestOperations extensions
Issue: SPR-16229
2017-11-23 22:12:03 +01:00
Rossen Stoyanchev 01a82b5291 Improve semantics writing currentData
Before this commit, the return value from write was interpreted as the
data being fully written and ready to be released via releaseData().

This is not true for WebSocketSession implementations where a true
return value simply means the message was sent with the full payload
but releas is not appropriate until a send confirmation.

Technically not an issue since WebSocketSession's extending this do
not use pooled buffers. Nevertheless this commit refines the semantics
of write, removes the releaseData() method, and makes sub-classes
responsible for releasing the buffer when fully written (and they
know best when that is). As a bonus currentData is now private.

Issue: SPR-16207
2017-11-23 10:55:03 -05:00
Rossen Stoyanchev 102a0ad792 Polish 2017-11-23 10:22:35 -05:00
Rossen Stoyanchev c1b191edb0 Polish and improve logging 2017-11-22 23:25:36 -05:00
Rossen Stoyanchev afdca285e5 Avoid resume-suspend race condition
This commit turns suspendReading() into a readingPaused() notification
that is invoked after a succession of reads stops because there is no
more demand. Sub-classes can use this notification to suspend, if that
applies to them.

Most importantly the notification is guaranteed not to overlap with
checkOnDataAvailable() which means that suspend does not need to be
atomic and guarded against resume. The two can and do compete all the
time when reading ends with no demand, and a request for demand arrives
concurrently.

Issue: SPR-16207
2017-11-22 17:48:03 -05:00
sdeleuze 4a87d3da7b Set Vary: Origin on CORS unauthorized response
Issue: SPR-16224
2017-11-22 22:46:53 +01:00
sdeleuze 652e5c5584 Disable CORS credentials by default
Access-Control-Allow-Credentials CORS header, used to
allow cookies with CORS requests, is not set to true
anymore by default when enabling CORS with
@CrossOrigin or global CORS configuration in order to
provide a more secured default CORS configuration.

The related allowCredentials property now requires to
be set to true explicitly in order to support cookies
with CORS requests.

Issue: SPR-16130
2017-11-22 22:46:44 +01:00
Rossen Stoyanchev b7c924cac1 Polish 2017-11-21 23:20:13 -05:00
Rossen Stoyanchev 06b2ab3908 Use volatile for subscriber in base publishers
Issue: SPR-16207
2017-11-21 22:57:15 -05:00
Rossen Stoyanchev 3c2d1862f1 Light refactoring/polish in reactive read/write bridge
Issue: SPR-16207
2017-11-21 21:46:30 -05:00
Violeta Georgieva 2a481c5411 Fix race conditions in AbstractListenerReadPublisher
Transition from DEMAND->NO_DEMAND:
Two concurrent threads enter DEMAND.request and DEMAND.onDataAvailable.
And DEMAND.onDataAvailable finishes before DEMAND.request to be able to
update the demand field then a request for reading will be lost.

Transition from READING->NO_DEMAND:
readAndPublish() returns false because there is no demand but before
switching the states READING.request is invoked again a request for
reading will be lost.

Changing READING->DEMAND/NO_DEMAND is made conditional so that the
operations will be executed only if changing states succeeds.

When in READING state detect completion before each next item in order
to exit sooner, if completed.

Issue: SPR-16207
2017-11-21 14:44:46 -05:00
Violeta Georgieva b814875211 Fix race condition in transition from UNSUBSCRIBED->COMPLETED
- Ensure completion signal (normal/exception) will be delivered to
the subscriber when transition from UNSUBSCRIBED->COMPLETED

- According to the specification "Publisher.subscribe MUST call onSubscribe
on the provided Subscriber prior to any other signals to that Subscriber" so
ensure onComplete/onError signals will be called AFTER onSubscribe signal.

Issue: SPR-16207
2017-11-21 14:44:01 -05:00
Violeta Georgieva 41b13a4e8a Ensure onComplete/onError events will be delivered
Issue: SPR-16207
2017-11-21 14:42:05 -05:00
Juergen Hoeller 0cc644f61f Polishing 2017-11-21 16:34:08 +01:00
sdeleuze 9f1d8517ba Polish Kotlin source code style 2017-11-21 15:59:23 +01:00
Juergen Hoeller 40dacd3c1c Polishing 2017-11-20 22:27:07 +01:00
Juergen Hoeller 040aae5309 Upgrade to Protobuf 3.5 and Apache Johnzon 1.1.5 2017-11-20 12:49:25 +01:00
Andy Clement 508aea8a47 Rework implementation of PathPattern.extractPathWithinPattern
This commit changes the implementation of the PathPattern
extractPathWithinPattern method that used an old AntPathMatcher
derivative to a new version that integrates more closely with
PathContainer.

It also introduces consistency in a couple of areas. The javadoc
is updated to specify this but basically:
- the response from the extra method will have all leading
  and trailing separators removed.
- the response will have multiple adjacent separators within the
  reponse reduced to just one.  (For example response would be
  aaa/bb/cc and not aaa///bbb//cc)
If your response would start or finish with multiple separators, they
are all removed.

Issue: SPR-16120
2017-11-17 12:03:17 -08:00
Violeta Georgieva 0fbfa64385 UndertowServerHttpRequest: suspend reading when no demand
- When there is no demand for reading, the implementation
should suspend reading otherwise useless events will be
send by Undertow to the registered read listener.
- There is not need to wait for an event for reading/writing after calling
resumeReads/resumeWrites
2017-11-16 16:15:55 +01:00
Rossen Stoyanchev 19a9bc4747 Remove unnecessary assertion
Issue: SPR-16201
2017-11-15 16:04:32 -08:00
Rossen Stoyanchev e818b904ad Polish WebSocket-related 2017-11-13 23:20:01 -05:00
Juergen Hoeller 72f20e8d4f Polishing 2017-11-11 00:37:50 +01:00
Rossen Stoyanchev 87375fe6f8 ServerHttpRequest exposes SSL certificates
Issue: SPR-15964
2017-11-10 16:43:12 -05:00
Juergen Hoeller 780993ce75 Polishing 2017-11-10 20:21:26 +01:00
Juergen Hoeller de782026c4 Explicitly document UriTemplate as thread-safe
Issue: SPR-16173
2017-11-10 20:20:23 +01:00
Rossen Stoyanchev a5103307c6 Polish ErrorArgumentResolver 2017-11-10 10:15:46 -05:00
Rossen Stoyanchev 807297f173 Remove RxNetty (from test sources)
Practically no changes to RxNetty for a year and efforts underway to
rebuild 0.6.x based on a current Reactor Netty base.

Aside from the extra time to run integration tests having two
Netty-based servers can also cause false alarms such as ByteBuf leaks
related to RxNetty.
2017-11-09 15:56:56 -05:00
Rossen Stoyanchev 369d33c3d0 Support charset config by (static) resource location
This commit adds support for configuring static resource locations
with a charset to be applied to relative paths.
2017-11-09 13:15:06 -05:00
Rossen Stoyanchev 840ef46a9f Polish
Also remove ErrorDeferredResultProcessingInterceptor which was meant
to be package private to begin with as its peer
ErrorCallableProcessingInterceptor (also removed).
2017-11-08 23:15:31 -05:00
Rossen Stoyanchev 9786750b5a Improve @RequestAttribute WebFlux resolver
The resolver now takes into account the possibility the attribute
itself may be a reactive type.

Issue: SPR-16158
2017-11-06 21:44:45 -05:00
Rossen Stoyanchev 14f02d7192 Update reference with examples of multipart requests
Issue: SPR-16118
2017-11-06 16:33:58 -05:00
Arjen Poutsma af2e296ff3 Javadoc 2017-11-06 16:00:18 +01:00
Arjen Poutsma 2d1f87501c Add MultipartBodyBuilder
This commit introduces the MultipartBodyBuilder, a builder for multipart
form bodies.

Issue: SPR-16134
2017-11-06 10:42:11 +01:00
Juergen Hoeller e5c1deea63 Polishing 2017-11-05 16:23:30 +01:00
Juergen Hoeller 80a0cf71f4 MockHttpServletResponse.getDateHeader returns -1 for non-existent header
Includes consistent getDateHeader results in both MockHttpServletResponse variants (spring-test and spring-web)

Issue: SPR-16160
2017-11-05 16:12:21 +01:00
Juergen Hoeller 0edf4d6509 MockHttpServletRequest.getRequestURL aligns with getServerName/Port
Issue: SPR-16138
2017-11-05 16:11:21 +01:00
Juergen Hoeller 996d747aed Upgrade to Mockito 2.11
Includes fixes for invalid exception declarations in Mockito-based unit tests. Also includes FreeMarker 2.3.27, Commons Pool 2.4.3, JSON-P 1.1.2.

Issue: SPR-16157
2017-11-04 01:06:59 +01:00
Rossen Stoyanchev ef39092b3b UriUtils#encodUriVariables methods are now public 2017-11-03 08:21:55 -04:00
Rossen Stoyanchev 4534c5fbfc AbstractReactiveWebInitializer supports Servlet mapping
Issue: SPR-16155, SPR-16144
2017-11-02 21:03:09 -04:00
Rossen Stoyanchev 8c33ed02b3 ServletHttpHandlerAdapter supports Serlvet path mapping
Issue: SPR-16155
2017-11-02 20:53:26 -04:00
Rossen Stoyanchev aa653b23bc Add AbstractReactiveWebInitializer
This commit introduces a new AbstractReactiveWebInitializer in
spring-web that relies on WebHttpHandlerBuilder to detect request
processing infrastructure beans from an ApplicationContext.

This eliminates the need to create a DispatcherHandler, since it is
expected to be a Spring bean, and as a result the initializers in
spring-webflux have been deprecated.

Issue: SPR-16144
2017-11-02 14:57:06 -04:00
Norman Soetbeer 4dee333a75 Allow empty usernames for BasicAuth
The RFCs around basic authentication don't explicitly disallow empty
usernames. On the other hand usernames containing colons are, as colons
are used to separate the username from the password.
2017-11-02 09:59:14 -05:00
Rossen Stoyanchev 579328bd7a MockClientHttpRequest|Response support cookie headers
Issue: SPR-16124
2017-10-31 12:08:18 -04:00
Juergen Hoeller d06129debd InterceptingHttpAccessor uses internal ArrayList for sorting
Also caches InterceptingClientHttpRequestFactory (if applicable)

Issue: SPR-16137
2017-10-31 16:33:38 +01:00
Rossen Stoyanchev 8083eaae54 syncBody better differentiates plain vs multipart forms
FromHttpMessageWriter and MultipartHttpMessageWriter both support
MultiValueMap except the former supports String values only. This
presents an issue since either full generic type information must be
provided, which is cumbersome on the client side, or if left out there
is no good way to order the writers to make a proper decision.

This commit:

- refines the canWrite behavior of   to not a
accept MultiValueMap without proper generic information unless the
MediaType is explicitly set providing a strong hint.

- modifies MultipartHttpMessageWriter to be configured with a
FormHttpMessageWriter so it can write both plan and multipart data with
the ability to properly differentiate based on actual map values.

Issue: SPR-16131
2017-10-31 09:12:05 -04:00
Arjen Poutsma 49787493a6 Proper Undertow PooledByteBuffer release
This commit changes the way Undertow's PooledByteBuffers are dealt with.
Previously, these buffers where closed as soon as all data was read. As
of this commit, the UndertowServerHttpRequest returns PooledDataBuffers
from getBody(), so that the buffers are released when release() is
called.
2017-10-30 10:39:18 +01:00
Juergen Hoeller d963597ec0 Test with hasError for unknown status code
Issue: SPR-16108
2017-10-24 15:51:29 +02:00
Sebastien Deleuze 1c256a112b Parse correctly ContentDisposition header with semicolons
Issue: SPR-16091
2017-10-23 23:09:14 +02:00
Juergen Hoeller ecea82d3a5 Polishing 2017-10-23 17:14:09 +02:00
Rossen Stoyanchev 1cc5afe24b Fix lines over 120 characters
https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-Code-Style#line-wrapping
2017-10-20 16:42:26 -04:00
Andy Wilkinson 07eee05d1d Add missing "be" in Part's javadoc
Closes gh-1570
2017-10-20 16:43:48 +02:00
Rossen Stoyanchev ab92754a2e @MatrixVariable resolvers for WebFlux
The information was already parsed and available in a request attribute
but until now there were no argument resolvers to expose it.

Issue: SPR-16005
2017-10-19 21:01:38 -04:00
Arjen Poutsma c7a15260d6 Various DataBuffer improvements
This commit introduces various improvements in DataBuffer:

- DataBuffer now exposes its read and write position, as well as its
capacity and writable byte count.
- Added DataBuffer.asByteBuffer(int, int)
- DataBufferUtils.read now reads directly into a DataBuffer, rather than
copying a ByteBuffer into a DataBuffer
- TomcatHttpHandler now reads directly into a DataBuffer

Issues: SPR-16068 SPR-16070
2017-10-19 10:38:52 +02:00
Juergen Hoeller 9df6f3e6b8 Polishing 2017-10-18 20:21:49 +02:00