Commit Graph

7666 Commits

Author SHA1 Message Date
Phillip Webb 823dbdf232 Merge pull request #379 from Xaerxess/fix-doc-cache
* fix-doc-cache:
  Fix Cache documentation
2013-10-11 09:29:59 -07:00
Grzegorz Rożniecki 03daf593b2 Fix Cache documentation
Fixed malformed code snippets, formatted whitespace and changed invalid
external link.
2013-10-11 09:27:49 -07:00
Rossen Stoyanchev 7d3b6497b5 Add support for MIME-based message conversion
The MessageConverter interface in spring-messaging is now explicitly
designed to support conversion of the payload of a Message<?> to and
from serialized form based on MIME type message header.
By default, the MessageHeaders.CONTENT_HEADER header is used but a
custom ContentTypeResolver can be configured to customize that.

Currently available are Jackson 2, String, and byte array converters.
A CompositeMessageConverter can be used to configure several
message converters in various places such as a messaging template.
2013-10-10 17:25:18 -04:00
Phillip Webb ee8f1aa61a Clarify ResolvableType.resolve() Java Doc
Issue: SPR-10973
2013-10-10 11:58:21 -07:00
Phillip Webb 5358cc0f5f Fix ResolvableType isAssignableFrom for <?>
Fix ResolvableType.isAssignableFrom to correctly deal with <?> style
generics.

Issue: SPR-10973
2013-10-10 09:22:22 -07:00
Phillip Webb 501a1cbb5d Refactor from deprecated GenericTypeResolver calls
Refactor AbstractMessageConverterMethodArgumentResolver and
BridgeMethodResolver to use ResolvableType in preference to deprecated
GenericTypeResolver calls.

Issue: SPR-10980
2013-10-10 00:19:51 -07:00
Phillip Webb fdf0ef40c0 Use ResolvableType in GenericCollectnTypeResolver
Refactor GenericCollectionTypeResolver to make use of ResolvableType
for generic resolution.

Issue: SPR-10977
2013-10-10 00:19:51 -07:00
Phillip Webb 595efe9aab Use ResolvableType in GenericTypeResolver
Refactor GenericTypeResolver to make use of ResolvableType
for generic resolution.

Issue: SPR-10978
2013-10-10 00:19:51 -07:00
Phillip Webb 6a18b0048d Introduce ResolvableType Class
Add a new ResolvableType Class which encapsulates java.lang.reflect.Type,
providing access to supertypes, interfaces and generic parameters along
with the ability to ultimately resolve to a java.lang.Class.

ResolvableTypes may be obtained from fields, method parameters, method
returns, classes or directly from a java.lang.reflect.Type. Most methods
will themselves return ResolvableTypes, allowing easy navigation.

For example:

	private HashMap<Integer, List<String>> myMap;

	public void example() {
 		ResolvableType t = ResolvableType.forField(
 					getClass().getDeclaredField("myMap"));
 		t.getSuperType(); // AbstractMap<Integer, List<String>>;
 		t.asMap(); // Map<Integer, List<String>>
 		t.getGeneric(0).resolve(); // Integer
 		t.getGeneric(1).resolve(); // List
 		t.getGeneric(1); // List<String>
 		t.resolveGeneric(1, 0); // String
 	}

Issue: SPR-10973
2013-10-10 00:19:50 -07:00
Rossen Stoyanchev 449d91a06c Merge pull request #379 from bclozel/SPR-10789 2013-10-08 15:59:22 -04:00
Rossen Stoyanchev c9bb0594f3 Polish
Issue: SPR-10789
2013-10-08 15:57:59 -04:00
Brian Clozel e04a756968 Support AntPathMatch URLs in URL ResultMatchers
Prior to this commit, one could only match exact URLs in redirectedUrl
and forwardedUrl ResultMatchers. When creating a resource with
a REST service, URLs often contain the id the new resource,
like "/resource/12".

This commit updates those ResultMatchers to support both
exact matches and AntPath matches, using new methods.
The former URL then can be tested against "/resource/*" in MVC tests.

Issue: SPR-10789
2013-10-08 10:54:15 +02:00
Rossen Stoyanchev 4ca7d89a92 Revert resource handling changes
This change reverts recent commits made to expand the resource handling
mechanism in Spring MVC. The changes will move into a separate branch
and likely into a separate project allowing it to mature and evolve
without being tied to the main framework release schedule.

Issue: SPR-10933, SPR-10310
2013-10-07 21:29:48 -04:00
Rossen Stoyanchev 6a323292d8 Revert "Add initial cut of expanded resource handling"
This reverts commit d4a0e628d5, reversing
changes made to 8abe949734.
2013-10-07 21:18:41 -04:00
Rossen Stoyanchev 80e5513918 Revert "Remove unintended changes from last commit"
This reverts commit 1ba806b185.
2013-10-07 21:14:07 -04:00
Rossen Stoyanchev 2670d94c6a Revert "Update Spring MVC Java config for ResourceResolvers"
This reverts commit f8e1f06d08.
2013-10-07 21:13:22 -04:00
Rossen Stoyanchev 5c62c86fc9 Revert "Fix failing test"
This reverts commit c01f45fa59.
2013-10-07 21:10:05 -04:00
Brian Clozel 4bf5a0234c Add doesNotExist match to HeaderResultMatchers
Prior to this commit, one could not test for the absence of
a specific HTTP header in a response.
Using header("X-Custom-Header", Matchers.nullValue()) would not
work because it tests for an empty value of an existing header.

This commit adds a doesNotExist method on the
HeaderResultMatcher.

Issue: SPR-10771
2013-10-07 14:50:17 -04:00
Brian Clozel e4479c8669 Fix MockHttpServletResponse HTTP status update
Prior to this commit, one could call the setStatus method on
this Mock object and update the response's status,
even though the sendError method had already been called.

According to the HttpServletResponse Javadoc, sendError() methods
commit the response; so the response can't be written after that.

This commit fixes MockHttpServletResponse's behavior; setStatus
methods do not update the status once the response has been
committed.

Issue: SPR-10414
2013-10-07 14:43:06 -04:00
Rossen Stoyanchev 824cb9f8cd Polish MessageBuilder 2013-10-07 09:27:04 -04:00
Juergen Hoeller 4574528a27 Comprehensive update to the framework's TimeZone handling, including a new TimeZoneAwareLocaleContext and a LocaleContextResolver for Spring MVC
A few noteworthy minor changes: LocaleContext.getLocale() may return null in special cases (not by default), which our own accessing classes are able to handle now. If there is a non-null TimeZone user setting, we're exposing it to all collaborating libraries, in particular to JSTL, Velocity and JasperReports. Our JSR-310 and Joda-Time support falls back to checking the general LocaleContext TimeZone now, adapting it to their time zone types, if no more specific setting has been provided. Our DefaultConversionService has TimeZone<->ZoneId converters registered. And finally, we're using a custom parseTimeZoneString method now that doesn't accept the TimeZone.getTimeZone(String) GMT fallback for an invalid time zone id anymore.

Issue: SPR-1528
2013-10-04 23:14:08 +02:00
Juergen Hoeller 52cca48f40 Polishing 2013-10-04 22:53:49 +02:00
Juergen Hoeller 8b3afda6f4 Marked Jackson 1.x support classes as deprecated 2013-10-04 22:52:47 +02:00
Juergen Hoeller bd4c64af04 Turned ByteBufferConverter's visibility to package level 2013-10-04 22:52:14 +02:00
Juergen Hoeller 3fad0fa432 Introduced TomcatLoadTimeWeaver for Tomcat's new InstrumentableClassLoader interface
At the same time, dropped GlassFish 1/2 support from GlassFishLoadTimeWeaver and redesigned it to be as analogous to TomcatLoadTimeWeaver as possible.

Issue: SPR-10788
2013-10-03 14:51:27 +02:00
Juergen Hoeller 888e3c7e53 Polishing 2013-10-03 14:51:26 +02:00
Rossen Stoyanchev 52d663e596 Make method in RequestMappingHandlerMapping protected
Issue: SPR-10950
2013-10-02 17:47:31 -04:00
Brian Clozel a5e3916724 Add Jackson's Modules registration in Jackson2OMFactoryBean
Prior to this commit, one couldn't configure Jackson's ObjectMapper
with (De)SerializerModifiers or advanced configuration features
using XML configuration.

This commit updates the FactoryBean and adds a setModule method
that will register Modules with the ObjectMapper.

Note that this commit is only about XML configuration, since
this feature was already available with JavaConfig.

Issue: SPR-10429
2013-10-02 17:23:55 -04:00
Brian Clozel e91ce23cd0 Add javax.servlet.http.Part support for data binding
Prior to this commit, Multipart databinding would only support
MultiPartFile databinding using commons-multipart.

Now the WebRequestDataBinder supports Part and List<Part>
databinding for Servlet 3.0 compliant containers.

Issue: SPR-10591
2013-10-02 17:19:44 -04:00
Andy Wilkinson 41e411a8a5 Introduce new HEARTBEAT message type
Previously, there was no generic concept of a message that represents
a heartbeat and the STOMP-specific code used a null STOMP command to
represent a heartbeat.

This commit introduces HEARTBEAT as a new SimpMessageType. The STOMP
support has been updated to create HEARTBEAT messages to represent
heartbeats, and to use the new message type as the mechanism by which
heartbeats are identified.
2013-10-02 16:30:53 -04:00
Andy Wilkinson a7f735b50a Make the broker relay heartbeat intervals configurable
Prior to this commit, the intervals at which the broker relay's system
session would send heartbeats to the STOMP broker and expect to
receive heartbeats from the STOMP broker were hard-coded at 10
seconds.

This commit makes the intervals configurable, with 10 seconds being
the default value.
2013-10-02 16:29:43 -04:00
Andy Wilkinson ba11af7f11 Improve broker relay's shutdown and availability events
Previously, when the broker relay was shut down, the TCP client was
closed and the relay sessions were left to find out about the
shutdown as a result of their TCP connections being closed. This led
to problems where an attempt could be made to use a session that was,
in fact, in the process of being shut down.

This commit updates the broker relay to explicitly close each of its
relay sessions as part of its stop processing.
As part of the broker relay being shut down explicitly close each of
its relay sessions. It does so before closing the TCP client so that
the relay sessions know that they are  disconnected before their TCP
connections are closed.

The broker relay's publishing of availability events has also been
improved. Prior to this commit, availability events were published
based on the availability of any relay session. For example, this
meant that a successfully established client relay session would
result in an event being published indicating that the broker's
available even if the system relay session was yet to be established.
This commit updates the relay so that broker availability events are
only published by the system relay session. This allows application
code the use these events as an accurate indication of the
availability of the broker. Clients that are interested in the
broker's availability can find out through the use of heart beats or
through the receipt of an ERROR frame in response to an attempt to
communnicate with the broker.
2013-10-01 21:04:26 -04:00
Rossen Stoyanchev c01f45fa59 Fix failing test 2013-10-01 14:56:21 -04:00
Rossen Stoyanchev f8e1f06d08 Update Spring MVC Java config for ResourceResolvers 2013-10-01 14:43:38 -04:00
Rossen Stoyanchev 02cb86659d Prevent cache of sockjs known prefixes from growing
Issue: SPR-10893
2013-09-30 21:46:19 -04:00
Rossen Stoyanchev e60e8dc582 Fix issue with getting SockJS path
Issue: SPR-10923
2013-09-30 21:19:29 -04:00
Rossen Stoyanchev 6ddacdc01d Fix issue in simple broker with peer-to-peer messages
Issue: SPR-10930
2013-09-30 21:02:51 -04:00
Rossen Stoyanchev 48caeef4de Polish and fix issues in STOMP broker relay
Fix error in te code that handles the result of sending a heartbeat

Fix error in processing DISCONNECTED frames that closed the TCP
connection before the message was sent.
2013-09-30 16:37:18 -04:00
Andy Wilkinson 34dd844716 Polishing
- Polish javadoc for CONNECTED_USER_HEADER
 - Improve method ordering
2013-09-30 14:24:57 -04:00
Andy Wilkinson 5025c304b8 Introduce CONNECT_ACK message type
Previously, handling of a STOMP CONNECT message and sending of a
CONNECTED response was performed by StompProtocolHandler if it was
backed by SimpleBrokerMessageHandler, or left up to the real message
broker if it was backed by StompBrokerRelayMessageHandler. This
wasn't ideal as it should be StompProtocolHandler's job to simply map
messages to and from the STOMP protocol, not to do part of the
broker's job and respond directly to CONNECT.

This commit introduces a new message type, CONNECT_ACK. When it
receives a CONNECT message, SimpleBrokerMessageHandler will now
respond with a CONNECT_ACK message that StompProtocolHandler can map
into a STOMP CONNECTED message. The CONNECT_ACK message contains the
CONNECT message as a header so that StompProtocolHandler has access to
its accept-version header.

StompProtocolHandler has been simplified so that a CONNECT message
is always passed to the output channel, irrespective of whether it's
backed by a simple broker or a real broker. The handleConnect flag,
and the code that would set it correctly depending on the app's
configuration, has been removed.
2013-09-30 14:24:57 -04:00
Andy Wilkinson b2f31a3c74 Improve handling of send failures
Prior to this commit, a failure to send a heartbeat was ignored and a
failure to forward a message to the broker would result in an error
frame being sent but nothing more.

Following this commit, a failure to send a heartbeat to the broker
is treated as a TCP client failure. Furthermore, if the system relay
session fails to forward a message to the broker an exception is
thrown. Typically, the system relay session will be forwarding
messages on behalf of local application code, rather than a remote
WebSocket client. Throwing an exception allows the application code
to be notified of the problem directly, rather than via a broker
availability event.
2013-09-30 14:21:42 -04:00
Rossen Stoyanchev 9b2c041085 Fix issue in htmlfile sockjs transport
Issue: SPR-10854
2013-09-29 21:09:39 -04:00
Rossen Stoyanchev 1ba806b185 Remove unintended changes from last commit 2013-09-27 21:17:02 -04:00
Rossen Stoyanchev d4a0e628d5 Add initial cut of expanded resource handling
Issue: SPR-10933, SPR-10310
2013-09-27 21:09:53 -04:00
Rossen Stoyanchev 5a2e30c18b Refactor Resource URL generation and Servlet Filter
Renamed ResourceUrlMapper to ResourceUrlGenerator and refactored it
to be configured with Resource-serving HandlerMappings as opposed to
having them detected in the ApplicationContext through the
BeanPostProcessor contact.

Renamed and polished ResourceUrlEncodingFilter to ResourceUrlFilter
and added tests.
2013-09-27 21:07:31 -04:00
Rossen Stoyanchev 3c48b42106 Refactor ResourceResolverChain + resolver class names
This change splits out resource transformation out from the
ResourceResolverChain so that chain is focused entirely on resource
resolution (as its name suggests). The invocation of transformers
is left as a separate step, it uses a different (recursive)
algorithm in any case and iterates over a different set of objects.

Also ResourceResolverChain is now limited strictly to methods that
a ResourceResolver should be able to use to delegate to remaining
resolvers.

Furthermore, ResourceResolverChain now maintains an internal index
of the "current" resolver so that resolvers don't have to pass the
chain when invoking it much like a (Servlet API) FilterChain works.
If the last resolver calls the chain again, a null value is returned.
2013-09-27 21:07:31 -04:00
Rossen Stoyanchev 0e58125b15 Polish 2013-09-27 21:07:31 -04:00
Jeremy Grelle 61e61bd5fd Asset pipeline proposal. 2013-09-27 21:07:31 -04:00
Phillip Webb 8abe949734 Fix ArrayStoreException reading subclassed enums
Fix ASM AnnotationAttributesReadingVisitor to correctly deal with
subclasses enums.

Issue: SPR-10914
2013-09-27 11:25:57 -07:00
Rossen Stoyanchev f3611e767e Merge pull request #364 from mikesir87/ws-glassfish4-support
* mikesir87-ws-glassfish4-support:
  Added websocket upgrade support for GlassFish 4.0
2013-09-27 08:57:38 -04:00