Commit Graph

612 Commits

Author SHA1 Message Date
Spring Buildmaster b32a365f14 Increment version to 3.1.2.BUILD-SNAPSHOT 2012-02-16 15:38:16 -08:00
Spring Buildmaster 79c9ca1a26 Release version 3.1.1.RELEASE 2012-02-16 15:33:27 -08:00
Chris Beams fc416bcb0b Apply @Configuration BeanNameGenerator consistently
Since the introduction of the AnnotationConfig(Web)ApplicationContext
types in Spring 3.0, it has been possible to specify a custom
bean name generation strategy via the #setBeanNameGenerator methods
available on each of these classes.

If specified, that BeanNameGenerator was delegated to the underlying
AnnotatedBeanDefinitionReader and ClassPathBeanDefinitionScanner. This
meant that any @Configuration classes registered or scanned directly
from the application context, e.g. via #register or #scan methods would
respect the custom name generation strategy as intended.

However, for @Configuration classes picked up via @Import or implicitly
registered due to being nested classes would not be aware of this
strategy, and would rather fall back to a hard-coded default
AnnotationBeanNameGenerator.

This change ensures consistent application of custom BeanNameGenerator
strategies in the following ways:

 - Introduction of AnnotationConfigUtils#CONFIGURATION_BEAN_NAME_GENERATOR
   singleton

   If a custom BeanNameGenerator is specified via #setBeanNameGenerator
   the AnnotationConfig* application contexts will, in addition to
   delegating this object to the underlying reader and scanner, register
   it as a singleton bean within the enclosing bean factory having the
   constant name mentioned above.

   ConfigurationClassPostProcessor now checks for the presence of this
   singleton, falling back to a default AnnotationBeanNameGenerator if
   not present. This singleton-based approach is necessary because it is
   otherwise impossible to parameterize CCPP, given that it is
   registered as a BeanDefinitionRegistryPostProcessor bean definition
   in AnnotationConfigUtils#registerAnnotationConfigProcessors

 - Introduction of ConfigurationClassPostProcessor#setBeanNameGenerator

   As detailed in the Javadoc for this new method, this allows for
   customizing the BeanNameGenerator via XML by dropping down to direct
   registration of CCPP as a <bean> instead of using
   <context:annotation-config> to enable  @Configuration class
   processing.

 - Smarter defaulting for @ComponentScan#beanNameGenerator

   Previously, @ComponentScan's #beanNameGenerator attribute had a
   default value of AnnotationBeanNameGenerator. The value is now the
   BeanNameGenerator interface itself, indicating that the scanner
   dedicated to processing each @ComponentScan should fall back to an
   inherited generator, i.e. the one originally specified against the
   application context, or the original default provided by
   ConfigurationClassPostProcessor. This means that name generation
   strategies will be consistent with a single point of configuration,
   but that individual @ComponentScan declarations may still customize
   the strategy for the beans that are picked up by that particular
   scanning.

Issue: SPR-9124
2012-02-15 15:33:35 +01:00
Rossen Stoyanchev 66bc214a79 Replace spaces with tabs 2012-02-10 18:24:58 -05:00
Arjen Poutsma edc80ffa95 Use request contentType/encoding in ServletServetHttpRequest/Response
ServletServerHttpRequest now falls back on the contentType and the
the characterEncoding of the ServletRequest, if the headers of the
incoming request don't specify one. Similary ServletServerHttpResponse
sets the contentType and the characterEncoding of the ServletResponse
if not already set.

This allows using the CharacterEncodingFilter to set a character
encoding where the request doesn't specify one and have it be used
in HttpMessageConverter's.

SPR-9096
2012-02-09 12:34:27 -05:00
Rossen Stoyanchev 4f4a2e7fc7 Update documentation with regards to differences between @MVC 3.0/3.1
Although the reference documentation listed the new @MVC support
classes and their benefits, it did not explicitly mention a few
use cases that are no longer supported. There is now a specific
section on the new support classes listing exactly what is not
supported.

Similary the @RequestMapping annotation never refered explicitly
to the existence of old and new support and never made it clear
exactly what the differences are.

Both have not been corrected.

SPR-9063, SPR-9042
2012-02-07 19:49:44 -05:00
Juergen Hoeller f8238f5243 Servlet/PortletContextResource's "isReadable()" implementation returns false for directories (SPR-9067) 2012-02-07 15:54:16 +01:00
Arjen Poutsma 3ec78e2c04 SPR-9093: UriTemplate not throwing IllegalArgumentException when URIVariables map missing values 2012-02-07 15:40:50 +01:00
Chris Beams 025b8abfaf Allow ACI classes access to servlet context params
Prior to this commit, StandardServletEnvironment's servlet context
PropertySource remained stubbed out until it the ServletContext became
available and could be replaced during the refresh() of its enclosing
WebApplicationContext. This behavior is acceptable in most cases.
However, if the user has declared an ApplicationContextInitializer that
attempts to access servlet context-params via the Environment API, this
result in a kind of 'false negative', i.e. the context-param key and
value are actually present in the ServletContext, but the PropertySource
representing servlet context params is still a stub at this point,
meaning that it returns an empty result in all cases.

With this change, WebApplicationContextUtils#initServletPropertySources
is invoked eagerly by the ContextLoader if any ACI classes have been
declared. This swaps out the servlet context property source stub for
the real thing just in time for ACIs to use it if necessary.

Extra guard logic has been added to #initServletPropertySources to
ensure idempotency -- once the stub has been replaced, the method
never attempts the replacement again, e.g. during the normal context
refresh() when this method will be called again.

Issue: SPR-8991
2012-02-04 23:13:52 +01:00
Chris Beams 856b77bc31 Optimize ApplicationContextInitializer handling
- Perform early check whether any ACI classes have been declared and
   exit immediately if not, avoiding any other processing

 - Polish method names in ContextLoaderTests

Issue: SPR-8991
2012-02-04 23:13:48 +01:00
Rossen Stoyanchev 871336a8c8 Better support for @SessionAttributes in clustered environments
A list of "known" session attributes (listed in @SessionAttributes)
was gradually built as attributes get added to the model. In a
failover scenario that knowledge is lost causing session attributes
to be potentially re-initialized via @ModelAttribute methods.

With this change @SessionAttributes listed by name are immediately
added to he list of "known" session attributes thus this knowledge
is not lost after a failover. Attributes listed by type however
still must be discovered as they get added to the model.
2012-02-03 12:23:24 -05:00
Rossen Stoyanchev 010abd06e3 SPR-9077 Remove empty path segments from input to UriComponentsBuilder. 2012-02-01 19:51:00 -05:00
Rossen Stoyanchev 8530828eb4 SPR-9076 Add normalize() method to UriComponents. 2012-02-01 19:12:52 -05:00
Rossen Stoyanchev 64a69f7cf8 SPR-9079 Don't check for "POST" multipart request method arg resolvers 2012-02-01 13:22:12 -05:00
Chris Beams 87a021d5c9 Add <license> section to 3.1.x Maven poms
Issue: SPR-8927
2012-01-31 15:18:05 +01:00
Arjen Poutsma 8980ce712d SPR-8986 RestTemplate throws IllegalArgumentException when HTTP status is not in the HttpStatus enum
- Added getRawStatusCode
2012-01-23 14:26:11 +01:00
Arjen Poutsma ff9ad7adc6 SPR-8986 RestTemplate throws IllegalArgumentException when HTTP status is not in the HttpStatus enum
- Added status codes from Wikipedia
2012-01-23 14:03:14 +01:00
Rossen Stoyanchev bcd8355e61 SPR-8974 Fix regression in UriUtils.java 2012-01-19 23:47:31 -05:00
Juergen Hoeller 96b8c46480 nicer error message indicating JAX-WS 2.1 requirement at runtime (SPR-8998) 2012-01-15 20:07:48 +01:00
Rossen Stoyanchev e8fc90ce3e SPR-8917 Fix issue with quoted parameter values in MediaType. 2012-01-13 15:25:53 -05:00
Chris Beams d7d1b495f2 Polish "Support flash attrs..." and related classes
- Eliminate trailing whitespace

 - Update long method signatures to follow framework whitespace
   conventions

   Based on the following search,

       $ git grep -A3 '^.public .* .*([^\{;]*$' */src/main

   the strong convention throughout the framework when dealing with
   methods having long signatures (i.e. many parameters) is to break
   immediately after the opening paren, indent two tabs deeper and break
   lines around 90 characters as necessary. Such signatures should also
   be followed by a newline after the opening curly brace to break
   things up visually.

   The files edited in this commit had a particularly different style of
   intenting arguments to align with each other vertically, but the
   alignment only worked if one's tabstop is set at four spaces.
   When viewed at a different tabstop value, the effect is is jarring,
   both in that it is misaligned and significantly different from most
   of the framework. The convention described above reads well at any
   tabstop value.
2012-01-10 12:21:14 -05:00
Chris Beams 41c405998e Convert CRLF=>LF on files missed earlier
Complete pass with `dos2unix` found additional files missed on earlier
related commit.

Issue: SPR-5608
2011-12-22 14:06:44 +01:00
Chris Beams 88913f2b23 Convert CRLF (dos) to LF (unix)
Prior to this change, roughly 5% (~300 out of 6000+) of files under the
source tree had CRLF line endings as opposed to the majority which have
LF endings.

This change normalizes these files to LF for consistency going forward.

Command used:

$ git ls-files | xargs file | grep CRLF | cut -d":" -f1 | xargs dos2unix

Issue: SPR-5608
2011-12-21 14:52:47 +01:00
Chris Beams e158f61e93 Increment version to 3.1.1.BUILD-SNAPSHOT 2011-12-16 11:59:06 +01:00
Chris Beams ac107d0c2a Release Spring Framework 3.1.0.RELEASE 2011-12-13 16:35:49 +00:00
Juergen Hoeller 1c45c51fe1 overhaul of support package arrangements for handler method processing; added missing package-info files 2011-12-12 23:20:03 +00:00
Juergen Hoeller 450a3d7eee polishing 2011-12-12 15:04:11 +00:00
Chris Beams 23e58aa718 Preserve programmatically set context config locations
Prior to this fix, ContextLoader(Listener)'s would overwrite any
value set directly against a WebApplicationContext's #setConfigLocation
method. This is a likely scenario when using Spring 3.1's new
WebApplicationInitializer support.

Now a check is performed to ensure that the ContextLoader init-param
value is non-null before doing the overwriting.

Added tests to ensure that all expected precedence, overwriting and
defaulting of context config locations works as expected.

Issue: SPR-8510
2011-12-12 14:42:24 +00:00
Chris Beams ec1b016602 Improve unsupported operation messages in GenericWAC 2011-12-12 14:41:37 +00:00
Juergen Hoeller 8f69e81197 polishing 2011-12-11 22:07:37 +00:00
Juergen Hoeller d8e640d708 polishing 2011-12-11 22:07:12 +00:00
Juergen Hoeller e648245eb3 added MethodValidationInterceptor/PostProcessor for Hibernate Validator 4.2 based method validation; renamed Spring's variant of @Valid to @Validated 2011-12-09 18:09:14 +00:00
Arjen Poutsma 3beef9a92e SPR-8883 - RestTemplate.headForHeaders throws "IllegalArgumentException: No InputStream specified" on server resource which status code are 4xx 2011-12-08 19:17:48 +00:00
Rossen Stoyanchev c472a163f1 SPR-8572 Support Void.class as response type in RestTemplate. 2011-12-08 03:59:28 +00:00
Arjen Poutsma f9144ea1ea SPR-8367 - 3.1.0.M2 update of the RestTemplate for Apache HTTP Components will default to sending 2 requests on authentication and doesn't support HttpContext parameters without significant extention/rewrite 2011-12-07 01:22:07 +00:00
Juergen Hoeller 426863f790 avoid swallowing of IOException 2011-12-06 22:51:57 +00:00
Chris Beams c2c224958d Polish WebApplicationInitializer Javadoc
Issue: SPR-8897
2011-12-06 12:17:42 +00:00
Juergen Hoeller bea5016e53 fixed validation test failures 2011-12-03 17:03:33 +00:00
Juergen Hoeller 00133179df added SmartValidator interface with general support for validation hints; added custom @Valid annotation with support for JSR-303 validation groups; JSR-303 SpringValidatorAdapter and MVC data binding provide support for validation groups (SPR-6373) 2011-12-03 15:46:31 +00:00
Juergen Hoeller 49a2aaf023 added SmartValidator interface with general support for validation hints; added custom @Valid annotation with support for JSR-303 validation groups; JSR-303 SpringValidatorAdapter and MVC data binding provide support for validation groups (SPR-6373) 2011-12-03 15:44:33 +00:00
Rossen Stoyanchev 4bfcb79ae3 SPR-8892 Add String constants to MediaType. 2011-12-02 18:58:41 +00:00
Arjen Poutsma 53cb529162 SPR-8809 - RestTemplate headers not sent when bufferRequestBody is false 2011-12-02 11:29:47 +00:00
Rossen Stoyanchev 9f98f77c3e SPR-8863 Add RequestContext.getPathToServlet() method.
This method allows a view to access the combined context path and
servlet mapping path for prefixing URLs without having to specify
the literal part of a servlet mapping such as "/main/*") 
explicitly everywhere. For example:

${requestContext.pathToServlet}/css/main.css
2011-12-01 22:56:51 +00:00
Juergen Hoeller 45a0ae3fb9 polishing 2011-12-01 15:11:32 +00:00
Juergen Hoeller f75e832e7c polishing 2011-12-01 13:34:12 +00:00
Arjen Poutsma 91c14bd1fe SPR-8809 - RestTemplate headers not sent when bufferRequestBody is false 2011-11-30 11:07:38 +00:00
Rossen Stoyanchev a9a068e678 SPR-8867 Fix issue with Content-Length header and UTF-8 charset.
The AbstractHttpMessageConverter was using the requested Content-Type
rather than the actual response Content-Type to determine the length
of the content. This can lead to a problem when a controller returns
a ResponseEntity with a Content-Type header that ignores (overrides)
the requested Content-Type. The fix ensures that actual response 
Content-Type is the one used both to write to the response and to 
determine the length of the content.
2011-11-28 18:42:57 +00:00
Juergen Hoeller b55040cf02 Servlet/PortletContextResource's getFile prefers "file:" URL resolution over calling getRealPath (SPR-8461) 2011-11-28 16:51:42 +00:00
Juergen Hoeller 3f7dccddd2 added getObjectMapper() accessor to MappingJacksonHttpMessageConverter (SPR-8605) 2011-11-28 14:34:59 +00:00
Rossen Stoyanchev 947b5fefff SPR-8851 Switch to logging debug messages in AbstractWebArgumentResolverAdapter 2011-11-18 16:18:55 +00:00