Commit Graph

12206 Commits

Author SHA1 Message Date
Stephane Nicoll 6cd85ddde7 Align caching AspectJ configuration
The `CacheResolver` and `ErrorHandler` features introduced in 4.1 were
not properly enabled in AspectJ mode. This commit adds more tests from
the regular proxy-based mode and align the AspectJ caching configuration.

Issue: SPR-14413
2016-06-29 09:21:59 +02:00
Rossen Stoyanchev 775ffbe10b Improve static resource path check 2016-06-28 16:46:51 -04:00
Sam Brannen 1a7c6d3b10 Update @since tags in HandlerMappingIntrospector & Co. 2016-06-28 19:04:03 +02:00
Stephane Nicoll db963bc556 Add BasicAuthorizationInterceptor
This commit adds a `ClientHttpRequestInterceptor` that applies a BASIC
authorization header for each request.

It can be used as follows:

```
BasicAuthorizationInterceptor basicAuthorization =
    new BasicAuthorizationInterceptor("user", "secret");
restTemplate.getInterceptors().add(basicAuthorization);
```

Issue: SPR-14412
2016-06-28 17:29:04 +02:00
Sebastien Deleuze 64628dc8cb Add CorsFilter documentation 2016-06-28 14:51:09 +02:00
Stephane Nicoll 52387cac9a Merge pull request #1092 from nkjackzhang:patch-3
* pr/1092:
  Fix typo in asciidoc
2016-06-28 11:21:16 +02:00
nkjackzhang 5657283071 Fix typo in asciidoc
Closes gh-1092
2016-06-28 11:20:50 +02:00
Rossen Stoyanchev ebdc770ed3 Use appropriate message id header for STOMP 1.1 vs 1.2
Issue: SPR-14391
2016-06-27 16:12:59 -04:00
Rossen Stoyanchev 2cdcf752ba MvcUriComponentsBuilder respects optional params
Issue: SPR-14405
2016-06-27 16:02:54 -04:00
Rossen Stoyanchev e38623df87 Fix MediaType lookup for ResourceHttpRequestHandler
As of 4.3 ResourceHttpRequestHandler delegates to the configured
ContentNegotiationManager, or one created internally, to look up
the media type for are resource.

This commit ensures the internally created ContentNegotiationManager is
correctly injected with the ServletContext through which it can perform
lookups as before.

Also the ServletPathContentNegotiationStrategy now checks the
ServletContext first and then delegates to its parent the
PathContentNegotiationStrategy and not vice versa. This is
consistent with how handleNoMatch (also in the same class) works
and also matches how ResourceHttpRequestHandler worked before 4.3.

Issue: SPR-14368
2016-06-27 14:56:55 -04:00
Rossen Stoyanchev a30ab30e4e Introduce HandlerMapping introspection API
Issue: SPR-14321
2016-06-27 14:23:02 -04:00
Brian Clozel a25c43f695 Enforce UTF-8 response encoding in SseEmitter
This commit sets the response content type to
"text/event-stream;charset=UTF-8". Even if the SSE spec says that the
encoding should always be UTF-8 and that specifying the charset is
optional, we're setting it in all cases, since some containers might use
the default encoding "ISO-8859-1" and confuse HTTP clients.

Issue: SPR-14407
2016-06-27 17:05:31 +02:00
Juergen Hoeller 15c96b8efd ServletResponseHttpHeaders consistently overrides HttpHeaders again
Issue: SPR-14406
2016-06-27 15:33:53 +02:00
Juergen Hoeller ea5baeb05a Upgrade to CGLIB 3.2.4
Issue: SPR-14385
2016-06-26 21:03:05 +02:00
Juergen Hoeller e15f7efff8 InjectionPoint propagated for shortcut bean name resolution as well
Issue: SPR-14400
2016-06-26 00:18:54 +02:00
Juergen Hoeller 4102c62734 Fixed ambiguous sentence in conditional cache documentation
Issue: SPR-14399
2016-06-26 00:13:53 +02:00
Juergen Hoeller 351a729317 Explicit javadoc reference to Hibernate 5.2
Issue: SPR-14393
2016-06-24 12:55:58 +02:00
Juergen Hoeller 711eb99812 HibernateJpaVendorAdapter and LocalSessionFactoryBuilder enforce Hibernate 5.2's connection handling mode DELAYED_ACQUISITION_AND_HOLD
Issue: SPR-14393
2016-06-24 12:37:31 +02:00
Juergen Hoeller 5e08598a2a HibernateJpaDialect accepts equivalent connection for proper reset as well
Issue: SPR-14393
2016-06-23 18:24:09 +02:00
Juergen Hoeller f5282bc1e3 PayloadArgumentResolver's MessageConversionException includes original payload type
Issue: SPR-14394
2016-06-23 17:32:30 +02:00
Brian Clozel 0345d734e6 Improve exception logging in HandlerExceptionResolvers
This commit updates AbstractHandlerExceptionResolver to only log at the
WARN level exceptions that are actually resolved by the
ExceptionResolver.

In case developers wish to log each time an ExceptionResolver is called,
a DEBUG level log is still available.

Issue: SPR-14392
2016-06-23 14:12:37 +02:00
Sam Brannen 3dbf25e018 Implement equals() & hashCode() in MockServerContainerContextCustomizer
Issue: SPR-14367
2016-06-23 13:22:10 +02:00
Sam Brannen f7dd757593 Support WebSocket ServletServerContainerFB in the TCF
Prior to this commit, any attempt to include a bean of type
ServletServerContainerFactoryBean in the WebApplicationContext for an
integration test class annotated with @WebAppConfiguration in
conjunction the Spring TestContext Framework (TCF) would have resulted
in an IllegalStateException stating that "A ServletContext is required
to access the javax.websocket.server.ServerContainer instance."

In such scenarios, the MockServletContext was in fact present in the
WebApplicationContext; however there was no WebSocket ServerContainer
stored in the ServletContext.

This commit addresses this issue by introducing the following.

- MockServerContainer: a private mock implementation of the
  javax.websocket.server.ServerContainer interface.

- MockServerContainerContextCustomizer: a ContextCustomizer that
  instantiates a new MockServerContainer and stores it in the
  ServletContext under the attribute named
  "javax.websocket.server.ServerContainer".

- MockServerContainerContextCustomizerFactory: a
  ContextCustomizerFactory which creates a
  MockServerContainerContextCustomizer if WebSocket support is present
  in the classpath and the test class is annotated with
  @WebAppConfiguration. This factory is registered by default via the
  spring.factories mechanism.

Issue: SPR-14367
2016-06-22 22:10:16 +02:00
Sam Brannen 7f16bdaf74 Polish error messages in ServletServerContainerFactoryBean
Issue: SPR-14367
2016-06-22 19:30:23 +02:00
Juergen Hoeller fd9d518c36 Avoid potential deadlock in AbstractBeanFactoryPointcutAdvisor
Issue: SPR-14388
2016-06-22 14:41:20 +02:00
Juergen Hoeller a2aa82eb31 Polishing 2016-06-22 11:55:33 +02:00
Juergen Hoeller 981d4494c6 AspectJWeavingEnabler registered with well-defined bean name (and therefore once only)
Issue: SPR-14373
2016-06-22 11:55:24 +02:00
Juergen Hoeller 0de85e3a73 Upgrade to Undertow 1.4 CR2
Issue: SPR-14328
2016-06-22 11:15:24 +02:00
Rossen Stoyanchev 058279bc7e HEAD mapping has higher priority over other conditions
When comparing multiple matching @RequestMapping's, the HTTP method
condition has the lowest precedence. It's mainly about ensuring an
explicit mapping wins over an implicit (i.e. no method) one.

As of 4.3 HTTP HEAD is handled automatically for controller methods
that match to GET. However an explicit mapping HTTP HEAD allows an
application to take control.

This commit ensures that for HTTP HEAD requests the HTTP method
condition is checked first which means that an explicit HEAD mapping
now trumps all other conditions.

Normally we look for the most specific matching @RequestMapping.
For HTTP HEAD we now look for the most specific match among
@RequestMapping methods with a HEAD mapping first.

Issue: SPR-14383
2016-06-21 13:32:40 -04:00
Rossen Stoyanchev db1092f119 Polish RequestMappingInfoTests 2016-06-21 10:43:08 -04:00
Juergen Hoeller 848562d68a Upgrade to CGLIB 3.2.3
Issue: SPR-14385
2016-06-21 10:13:42 +02:00
Juergen Hoeller 56db1af11d No tomcat-embed-logging-juli on Tomcat 8.5.3 anymore 2016-06-20 14:24:16 +02:00
Juergen Hoeller 8cb9d5ebae EnableAspectJAutoProxy features exposeProxy flag (analogous to XML namespace)
Issue: SPR-10454
2016-06-20 13:50:04 +02:00
Juergen Hoeller 01f115869b Bootstrap SessionFactory implements InfrastructureProxy interface for resource key unwrapping
Issue: SPR-14379
2016-06-20 13:42:42 +02:00
Juergen Hoeller f9fec73f1d Latest dependency updates (Gson 2.7, Jackson 2.8 RC2, Tomcat 8.5.3, Caffeine 2.3.1) 2016-06-20 13:41:04 +02:00
Rossen Stoyanchev ba885f3d0b Add heartbeat lock to SockJS server sessions
Even before this change SockJS sessions always cancelled the heartbeat
task first prior to sending messages. However when the heartbeat task
is already in progress, cancellation of it is not enough and we must
wait until the heartbeat is sent.

This commit adds a heartbeat write lock which is obtained and held
during the sending of a heartbeat. Now when sessions send a message
they still cancel the heartbeat task but if that fails they also wait
for the heartbeat write lock.

Issue: SPR-14356
2016-06-17 16:54:54 -04:00
Rossen Stoyanchev 919f6c96f9 ForwardedHeaderFilter is case-insensitive
Issue: SPR-14372
2016-06-17 14:20:42 -04:00
nkjackzhang 981a748dcc Fix ambiguous static import in TestPropertySourceUtilsTests 2016-06-17 17:18:36 +02:00
Stephane Nicoll 6f9fb31bf9 Merge pull request #1082 from nkjackzhang:patch-2
* pr/1082:
  Move <a> out of @code
2016-06-17 08:08:02 +02:00
nkjackzhang c145ceebf3 Move <a> out of @code
Closes gh-1082
2016-06-17 08:06:21 +02:00
Stephane Nicoll bcfc09a93c Document sync attribute of Cacheable
Closes gh-14366
2016-06-16 13:14:53 +02:00
Stephane Nicoll b92576d8d9 Merge pull request #1080 from nkjackzhang:patch-2
* pr/1080:
  Polish contribution
  Fix typo in javadoc
2016-06-16 12:13:01 +02:00
Stephane Nicoll d41178c75a Polish contribution
Closes gh-1080
2016-06-16 12:12:42 +02:00
nkjackzhang 9656015d26 Fix typo in javadoc
See gh-1080
2016-06-16 12:11:14 +02:00
Juergen Hoeller 7d39957ec9 SessionFactoryUtils defensively accesses getProperties method via reflection
Issue: SPR-14365
2016-06-15 16:48:34 +02:00
Sam Brannen 9001af7efb Revert build to Gradle 2.13
Issue: SPR-14362
2016-06-15 13:00:40 +02:00
Juergen Hoeller b5364d5f1a SpringSessionSynchronization uses SessionFactoryUtils.getFlushMode for Hibernate 5.1/5.2 adaptation
Issue: SPR-14364
2016-06-14 22:55:31 +02:00
Juergen Hoeller dcb2c73102 MultipartResolutionDelegate skips Part parameter checks on Servlet 2.5
Issue: SPR-14358
2016-06-14 22:48:51 +02:00
Sam Brannen 045ee52232 Invoke target.toString() safely in ReflectionTestUtils
ReflectionTestUtils invokes toString() on target objects in order to
build exception and logging messages, and prior to this commit problems
could occur if the invocation of toString() threw an exception.

This commit addresses this issue by ensuring that all invocations of
toString() on target objects within ReflectionTestUtils are performed
safely within try-catch blocks.

Issue: SPR-14363
2016-06-14 20:08:26 +02:00
Sam Brannen 2fd4462268 Upgrade build to Gradle 2.14
In the process of upgrading the build to use Gradle 2.14, the
setFieldOnLegacyEntityWithSideEffectsInToString() test method in
ReflectionTestUtilsTests began to fail. The reason is that the log
level for ReflectionTestUtils is now DEBUG by default with Gradle 2.14.
The apparent cause is that log4j was present on the test runtime
classpath for the spring-test module with all previous versions of
Gradle (via a transitive optional dependency from another project that
spring-test depends on). Thus the configuration in log4j.properties in
spring-test was previously honored, but with Gradle 2.14 a different
commons logging implementation is picked up.

Thus, in addition to upgrading the build to Gradle 2.14, this commit
introduces an explicit test runtime dependency on log4j in the
spring-test module.

The discovered bug in ReflectionTestUtils regarding DEBUG log level
will be addressed separately.

Issue: SPR-14362
2016-06-14 18:40:01 +02:00