Commit Graph

3664 Commits

Author SHA1 Message Date
Sam Brannen e4b9b1fadb Introduce setDefaultCharacterEncoding() in MockHttpServletResponse
Prior to this commit, it was possible to set the character encoding
in MockHttpServletResponse via setCharacterEncoding() or
setContentType(); however, those methods append "charset=..." to the
Content-Type header which may not be an acceptable side effect.

This commit addresses this shortcoming by introducing a new
setDefaultCharacterEncoding() in MockHttpServletResponse which allows
one to override the previously hard coded value of "ISO-8859-1". In
addition, setDefaultCharacterEncoding() does not modify the Content-Type
header.

The reset() method has also been updated to reset the character encoding
to the configured default character encoding.

Closes gh-27214
2021-07-29 16:02:58 +02:00
Rossen Stoyanchev 55e17ef306 Polishing contribution
Closes gh-27203
2021-07-29 14:49:02 +01:00
Yanming Zhou f2be4e9320 Use MessageSource for @ExceptionHandler methods
Follow-up for commit bb816c123c

See gh-27203
2021-07-29 14:49:02 +01:00
Sam Brannen 5b3f11c543 Add @Nullable to setLocale in MockHttpServletResponse
See gh-26493
2021-07-29 14:47:31 +02:00
Sam Brannen 96ee8a3bc7 Ensure characterEncoding in MockHttpServletResponse is non-null
Closes gh-27219
2021-07-29 14:40:01 +02:00
Sam Brannen 403e04c0b4 Polish MockHttpServletResponse 2021-07-28 11:27:56 +02:00
Rossen Stoyanchev 6c68419073 Polishing contribution
Closes gh-27216
2021-07-27 17:41:30 +01:00
Moncef AOUDIA a747cc3e91 Fix error message in SynchronossPartHttpMessageReader 2021-07-27 17:25:30 +01:00
Rossen Stoyanchev d034a1f26d Blockhound rule for MediaTypeFactory static initializer
Closes gh-26631
2021-07-23 17:01:28 +01:00
Rossen Stoyanchev 460947651a Minor refactoring in DefaultPathContainer
Closes gh-27204
2021-07-23 16:53:54 +01:00
Juergen Hoeller ba08006d52 ObjectMapper.configure(MapperFeature, boolean) is deprecated as of Jackson 2.13
Closes gh-27206
2021-07-23 12:19:35 +02:00
Juergen Hoeller 2594f4e058 Avoid unnecessary cause initialization in ResponseStatusException
Closes gh-27196
2021-07-23 12:18:15 +02:00
Rossen Stoyanchev 0b1d14cdd9 Follow-up fix, checking also "ws" and port 80 case
See gh-27097
2021-07-16 09:34:12 +01:00
Rossen Stoyanchev bb816c123c Use MessageSource in HandlerMethod for error reason
Closes gh-27156
2021-07-13 19:38:58 +01:00
Rossen Stoyanchev e1f51cbce7 Check both https and wss in forwarded header checks
Closes gh-27097
2021-07-13 16:32:12 +01:00
Juergen Hoeller e1c0f3b067 CommonsMultipartResolver supports configurable HTTP methods
Closes gh-27161
2021-07-12 23:19:08 +02:00
Juergen Hoeller 1ff8da3635 StandardServletMultipartResolver provides strict Servlet compliance option
Closes gh-26826
2021-07-12 23:18:54 +02:00
Juergen Hoeller ed27ea7aa0 Restrict fallback multipart binding to POST requests with multipart/form-data
Closes gh-26999
See gh-26826
2021-07-12 17:55:49 +02:00
Juergen Hoeller 128689e79b Use entrySet iterator in getBodyFromServletRequestParameters
Closes gh-27081
2021-07-12 17:43:19 +02:00
Rossen Stoyanchev f9167c3df5 Improve Javadoc of ContentCachingRequestWrapper
Closes gh-27068
2021-07-09 20:34:22 +01:00
Rossen Stoyanchev 39442143b7 Fix and improve docs on {*var} pattern
Closes gh-27132
2021-07-09 20:09:06 +01:00
Juergen Hoeller 8680fdb8bc Polishing 2021-07-09 13:26:46 +02:00
Arjen Poutsma 297880d93e Reinstate abortOnCancel in JettyClientHttpRequest
This commit reinstates abortOnCancel in the ReactiveRequest builder,
which allows a cancel signal to abort the request.

See gh-26287 and gh-27112
2021-07-09 10:58:58 +02:00
Arjen Poutsma 9cbb5af622 Support request/response wrappers in JettyHttpHandlerAdapter
This commit makes JettyServerHttpRequest aware of
HttpServletRequestWrapper, and JettyServerHttpResponse aware of
HttpServletResponseWrapper.

Closes gh-27146
2021-07-08 16:39:35 +02:00
Arjen Poutsma 94f56a2684 Improve Jetty 10 check on client-side
Before this commit, JettyClientHttpResponse checked for the presence of
a server-side class to determine whether it is running on Jetty 10.
Unfortunately, that class is not necessarily present when just using the
Jetty client.

This commit improves the Jetty 10 check, so that it also works when
the Jetty client is used without the server.

Closes gh-27136
2021-07-06 11:04:06 +02:00
Arjen Poutsma cb251347c3 Do not use internal API in JettyClientHttpConnector
This commit makes sure that we no longer use the internal API in the
Jetty support for the WebClient. With this change, we are able to
support both Jetty 9, 10, and 11.

Closes gh-27112
2021-07-06 11:04:06 +02:00
Sam Brannen a2ef6badc4 Use StringBuilder.append(char) where possible
To slightly improve performance, this commit switches to
StringBuilder.append(char) instead of StringBuilder.append(String)
whenever we append a single character to a StringBuilder.

Closes gh-27098
2021-06-25 10:44:28 +02:00
Arjen Poutsma 4f770ca860 Synchronoss should create temp directory lazily
The SynchronossPartHttpMessageReader should only create temp directory
when needed, not at startup.

Closes gh-27092
2021-06-23 15:59:46 +02:00
Juergen Hoeller f69152c14e Add javadoc reference to MultipartFile.getResource()
See gh-27089
2021-06-22 15:27:19 +02:00
Sam Brannen 3676084472 Ensure DefaultPathSegment does not allow parameters to be mutated
Prior to this commit, if a PathContainer was created using
Options.MESSAGE_ROUTE, DefaultPathSegment#parameters() returned a
mutable map which would allow the user to modify the contents of the
static, shared EMPTY_PARAMS map in DefaultPathContainer.

This commit prevents corruption of the shared EMPTY_PARAMS map by
ensuring that parameters stored in DefaultPathSegment are always
immutable.

Closes gh-27064
2021-06-15 15:16:20 +02:00
Sam Brannen bcb0580492 Polish DefaultPathContainerTests 2021-06-15 13:35:45 +02:00
Sam Brannen 000b6a7e95 Polish @ResponseStatus javadoc and StatusAssertionTests 2021-06-08 18:55:05 +02:00
Sam Brannen f3db6b996d Polish contribution
See gh-27031
2021-06-08 18:55:05 +02:00
Rossen Stoyanchev a42540e64a Multipart writer detects custom Jackson encoder
Closes gh-27017
2021-06-08 17:41:04 +01:00
Sviatoslav Hryb aa2bfd4b62
Document that class-level @ResponseStatus is inherited by @ExceptionHandler methods
Closes gh-27031
2021-06-08 18:39:18 +02:00
Brian Clozel e35fe33b72 Revisit fix for gh-26905 in UriComponentsBuilder
This commit revisits the recently updated `PORT_PATTERN` in
`UriComponentsBuilder`. The fix introduced in gh-26905 fails with
ambiguous URL patterns, especially when the port and path parts of the
pattern are hard to differentiate, for example
"https://localhost:{port}{path}".

This commit reinstates the previous behavior without undoing the actual
fix. The only limitation introduced here is the fact that only a single
pattern variable is allowed for the port pattern part.

Fixes gh-27039
2021-06-08 15:26:13 +02:00
izeye 090e394fb5 Clean up @SuppressWarnings("ConstantConditions") 2021-06-08 13:47:00 +02:00
Sébastien Deleuze 6251222a23 Remove jackson-module-kotlin warning
Closes gh-26962
2021-06-08 11:44:03 +02:00
Brian Clozel 05eca05671 Close resources in HttpComponents client connector
Prior to this commit, the `HttpComponentsClientHttpConnector`
implementation could accept or create a default `HttpClient` instance
but not expose it as part of its API. This effectively prevents
applications from properly closing the associated resources when
disposing of the connector.

This commit implements the `Closeable` interface on the connector to
allow this use case.

Closes gh-27032
2021-06-08 11:22:30 +02:00
izeye 3fa4e4168d Remove redundant Collections.unmodifiableList() 2021-06-08 10:39:23 +02:00
Sam Brannen ad63a534cb Polish @CookieValue Javadoc 2021-06-04 15:14:42 +02:00
Rossen Stoyanchev 821ecb4cfd Update Javadoc for CookieValue
See gh-26989
2021-06-02 17:28:28 +01:00
Rossen Stoyanchev 1c17305d7b Check for null in allowedOrigin list
Closes gh-26987
2021-06-02 17:14:28 +01:00
Arjen Poutsma 5cbbbed377 Use given name in MultipartBodyBuilder::part
Make sure that we use the parameter name in MultipartBodyBuilder::part
when adding a Part, instead of using the name specified in the
'Content-Disposition' header that might have been in the part's headers.

Closes gh-27007
2021-05-31 15:17:12 +02:00
Stephane Nicoll 4049951c03 Update copyright year of changed file
See gh-26973
2021-05-26 08:50:15 +02:00
Dillon Regimbal 89441ea006 Fix typo
See gh-26973
2021-05-26 08:49:48 +02:00
Rossen Stoyanchev de1ba79c55 Switch to non-blocking thread after WebSession creation
See gh-26958
2021-05-24 16:27:56 +01:00
Sam Brannen 746b1b2fe1 Polishing 2021-05-23 18:27:31 +02:00
izeye ab2c78a9d5 Fix broken Javadoc tags
Closes gh-26967
2021-05-23 18:09:34 +02:00
izeye f65cbe0992 Polish PORT_PATTERN in UriComponentsBuilder 2021-05-20 18:20:57 +01:00