Commit Graph

11891 Commits

Author SHA1 Message Date
Rossen Stoyanchev e98738d8ba Polish UriTemplateHandler related classes 2016-03-03 13:33:45 -05:00
Brian Clozel 44c32128dc Add newline at the beginning of textarea JSP tags
This commit adds a newline char at the beginning of textarea tags
values. As per the HTML 4.01 spec (and browsers behavior), a line break
following a start tag is ignored.

This can lead to Spring's textarea tag to ignore a line break char at
the beginning of a tag value.

See https://www.w3.org/TR/html401/appendix/notes.html#notes-line-breaks

Issue: SPR-13503
2016-03-03 16:48:17 +01:00
Rossen Stoyanchev 36e2dd90a7 Support contextPath override in ForwardedHeaderFilter
Issue: SPR-13614
2016-03-02 18:38:25 -05:00
Rossen Stoyanchev 6fcc869338 Polish ForwardedHeaderFilter
Issue: SPR-13614
2016-03-02 18:38:25 -05:00
Sam Brannen 067994712d Make TestContextManager.getTestContext() public
This commit changes the visibility of the getTestContext() method in
TestContextManager from 'protected' to 'public' in order to support
test method injection in JUnit 5 and similar use cases.

Issue: SPR-14011
2016-03-02 20:19:25 +01:00
Brian Clozel 50bcd67fb6 Relax SPR-13867 changes for ResourceHttpRequestHandler
Prior to this change, SPR-13867 made sure that any class extending
WebContentGenerator would not overwrite existing HTTP "Cache-Control"
response headers - set by a filter, a Controller handler, etc.

This caused issues with resource handling, since specifying a cache
configuration there would not overwrite default headers set by filters,
for example by Spring Security.

This commit restricts the previous changes to the
RequestMappingHandlerAdapter, in order to avoid overwriting header set
by a filter or a Controller handler in those cases.

Issue: SPR-14005
2016-03-02 17:42:44 +01:00
Sam Brannen 18e9699a2b Demo @ContextConfiguration as composed annotation with ACI
This commit demonstrates how to register one or more @Configuration
classes via an ApplicationContextInitializer in a composed annotation so
that certain @Configuration classes are always registered whenever the
composed annotation is used, even if the composed annotation is used to
declare additional @Configuration classes.
2016-03-02 14:07:15 +01:00
Rossen Stoyanchev 4cf0b59e00 Add ForwardedHeaderFilter
The new Filter is simply a new way of packaging the ability to extract
X-Forwarded-* headers already available via UriComponentsBuilder.

The Filter wraps the request and the effect is that anything using the
request will see the original schem, host, and port.

Issue: SPR-13614
2016-03-01 23:33:36 -05:00
Sebastien Deleuze 7b861c9a8a Add defaultUseWrapper support to Jackson builder
Issue: SPR-13975
2016-03-02 00:03:25 +01:00
Phillip Webb ffbf264976 Polish Javadoc 2016-03-01 13:34:25 -08:00
Stephane Nicoll b3b3fc5a7e Polish 2016-03-01 19:10:39 +01:00
Brian Clozel 3df66d023c Polish documentation on WebApplicationInitializer
Issue: SPR-13978
2016-03-01 17:38:52 +01:00
Brian Clozel 0d6f80052d Support conditional updates in ServletWebRequest
Prior to this commit, `ServletWebRequest.checkNotModified` would only
support conditional GET/HEAD requests with "If-Modified-Since" and/or
"If-None-Match" request headers. In those cases, the server would return
"HTTP 304 Not Modified" responses if the resource didn't change.

This commit adds support for conditional update requests, such as
POST/PUT/DELETE requests with "If-Unmodified-Since" request headers.
If the underlying resource has been modified since the specified date,
the server will return a "409 Precondition failed" response status
to prevent concurrent updates.

Even if the modification status of the resource is reversed here
(modified vs. not modified), we're keeping here the same intent for the
return value, which signals if the response requires more processing or
if the handler method can return immediately:

```
if (request.checkNotModified(lastModified)) {
  // shortcut exit - no further processing necessary
  return null;
}
```

Issue: SPR-13863
2016-03-01 14:37:29 +01:00
Sebastien Deleuze b3abd3b809 Fix HeaderResultMatchers#string(String, String) assert order
Issue: SPR-14004
2016-03-01 14:18:29 +01:00
Sebastien Deleuze c385427397 Allow to specify AbstractHttpMessageConverter default charset
Before this commit, specifying the charset to use with produces or
consumes @RequestMapping attributes resulted in default charset
loss. That was really annoying for JSON for example, where using
UTF-8 charset is mandatory in a lot of use cases.

This commit adds a defaultCharset property to
AbstractHttpMessageConverter in order to avoid losing the
default charset when specifying the charset with these
@RequestMapping attributes.

It changes slightly the default behavior (that's why we have waited
4.3), but it is much more error prone, and will match with most
user's expectations since the charset loss was accidental in most
use cases (users usually just want to limit the media type supported
by a specific handler method).

Issue: SPR-13631
2016-02-29 23:34:32 +01:00
Sam Brannen 61824b1ade Remove trailing whitespace from source code 2016-02-29 18:52:57 +01:00
Sam Brannen 2bb2657483 Merge pull request #981 from sbrannen/SPR-13992
* SPR-13992:
  Introduce composed annotations for @RequestMapping
2016-02-29 18:25:57 +01:00
Sam Brannen 467b5f3f28 Introduce composed annotations for @RequestMapping
This commit introduces the following common composed annotations for
@RequestMapping in Spring MVC and Spring MVC REST.

- @GetMapping
- @PostMapping
- @PutMapping
- @DeleteMapping
- @PatchMapping

Issue: SPR-13992
2016-02-29 18:22:30 +01:00
Stephane Nicoll 5923ee8af3 Add sun.misc annotation marker
This commit adds an annotation that should be used to mark any usage of
the `sun.misc` API.
2016-02-29 17:43:04 +01:00
Sam Brannen 161ec15a46 Merge pull request #982 from sbrannen/SPR-13993
* SPR-13993:
  Introduce composed annotations for web scopes
2016-02-29 17:41:43 +01:00
Sam Brannen b423596b2e Introduce composed annotations for web scopes
This commit introduces the following common composed annotations for
web scopes.

- @RequestScope
- @SessionScope
- @ApplicationScope

Issue: SPR-13993
2016-02-29 17:38:46 +01:00
Sam Brannen df7b24b8e7 Allow non-public @Transactional test methods
Prior to this commit, the TransactionalTestExecutionListener required
@Transactional test methods to be public; however, neither TestNG nor
JUnit 5 require that @Test methods are public. Consequently, non-public
transactional test methods silently run *without* a transaction.

This commit removes the 'public' restriction on transactional test
methods by setting the 'publicMethodsOnly' flag in
AnnotationTransactionAttributeSource to false.

Issue: SPR-14000
2016-02-29 15:30:22 +01:00
Sam Brannen 197434b3ec Polish TestNG integration tests 2016-02-29 15:30:22 +01:00
Sam Brannen 816185233d Polish TransactionalTestExecutionListener 2016-02-29 15:30:22 +01:00
Juergen Hoeller a02fd7c995 RequestMappingHandlerAdapter properly invokes handler method in case of no session as well
Issue: SPR-13999
2016-02-29 15:05:50 +01:00
Juergen Hoeller 9c0f99c0b5 Polishing 2016-02-29 12:57:09 +01:00
Juergen Hoeller 8e5e384de7 Test for constructor with unresolvable parameter name
Issue: SPR-13987
2016-02-29 11:18:23 +01:00
Juergen Hoeller 1815a6a7eb RequestMappingHandlerAdapter properly invokes handler method in synchronizeOnSession mode again
Issue: SPR-13999
2016-02-29 11:12:11 +01:00
Sam Brannen a2bfe86630 Support @[Before|After]Transaction on non-public methods
In order to align with the relaxed programming models of TestNG and the
upcoming JUnit 5 (with regard to method visibility), this commit
removes the requirement that @BeforeTransaction and @AfterTransaction
methods must be 'public'.

Issue: SPR-13997
2016-02-29 00:42:47 +01:00
Sam Brannen 31e0386bcb Stop referencing deprecated @TransactionConfiguration in Javadoc 2016-02-27 23:50:00 +01:00
Sam Brannen 9d3dd1bc13 Introduce SpringRunner 'alias' for SpringJUnit4ClassRunner
This commit introduces a SpringRunner extension of
SpringJUnit4ClassRunner that is intended to be used as an 'alias' for
SpringJUnit4ClassRunner, primarily in order to simplify configuration
of JUnit 4 based integration tests.

Developers can use this alias as follows:

    @RunWith(SpringRunner.class)
    public class MySpringIntegrationTests { ... }

Issue: SPR-13954
2016-02-27 23:02:55 +01:00
Sam Brannen 0c66838268 Polish Javadoc for @RequestMapping 2016-02-26 22:35:51 +01:00
Sam Brannen 6fcb6630d7 Clean up warnings in SampleAsyncTests 2016-02-26 22:35:51 +01:00
Juergen Hoeller ab16053ed4 Redistribute AOP Alliance interfaces in spring-aop again (as in Spring 2.x)
Issue: SPR-13984
2016-02-26 12:40:00 +01:00
Juergen Hoeller 8a83af55b8 Consistent resolution of factory method exceptions
Issue: SPR-13985
2016-02-26 12:31:03 +01:00
Juergen Hoeller 7a32ce317c LinkedCaseInsensitiveMap provides reliable getOrDefault implementation
Issue: SPR-13981
2016-02-25 21:42:11 +01:00
Juergen Hoeller b6dd8a9233 Consistent UnsatisfiedDependencyException exposure with injection point metadata
Issue: SPR-13968
2016-02-25 21:36:49 +01:00
Juergen Hoeller 4c964473b1 Defensively close jar files from non-cached JarURLConnections
Issue: SPR-6295
2016-02-25 10:25:13 +01:00
Rossen Stoyanchev 1bc1df2d0f Polish client-side REST updates
Issue: SPR-11365
2016-02-24 15:24:13 -05:00
Juergen Hoeller ca19920d74 Refined ApplicationContextInitializer assignability exception 2016-02-24 17:50:14 +01:00
Juergen Hoeller a68b910b7c TimerScheduledFuture correctly calculates getDelay result
Issue: SPR-13977
2016-02-24 17:11:36 +01:00
Rossen Stoyanchev 46189b48fc Merge client REST test support updates
Includes support to declare expecations should occur multiple
times as well as in any order.

Issue: SPR-11365
2016-02-23 23:33:59 -05:00
Rossen Stoyanchev 91872b0d74 Add ExpectedCount
MockRestServicesServer now supports an expect variant that accepts
a range of expected count of executions.

Issue: SPR-11365
2016-02-23 23:31:34 -05:00
Rossen Stoyanchev 08a08725be Allow plugging in custom RequestExpectationManager
The MockRestServiceServer builder now has an option to plug in a
custom RequestExpectationManager.

Issue: SPR-11365
2016-02-23 23:31:33 -05:00
Rossen Stoyanchev a56c69c9ca Introduce MockRestServiceServer builder
MockRestServiceServer now provides static methods for builder-style
creation of MockRestServiceServer. This includes an option ignore
the order of declaration expected requests.

Issue: SPR-11365
2016-02-23 23:31:33 -05:00
Rossen Stoyanchev f58ef24efd Introduce RequestExpectationManager
This commit factors out the logic to declare and manage expectations
including matching them to requests and verifying at the end behind
a commong abstraction.

MockRestServiceServer delegates to the new abstraction and is no longer
aware of how that's done. There are two implementations, one for
ordered and another for unordered expectation.

Issue: SPR-11365
2016-02-23 23:31:33 -05:00
Rossen Stoyanchev 37a3fa96d1 Separate ResponseActions from ClientHttpRequest
Before this commit RequestMatcherClientHttpRequest served both as
API to define request expectations, i.e. ResponseActions, as well as
the implementation of ClientHttpRequest representing actual requests.

DefaultResponseActions replaces this class as a simple holder of
expected requests and mock responses. MockRestServiceServer is then
responsible to match request expectations and create a mock response.

Issue: SPR-11365
2016-02-23 23:31:33 -05:00
Sebastien Deleuze 3329abffc8 Allow to specify request body type in RestTemplate
This commit allows to specify the request body type in order to
serialize generic types with a GenericHttpMessageConverter if
needed.

Issue: SPR-13154
2016-02-23 16:15:38 +01:00
Juergen Hoeller 7b1fcfc7c3 Consistently strict parsing of date overflows (using java.time's strict resolution style)
Issue: SPR-13567
2016-02-23 16:12:26 +01:00
Juergen Hoeller 028a690100 Polishing 2016-02-23 14:31:09 +01:00