Commit Graph

6876 Commits

Author SHA1 Message Date
Andy Wilkinson e24b71e700 Shutdown Reactor env when relay handler is stopped
The Reactor Environment (that's used by the TcpClient) manages a
number of threads. To ensure that these threads are cleaned up
Environment.shutdown() must be called when the Environment is no
longer needed.
2013-06-28 11:49:28 +01:00
Rossen Stoyanchev d650e909b2 Merge branch 'master' into websocket-stomp 2013-06-27 15:58:12 -04:00
Rossen Stoyanchev 9bdc825ded Add PayloadReturnValueHandler 2013-06-27 15:47:46 -04:00
Phillip Webb 60532cbd1e Polish spring-websocket code
Minor polish to formatting and assertion messages.
2013-06-27 09:58:58 -07:00
Rossen Stoyanchev e7d9c26a7c Make STOMP message broker host and port configurable 2013-06-27 12:43:56 -04:00
Phillip Webb 2d018e5019 Polish @RequestMapping Javadoc
Issue: SPR-10587
2013-06-26 11:15:54 -07:00
Phillip Webb 38c2f253ed 'Rename' HttpHeaders.getIfNotModifiedSince()
Effectively rename HttpHeaders.getIfNotModifiedSince() to
getIfModifiedSince() by adding a new method and deprecating the
old one.

Issue: SPR-10600
2013-06-26 10:44:35 -07:00
Rossen Stoyanchev ee9c46ad2e Remove PubSubChannelRegistry 2013-06-26 11:09:37 -04:00
Phillip Webb 6a3a361376 Include specific SQL statements in batch exception
Refine the SQL statements contained in exceptions thrown from batch
updates based on BatchUpdateException.getUpdateCounts().

Issue: SPR-10677
2013-06-25 23:14:49 -07:00
Phillip Webb 5ee6bb9b9b Fix SQL syntax error in jdbcTemplate update docs
Update the reference guide jdbcTemplate update example to include the
column name.

Issue: SPR-10625
2013-06-25 22:20:41 -07:00
Phillip Webb 2abec6fd90 Include all SQL statements in batch fail exception
Ensure any exception from calls to batchUpdate, on databases that
support batch operations, contains all the SQL statements. Prior to this
commit only the last SQL statement would be returned with the exception.

Issue: SPR-10677
2013-06-25 14:50:24 -07:00
Rossen Stoyanchev 486b4101ec Introduce MessageHeader accessor types
A new type MessageHeaderAccesssor provides read/write access to
MessageHeaders along with typed getter/setter methods along the lines
of the existing MessageBuilder methods (internally MessageBuilder
merely delegates to MessageHeaderAccessor). This class is extensible
with sub-classes expected to provide typed getter/setter methods for
specific categories of message headers.

NativeMessageHeaderAccessor is one specific sub-class that further
provides read/write access to headers from some external message
source (e.g. STOMP headers). Native headers are stored in a separate
MultiValueMap and kept under a specific key.
2013-06-25 16:31:52 -04:00
Phillip Webb 84249740b8 Merge pull request #305 from beamerblvd/SPR-10644
# By Nick Williams
* SPR-10644:
  Improving method validation support for BV 1.1
2013-06-24 13:22:35 -07:00
Nick Williams 7b2c74b05c Improving method validation support for BV 1.1
Update MethodValidationPostProcessor.setValidator(...) to use
LocalValidatorFactoryBean.getValidator() when possible.

This is required because LocalValidatorFactoryBean does not directly
implement the forExecutables() method introduced in bean validation v1.1.

Issue: SPR-10644
2013-06-24 13:21:03 -07:00
Phillip Webb f9b12b8362 Include argument types in MethodReference cache
Update the cached MethodExecutor in MethodReference to include the
method argument types. Prevents the incorrect use of the cache when the
SpEL expression refers to a class that has overloaded methods.

Issue: SPR-10657
2013-06-24 12:28:59 -07:00
Phillip Webb e83bdda7d5 Polish SpEL code 2013-06-24 11:22:19 -07:00
Rossen Stoyanchev ac23832e4d Fix issue in MessageReturnValueHandler 2013-06-24 11:47:59 -04:00
Rossen Stoyanchev 32cb2ca2e7 Remove generic params from Message/MessageChannel 2013-06-24 11:14:48 -04:00
Rossen Stoyanchev f7f66f2e5c Fix minor issue in ReactorMessageChannel 2013-06-24 09:59:27 -04:00
Phillip Webb 4830ea6065 Package RmiInvocationWrapperRTD.xml in jar
Ensure RmiInvocationWrapperRTD.xml is packaged inside spring-context.jar

Issue: SPR-10649
2013-06-23 23:49:05 -07:00
Phillip Webb eea230f2a8 Allow @CachePut 'key' SpEL to refer to #result
Allow the @CachePut 'key' SpEL to refer to the result of the method call
via a '#result' variable.

This change is particularly useful when working with JPA entities that
have generated @Id values since the ID will often not be available
until the entity has been saved.

Issue: SPR-10664
2013-06-23 09:07:16 -07:00
Phillip Webb f75d4e13a2 Polish cache abstraction code
Polish cache abstraction code and refactor CacheAspectSupport.
2013-06-23 09:07:16 -07:00
Sam Brannen b122ca688b Add missing @since tag to SimpleKey 2013-06-22 23:57:17 +02:00
Phillip Webb f1a18d29ba SimpleKeyGenerator to replace DefaultKeyGenerator
Introduce new SimpleKeyGenerator class to supersede DefaultKeyGenerator.
Unlike DefaultKeyGenerator, no collisions will occur with the keys
generated by SimpleKeyGenerator as the full parameter values are
considered within the SimpleKey.equals(...) method.

The SimpleKeyGenerator is now the default class used when no explicit
generator is configured.

Issue: SPR-10237
2013-06-21 12:21:29 -07:00
Phillip Webb c720d82596 Use 'Integer' not 'int' in queryForObject docs
Update queryForObject calls in the JDBC reference documentation to
use 'Integer.class' rather than the unsupported 'int.class'.

Issue: SPR-10651
2013-06-20 23:51:52 -07:00
Phillip Webb 8ed8ee2dfe Skip abstract beans in getBeansWithAnnotation()
Update BeanFactory.getBeansWithAnnotation() to skip any abstract
bean definitions.

Issue: SPR-10663
2013-06-20 22:48:30 -07:00
Phillip Webb a403e8f8b8 Inject @Configuration BeanFactory before autowire
Add EnhancedConfigurationBeanPostProcessor to inject the BeanFactory
into EnhancedConfiguration classes before the
AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues method
is called.

Prior to this commit it was possible for @Autowire in a @Configuration
class to invoke an enhanced configuration class method before the
BeanFactory was injected. This is due to the fact that the
AutowiredAnnotationBeanPostProcessor was called before
AbstractAutowireCapableBeanFactory.invokeAwareMethods().

Issue: SPR-10668
2013-06-20 20:21:18 -07:00
Rossen Stoyanchev 62e23363cb Fix getters to match setters in RMHA
Issue: SPR-10519
2013-06-20 20:57:24 -04:00
Rossen Stoyanchev c6ecaacc03 Add getResult/hasResult methods to DeferredResult
Issue: SPR-10603
2013-06-20 20:57:24 -04:00
Rossen Stoyanchev 9bc4663ead Add accept(String) method to mock request builder
Issue: SPR-10390
2013-06-20 20:57:24 -04:00
Rossen Stoyanchev 4b22558a06 Add HTTP method to RequestDataValueProcessor method
Issue: SPR-10041, SPR-10652
2013-06-20 20:57:24 -04:00
Phillip Webb 26fb880622 Add mvc: prefix to mapping samples in ref docs
Add 'mvc:' namespace prefix to 'mapping' and 'exclude-mapping' elements
in the reference documentation.

Issue: SPR-10670
2013-06-20 16:17:00 -07:00
Rossen Stoyanchev 2d8315fba0 Reverse SPR-10402 change that caused 3.2.3 regression
SPR-10402 in Spring Framework 3.2.3 treated empty request parameter
values as missing values, if the empty value was turned into a null
by a PropertyEditor or Converter. This caused the regression.

Issue: SPR-10578, SPR-10402, SPR-10584
2013-06-20 16:20:01 -04:00
Rossen Stoyanchev 55a212d4a0 Add @MessageExceptionHandler
Similar to @ExceptionHandler but for message processing. Such a method
can send messages to both the message broker channel and the client
channel provided the client is subscribed to the target destination.
2013-06-19 22:17:59 -04:00
Rossen Stoyanchev 01c4e458c7 Add support for "system" STOMP session
The "system" STOMP session is established at startup and can be used
to send messages without a client session, e.g. to support broadcasting
from a REST/HTTP handler method.
2013-06-19 18:54:51 -04:00
Rossen Stoyanchev 44db0f815a Add MessageHolder
MessageHolder holds the currently processed message in a ThreadLocal,
which allows PubSubMessageBuilder to automatically add a session id
to messages to be sent.
2013-06-19 15:30:23 -04:00
Rossen Stoyanchev 5cfc59d76d Refactor PubSubHeaders, StompHeaders, MessageBuilder
Rename to PubSubHeaderAccessor and StompHeaderAccessor
Move the renamed classes to support packages

Remove fromPayloadAndHeaders from MessageBuilder, just use
withPayload(..).copyHeaders(..) instead.
2013-06-19 11:41:43 -04:00
Rossen Stoyanchev 5feac07738 Add getLastHandler to WebSocketHandlerDecorator 2013-06-19 09:46:21 -04:00
Rossen Stoyanchev 811bb1b0c9 Improve synchronization checks in STOMP relay session 2013-06-19 08:28:58 -04:00
Andy Wilkinson 28174744a7 Fix race when flushing messages
The use of an AtomicBoolean and no lock meant that it was possible
for a message to be queued and then never be flushed and sent to the
broker:

1. On t1, a message is received and isConnected is false. The message
   will be queued.
2. On t2, CONNECTED is received from the broker. isConnected is set
   to true, the queue is drained and the queued messages are forwarded
3. On t1, the message is added to the queue

To fix this, checking that isConnected is false (step 1 above) and the
queueing of a message (step 3 above) need to be performed as a unit
so that the flushing of the queued messages can't be interleaved. This
is achieved by synchronizing on a monitor and performing steps 1
and 3 and synchronizing on the same monitor while performing step 2.

The monitor is held while the messages are actually being forwarded
to the broker. An alternative would be to drain the queue into
a local variable, release the monitor, and then forward the messages.
The main advantage of this alternative is that the monitor is held for
less time. It also reduces the theoretical risk of deadlock by not
holding the monitor while making an alien call. The downside of the
alternative is that it may lead to messages being forwarded out of
order. For this reason the alternative approach was rejected.
2013-06-19 11:02:10 +01:00
Rossen Stoyanchev d20dabf1fb Fix issue with obtaining WebSocketContainer 2013-06-18 20:57:33 -04:00
Rossen Stoyanchev 3c6c56fe0d Fix issue with obtaining WebSocketContainer 2013-06-18 20:55:22 -04:00
Rossen Stoyanchev 3f9da6f480 Add generic parameters to MessageHandler impls 2013-06-18 20:35:15 -04:00
Andy Wilkinson f6398e14d0 Received message's destination is default for resp
When an annotated handler returns a Message from a @SubscribeEvent
or @MessageMapping method and it contains no destination in its
headers, use the received message's destination as the response
message's destination.
2013-06-17 21:04:23 -04:00
Andy Wilkinson 7bb3b824c3 Genericize PubSubChannelRegistry
Without generics, extending AbstractPubSubChannelRegistry and using
a custom Message type requires some unpleasant casting and suppression
of warnings. By genericizing PubSubChannelRegistry and
AbstractPubSubChannelRegistry these problems can be avoided.
2013-06-17 21:03:24 -04:00
Rossen Stoyanchev 426875b4f6 Refactor StompRelayPubSubMessageHandler 2013-06-17 16:29:31 -04:00
Sam Brannen d5a5a4894f Add header name to ex. msg in HeaderResultMatchers
Prior to this commit, the longValue() in HeaderResultMatchers added the
expected response header name to generated assertion failure messages;
however, both string() methods did not. This made it more difficult to
analyze the cause of failed tests.

Furthermore, while investigating a solution for this issue it became
apparent that longValue() throws a NullPointerException if the response
does not contain the specified header.

This commit addresses these issues as follows:

 - All methods in HeaderResultMatchers now include the response header
   name in generated assertion failure messages.

 - HeaderResultMatchers.longValue() now avoids NullPointerExceptions by
   explicitly asserting that the response contains the specified header.

 - The unit tests in HeaderAssertionTests have been expanded to test
   most foreseeable use cases.

Issue: SPR-10659
2013-06-17 17:59:24 +02:00
Rossen Stoyanchev 3dabe21563 Remove PubSubChannelRegistryBuilder 2013-06-17 10:22:58 -04:00
Sam Brannen 8ad36ef812 Delete remaining JUnit 3.8 tests in spring-test
This commit deletes the remaining JUnit 3.8 tests in the spring-test
module that were still subclassing deprecated class hierarchies.

Issue: SPR-10499
2013-06-16 20:03:21 +02:00
Sam Brannen d25611dd40 Move MockMultHtServReqTests to correct package
This commit relocates MockMultipartHttpServletRequestTests to the
appropriate package.
2013-06-16 19:55:35 +02:00