Commit Graph

779 Commits

Author SHA1 Message Date
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 95683f5137 SPR-9075 Add fromRequestUri() methods to ServletUriComponentsBuilder 2012-02-01 18:54:08 -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
Rossen Stoyanchev 3d1fa4f6b6 SPR-9060 Revise HTTP Session based FlashMapManager implementation.
The "default" FlashMapManager implementation added in 3.1 was invoked
after the redirect, which is too late in cases where the HTTP session
has not been yet been created since as the response is committed.

This change corrects the issue and makes other improvements to the
FlashMapManager implementation such as extracting a base
AbstractFlashMapManager class and making it easier for other
implementations to be added (for example cookie-based).
2012-01-31 22:10:55 -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
Rossen Stoyanchev e9208981a6 SPR-9062 Fix bug with ambiguous path and HTTP method request mappings
A direct path match with incorrect HTTP request method was causing another
request mapping with a pattern and a correct HTTP method to be ignored.
The bug affects the new @MVC support classes
(i.e. RequestMappingHandlerMapping).
2012-01-30 19:52:20 -05:00
Rossen Stoyanchev 21966990c8 SPR-9016 Add flag to Redirectview to disable expanding URI vars 2012-01-30 18:39:20 -05:00
Rossen Stoyanchev 610fa618aa SPR-9056 Make DelegatingWebMvcConfiguration config callbacks not final
It should be possible to progress from extending
WebMvcConfigurerAdapter (w/ @EnableWebMvc) to extending
WebMvcConfigurationSupport directly, to extending
DelegatingWebMvcConfigurationSupport. This change
makes that possible.
2012-01-30 17:55:34 -05:00
Rossen Stoyanchev b0c735feae SPR-8976 Make flash attrs available to view controllers.
Previously flash attributes were automatically merged into the
model of annotated controllers only. This change extends the same
benefit to ParameterizableView- and UrlFilenameViewController,
both of which merely select a view without user controller logic
and (the views) would otherwise  not have access to the flash
attributes.
2012-01-13 13:18:53 -05:00
Rossen Stoyanchev be4e698483 SPR-9021 Correct issue in comparing Accept header media types.
When checking for an exact match of Accept header media types
additional parameters such as quality need to be excluded.
For example "*/*" matches "*/*;q=0.9".
2012-01-12 17:13:11 -05:00
Rossen Stoyanchev 6da6acbe54 Make AbstractHandlerMethodExceptionResolver an abstract class. 2012-01-11 11:10:52 -05:00
Rossen Stoyanchev 5a2bd97c37 SPR-8997 Add getter for access to flash timeout. 2012-01-10 22:24:14 -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
Rossen Stoyanchev 92f8446eea SPR-8997 Add HttpServletResponse to FlashMapManager contract.
This change makes the HttpServletResponse available to the methods
of FlashMapManager in addition to the HttpServletRequest.
2012-01-10 10:47:47 -05:00
Rossen Stoyanchev 66df039b03 SPR-8698 Support flash attrs and a ModelAndView return value.
Before this change, flash attributes could only be added if via
RedirectAttributes.addFlashAttribute(..) if the method returned
a view name or a View instance. With this change, the above is
supported with a ModelAndView return value as well.
2012-01-09 20:18:44 -05:00
Rossen Stoyanchev a4b33533d3 SPR-9001 Javadoc fix 2012-01-06 18:23:46 -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 6796a775d2 overhaul of support package arrangements; added missing package-info files 2011-12-12 23:32:31 +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 d507c2b927 "dispatchOptionsRequest" only sets the default 'Allow' header if actually needed (SPR-7837); "dispatchTraceRequest" only generates default response body if actually needed 2011-12-12 15:30:04 +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
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
Juergen Hoeller 2dba480d9d used specific SLF4J versions for running the test suites of individual modules (fixing the Hibernate Validator 4.2 upgrade) 2011-12-09 17:53:29 +00:00
Chris Beams ede8482f81 Revert .web.servlet to Hibernate Validator 4.1.0.GA
In order to determine why classloading errors occur after
upgrading to 4.2.0.Final.

To demonstrate this error, uncomment the 4.2.0.Final dependency in
ivy.xml and run `ant test` within the .web.servlet module.
2011-12-09 13:09:38 +00:00
Chris Beams 1c58dd9d89 Upgrade to Hibernate Validator 4.2.0.Final
4.1/4.2 use is optional; users may compile and run against validator
versions back to 4.0.
2011-12-09 13:09:11 +00:00
Rossen Stoyanchev 6f150e4f07 SPR-8898 Allow match by trailing slash in RequestMappingHandlerMapping. 2011-12-08 03:38:50 +00:00
Juergen Hoeller 83c83d4d15 fixed media type resolution algorithm 2011-12-06 23:53:22 +00:00
Juergen Hoeller 34a4fba335 ResourceHttpRequestHandler sends content without content-type header if no media type found (SPR-7713); ResourceHttpRequestHandler and ContentNegotiatingViewResolver use consistent mime type resolution 2011-12-06 22:54:47 +00:00
Juergen Hoeller bea5016e53 fixed validation test failures 2011-12-03 17:03:33 +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 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
Rossen Stoyanchev ca4eafd4dd SPR-8808 Remove excludeFilter from javadoc examples in @EnableWebMvc. 2011-12-01 14:35:36 +00:00
Juergen Hoeller c2eafdb2fb AbstractCachingViewResolver caches unresolved view names by default ("cacheUnresolved"=true; SPR-8173) 2011-11-28 22:46:53 +00:00
Juergen Hoeller 1bb6d29be2 AbstractCachingViewResolver caches unresolved view names by default ("cacheUnresolved"=true; SPR-8173) 2011-11-28 22:34:29 +00:00
Juergen Hoeller 61a5ab9d34 fixed "formMultiSelect"/"formCheckboxes" FreeMarker macros to compare against actual field value (SPR-7721) 2011-11-28 14:42:03 +00:00
Rossen Stoyanchev ca3d774f5c Add detectHandlerMethodsInAncestorContexts property to AbstractHandlerMethodMapping. 2011-11-23 18:59:08 +00:00
Rossen Stoyanchev b5bcfa0ae3 SPR-8858 Fix in AntPathMatcher.combine(..)
Currently the combine method consolidates "/*" and "/hotel" 
into "/hotel". However if the first pattern contains URI template 
variables, the consolidation seems wrong. The fix is to prevent
the consolidation if the first pattern contains "{".
2011-11-23 17:53:18 +00:00
Rossen Stoyanchev e695a21688 SPR-8862 Fix issue with matching negated header values. 2011-11-23 15:23:55 +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 e4fada56ab SPR-8859 Fix issue with prototype controllers in RequestMappingHandlerAdapter. 2011-11-18 11:32:01 +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