Commit Graph

606 Commits

Author SHA1 Message Date
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
Rossen Stoyanchev 60ee0bb8f4 SPR-8020 Support UriComponentsBuilder as a controller method argument.
The UriComponentsBuilder instance passed into the method is initialized
with current request information including host, scheme, port, context
path, and the servlet mapping's literal part.

Also added shortcut methods to buildAndExpand in UriComponentsBuilder.
2011-11-18 14:36:44 +00:00
Rossen Stoyanchev 01cc76f8e3 SPR-8697 Flag '*/subtype' as illegal. 2011-11-17 20:15:49 +00:00
Rossen Stoyanchev 63e235f215 SPR-8750 Refine 'Content-Type' update in MockHttpServletRequest/Response.
The initial solution kept these three in full sync at all times:
contentType field, characterEncoding field, 'Content-Type' header.
That is correct behavior, however it breaks existing tests that rely
on contentType and characterEncoding being equal to exactly what 
they were set to.

For example, consider:
response.setContentType("text/plain");
response.setCharacterEncoding("UTF-8");

Ideally both contentType and the 'Content-Type' header would now be
"text/plain;charset=UTF-8". However, existing tests would expect 
that contentType is equal to "text/plain".

To avoid breaking existing tests, contentType and characterEncoding
will continue to be equal to exactly what they were set to while
the 'Content-Type' header will always include both the content 
type and the charset.

The only exception to this rule is when a 'Content-Type' header
is set explicitly, the contentType and characterEncoding fields will 
be updated accordingly, possibly overriding the existing values.
2011-11-17 15:07:15 +00:00
Rossen Stoyanchev 7918810366 SPR-8750 Update MockHttpServletRequest/Response handling of contentType.
The Content-Type header and the contentType field in HttpServletRequest/Response
are now always in sync. When a header is added the contentType field is updated
as well and vice versa. 

Similarly when the Content-Type header or the contentType field includes a charset 
field, the character encoding is updated and vice versa.
2011-11-16 23:28:48 +00:00
Chris Beams 70c28a0bc5 Add Apache license header where missing in src/main 2011-11-16 18:23:56 +00:00
Rossen Stoyanchev 2a39f34d33 SPR-8803 Refine UriComponentsBuilder.replaceQueryParam().
If no values are given, the query parameter is removed.
2011-11-10 15:08:24 +00:00