Commit Graph

5300 Commits

Author SHA1 Message Date
Chris Beams 9c223c1780 Fix broken link to JavaBean customization tutorial
Issue: SPR-9408
2012-05-15 22:51:46 +03:00
Chris Beams 19aceebb96 Fix broken javadoc link to ROME tools project
Issue: SPR-9379
2012-05-15 22:51:46 +03:00
Chris Beams 2db4e15f0e Translate SQLTimeoutException to QueryTimeoutException
SPR-7680 added QueryTimeoutException to Spring's DataAccessException
hierarchy, but did not integrate it into the
SQLExceptionSubclassTranslator; it was added mainly to accomodate users
defining their own custom exception translators.

However, it does make sense to translate any SQLTimeoutException to this
new QueryTimeoutException type, and this commit makes that change. It
does represent a slight backward-incompatibility, given that
QueryTimeoutException extends TransientDataAccessException, whereas
SQLExceptionSubclassTranslator previously returned the more specific
TransientDataAccessResourceException for any SQLTimeoutException.

It is expected that this incompatibily will be very low-impact, i.e. not
affecting many (if any) users. In any case, a major release (Spring 3.2)
is the right time to introduce such a change, and the migration path is
straightforward: any users depending on catching
TransientDataAccessResourceException in the case of query timeouts
should update those catch blocks to expect QueryTimeoutException
instead. Care should also be taken to ensure correctness of existing
catch blocks expecting TransientDataAccessException, as these blocks
will now catch QueryTimeoutException as well.

Issue: SPR-9376, SPR-7680
2012-05-15 22:51:45 +03:00
Chris Beams 2ff43726be Restore serializability of HttpStatusCodeException
SPR-7591 introduced a java.nio.charset.Charset field within
HttpStatusCodeException. The former is non-serializable, thus by
extension the latter also became non-serializable.

Because the Charset field is only used for outputting the charset name
in HttpStatusCodeException#getResponseBodyAsString, it is reasonable to
store the value returned by Charset#name() instead of the actual Charset
object itself.

This commit refactors HttpStatusCodeException's responseCharset field to
be of type String instead of Charset and adds tests to prove that
HttpStatusCodeException objects are once again serializable as expected.

Issue: SPR-9273, SPR-7591
2012-05-15 22:51:45 +03:00
Chris Beams 9a856c09f3 Clarify @EnableScheduling javadoc
It is now advised that destroyMethod="shutdown" should be used
on @Bean methods returning an ExecutorService.

Issue: SPR-9280
2012-05-15 22:51:45 +03:00
Chris Beams 283c1b9c53 Upgrade to Gradle 1.0-rc-3
Issue: SPR-9411
2012-05-15 22:51:45 +03:00
Sam Brannen b67a08cfd7 Fix typo in Javadoc and emphasize @Configuration 'lite' mode 2012-05-15 20:36:41 +02:00
Rossen Stoyanchev bdc3599d3d Add CompositeRequestCondition
The new type makes it easier providing multiple custom request mapping
conditions via setters on RequestMappingHandlerMapping.

Issue: SPR-9350
2012-05-15 13:16:06 -04:00
Rossen Stoyanchev fbb2103e4d Add "excludedExceptions" to SimpleUrlHandlerMapping
The new property can be used to ignore specific exceptions that may
otherwise be matched by the "exceptionMappings" property or resolved
through the defaultErrorView.

Issue: SPR-5193
2012-05-15 13:16:06 -04:00
Sam Brannen 1167155182 Update reference manual regarding upgrade to JUnit 4.10 2012-05-15 14:40:13 +02:00
Sam Brannen 50d4ebcc71 Fix typo in section id 2012-05-15 14:25:10 +02:00
Chris Beams 347e8dfc86 Merge pull request #79 from olivergierke/SPR-9346
* SPR-9346:
  Add missing section ids in reference documentation
2012-05-15 13:26:05 +03:00
Oliver Gierke 2a75c57d3c Add missing section ids in reference documentation
Add missing id attributes to <section> elements in the reference
documentation to ensure stable anchor links in HTML output.

Issue: SPR-9346
2012-05-15 13:23:32 +03:00
Rossen Stoyanchev 1d0e484eac Support access to all URI vars via @PathVariable Map
Issue: SPR-9289
2012-05-14 16:01:16 -04:00
Rossen Stoyanchev 698d004260 Deprecate HttpStatus codes 419, 420, 421
Issue: SPR-7942
2012-05-14 14:34:33 -04:00
Rossen Stoyanchev 59084354e2 Add validation of HTTP method in form tag
SPR-6945
2012-05-14 11:38:58 -04:00
Chris Beams f1a699cff5 Merge pull request #77 from pukkaone/fix-typo
* pukkaone/fix-typo:
  Fix typos in Reference Documentation
2012-05-12 09:47:53 +03:00
Chin Huang f1c062fe9e Fix typos in Reference Documentation 2012-05-12 00:53:51 -04:00
Sam Brannen 78c6d70f0b Refute claims made in SPR-9051
It was claimed that when a {@code @ContextConfiguration} test class
references a config class missing an {@code @Configuration} annotation,
@Bean dependencies are wired successfully but the bean lifecycle is not
applied (no init methods are invoked, for example).

AnnotatedConfigClassesWithoutAtConfigurationTests refutes this claim by
demonstrating that @Bean methods in non-@Configuration classes are
properly handled as "annotated factory bean methods" and that lifecycle
callbacks in fact apply to such factory beans.

Issue: SPR-9051
2012-05-12 00:36:24 +02:00
Rossen Stoyanchev d52fc3bd2f Prevent response updates if @ResponseStatus has reason
When @ResponseStatus has a reason and servletResponse.sendError() is
called, the response is committed and should no longer be written to.
After this change, the ServletInvocableHandlerMethod will mark the
response fully handled and will ignore any non-null return values.

Issue: SPR-9159
2012-05-11 17:41:14 -04:00
Sam Brannen 0b17dd2242 Fix misleading JavaDoc in ProfileAnnotationConfigTestSuite 2012-05-11 23:35:43 +02:00
Rossen Stoyanchev c57d4e2386 Add trySet method to DeferredResult
The method absorbs any potential StaleAsyncWebRequestException and
returns false instead.

Issue: SPR-8517
2012-05-11 16:07:56 -04:00
Sam Brannen 897f6d6c68 Update changelog regarding upgrade to JUnit 4.10 and TestNG 6.5.2 2012-05-11 21:02:25 +02:00
Rossen Stoyanchev 982cb2f258 Fix content negotiation issue with sort by q-value
Before this fix the q-value of media types in the Accept header were
ignored when using the new RequestMappingHandlerAdapter in combination
with @ResponseBody and HttpMessageConverters.

Issue: SPR-9160
2012-05-11 14:43:58 -04:00
Sam Brannen 75578d4e88 Upgrade to TestNG 6.5.2
The Spring TestContext Framework (TCF) currently builds against TestNG
5.10. Thus in order to ensure that the TCF builds against the latest
release of TestNG without issues and in order to investigate the
possibility of integrating with newer TestNG features, we are upgrading to
version 6.5.2.

Note, however, that the Gradle build currently does not execute any TestNG
tests; this will be addressed in SPR-9398.

Issue: SPR-8221
2012-05-11 19:12:59 +02:00
Sam Brannen e8392f83c9 Upgrade to JUnit 4.10
Spring currently builds against JUnit 4.9; however, in order to ensure
that the Spring TestContext Framework builds and runs against JUnit 4.10
without issues and in order to investigate the possibility of integrating
with newer JUnit features, we are upgrading to JUnit 4.10.

Issue: SPR-9277
2012-05-11 17:33:53 +02:00
Rossen Stoyanchev 816c1f47a4 Translate EOF to HttpMessageNotReadableException
The MappingJacksonHttpMessageConverter now catches all IOException
types raised while reading JSON and translates them into
HttpMessageNotReadableException.

Issue: SPR-9238
2012-05-10 17:17:29 -04:00
Rossen Stoyanchev d7efc0db80 Detect controller methods via InitializingBean hook
Previously RequestMappingHandlerMapping detected @RequestMapping
methods through an initApplicationContext() hook. However, the
HandlerMapping may not have been fully set up with all its
dependencies at that point including settings like useSuffixPattern
and others.

This change moves the detection @RequestMapping methods to an
InitializingBean.afterPropertiesSet() hook.

Issue: SPR-9371
2012-05-10 16:42:36 -04:00
Rossen Stoyanchev f61f4a960e Discover controllers based on type @RequestMapping
This was supported in DefaultAnnotationHandlerMapping but not in the
RequestMappingHandlerMapping. The specific scenario where this matters
is a controller decorated with a JDK proxy. In this scenario the
HandlerMapping looks at interfaces only to decide if the bean is a
controller. The @Controller annotation is better left (and required)
on the class.

Issue: SPR-9374
2012-05-10 16:19:14 -04:00
Rossen Stoyanchev c499df2315 Fix issue with resolving Errors controller argument
The ErrorsMethodArgumentResolver expects the preceding @ModelAttribute
in the controller method signature to be the last one added in the
model -- an assumption that can break if a model attribute is added
earlier (e.g. through a @ModelAttribute method) and more attributes
are added as well. This fix ensures when an @ModelAttribute is resolved
as a controller method argument it has the highest index in the model.

Issue: SPR-9378
2012-05-10 16:01:14 -04:00
Rossen Stoyanchev e04b322110 Don't decode URI for content negotiation by extension
Minor bug fix in the ContentNegotiatingViewResolver where decoding the
URI prevented proper detection of the file extension in a URL.

Issue: SPR-9390
2012-05-10 15:00:01 -04:00
Sam Brannen 80af842662 Re-enable ignored tests in MockServletContextTests
Two tests in MockServletContextTests were disabled with @Ignore with the
comment "fails to work under ant after move from .testsuite -> .test";
however, this no longer appears to apply with the Gradle build. Thus
these tests have been re-enabled.
2012-05-10 17:00:28 +02:00
Rossen Stoyanchev 9546be3974 Fix JavaDoc in OpMultiply so that it does not contain special characters
The JavaDoc in OpMultiply contained special characters that caused
problems when building with Java 7 on Mac OS X. The section symbol has
been replaced with the word "Section". Also improved class-level and
method-level JavaDoc in general.
2012-05-10 03:01:52 +02:00
Rossen Stoyanchev db289495e5 Pretty print option for Jackson converter and view
Jackson serialization supports pretty printing. Usually it's enabled
by invoking ObjectMapper.configure(..), which is not convenient for
apps with XML configuration. The Jackson HttpMessageConverter and View
now both have a prettyPrint property.

A second more serious issue is documented here:
https://github.com/FasterXML/jackson-databind/issues/12

The workaround discussed at the above link has been implemented.

Issue: SPR-7201
2012-05-09 16:29:22 -04:00
Rossen Stoyanchev 6a162d488a Merge pull request #76 from rstoyanchev/jackson2
Add Jackson 2 HttpMessageConverter and View
2012-05-09 10:25:40 -07:00
Rossen Stoyanchev e63ca04fdb Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.

The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.

Issue: SPR-9302
2012-05-09 13:07:25 -04:00
Rossen Stoyanchev 6cca57afd3 Exception for OSIV deferred close with async requests
OSIV deferred close mode is not supported with async requests and is
unlikely to be what's the desired. This change adds an exception with
a message stating this.

Issue: SPR-8517
2012-05-04 18:58:47 -04:00
Rossen Stoyanchev 158b3c6af8 Merge pull request #73 from rstoyanchev/mvc-async
HanderInterceptor and OSIV async request changes
2012-05-04 13:16:18 -07:00
Rossen Stoyanchev e7506b50b2 HanderInterceptor and OSIV async request changes
This change updates Open-Session-in-View filters and interceptors for
use in async requests mainly ensuring the open Hibernate session is
unbound from the main request processing thread and bound to the to
async thread.

Issue: SPR-8517
2012-05-04 16:12:14 -04:00
Rossen Stoyanchev 1eaaa9a446 Add empty location check to ResourceHttpRequestHandler
ResourceHttpRequestHandler now implements InitializingBean and
checks for empty locations.

Issue: SPR-9186
2012-05-01 17:08:19 -04:00
Rossen Stoyanchev c52c78d020 Javadoc update
Issue: SPR-9265
2012-05-01 16:29:39 -04:00
Rossen Stoyanchev a33fe6fa0a Fix issue with encoded params in UriComponentsBuilder
The fromUri method of UriComponentsBuilder used uri.getXxx() methods,
which decode the URI parts causing URI parsing issues. The same method
now uses uri.getRawXxx().

Issue: SPR-9317
2012-05-01 16:10:38 -04:00
Chris Beams ae9549ae13 Merge pull request #66 from dridi/SPR-9176
* SPR-9176:
  Fix scoped-proxy memory leak w/ @Resource injection
2012-05-01 17:52:21 +03:00
Dridi Boukelmoune f779c199ea Fix scoped-proxy memory leak w/ @Resource injection
Prior to this change, request-scoped components having
@Resource-injected dependencies caused a memory leak in
DefaultListableBeanFactory#dependenciesForBeanMap.

Consider the following example:

    @Component
    @Scope(value="request", proxyMode=ScopedProxyMode.TARGET_CLASS)
    public class MyComponent {

        @Resource
        private HttpServletRequest request;

        // ...
    }

The bean name for "MyComponent" will end up being
'scopedTarget.myComponent', which will become a key in
the #dependenciesForBeanMap structure.

On the first request, the injected HttpServletRequest bean will be a
proxy and will internally have a bean name of the form
"$Proxy10@1a3a2a52". This name will be added to the Set value associated
with the 'scopedTarget.myComponent' entry in #dependenciesForBeanMap.

On the second request, the process will repeat, but the injected
HttpServletRequest will be a different proxy instance, thus having a
different identity hex string, e.g. "$Proxy10@5eba06ff". This name will
also be added to the Set value associated with the
'scopedTarget.myComponent' entry in #dependenciesForBeanMap, and this
is the source of the leak: a new entry is added to the set on each
request but should be added only once.

This commit fixes the leak by introducing caching to
CommonAnnotationBeanPostProcessor#ResourceElement similar to that already
present in AutowiredAnnotationBeanPostProcessor#AutowiredFieldElement
and #AutowiredMethodElement. Essentially, each ResourceElement instance
now tracks whether it has been created, caches the ultimate value to be
injected and returns it eagerly if necessary. Besides solving the memory
leak, this has the side effect of avoiding unnecessary proxy creation.

This fix also explains clearly why injection into request-scoped
components using @Autowired never suffered this memory leak: because the
correct caching was already in place. Because @Resource is considerably
less-frequently used than @Autowired, and given that this particular
injection arrangement is relatively infrequent, it becomes
understandable how this bug has been present without being reported
since the introduction of @Resource support in Spring 2.5: developers
were unlikely to encounter it in the first place; and if they did, the
leak was minor enough (adding strings to a Set), that it could
potentially go unnoticed indefinitely depending on request volumes and
available memory.

Issue: SPR-9176
2012-05-01 17:52:11 +03:00
Chris Beams e85e6147f0 Merge pull request #7 from bedla/SPR-8308
* SPR-8308:
  Convert SpEL plus operands using reg'd converters
2012-04-30 17:14:32 +03:00
Ivo Smid 7cdfaf3e0d Convert SpEL plus operands using reg'd converters
Prior to this commit, SpEL's OpPlus ('+' operator) would convert its
left and right operands to String directly via #toString calls.

This change ensures that operand values are delegated to any registered
converters, allowing for customization of the stringified output.

Note that the OpPlus constructor now throws IllegalArgumentException if
zero operands are supplied.

Issue: SPR-8308
2012-04-30 17:12:40 +03:00
Chris Beams 3514cc5d65 Merge pull request #36 from sslavic/SPR-9113
* SPR-9113:
  Fix javadoc warnings
2012-04-30 11:31:51 +03:00
Stevo Slavic effb762558 Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.

This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.

Issue: SPR-9113
2012-04-30 11:31:02 +03:00
Chris Beams e830511e8a Merge pull request #35 from sslavic/SPR-9097
* SPR-9097:
  Fix encoding issues in javadoc
2012-04-30 11:06:24 +03:00
Stevo Slavic 991b8e9a06 Fix encoding issues in javadoc
Before this change javadoc in two classes had non-UTF-8 encoded
characters. This caused building Spring API to fail in Java 1.7.

Commit fixes this by replacing wrongly encoded characters with their
UTF-8 equivalents.

Issue: SPR-9097
2012-04-30 11:05:05 +03:00