Commit Graph

534 Commits

Author SHA1 Message Date
Rossen Stoyanchev d3a87a13f7 Polish 2014-07-01 16:10:00 -04:00
Arjen Poutsma f6fbdafb6a Introduce RequestEntity and builder
This commit introduces the RequestEntity, a class similar to
ResponseEntity, but meant for HTTP requests rather than responses. The
RequestEntity can be used both in RestTemplate as well as @MVC
scenarios.

The class also comes with a builder, similar to the one found in
ResponseEntity, which allows for building of a RequestEntity through a
fluent API.

Issue: SPR-11752
2014-07-01 16:10:00 -04:00
Juergen Hoeller ba522e5e55 Package javadoc cleanup for web.servlet.mvc, removing outdated references
Issue: SPR-11935
2014-07-01 17:26:27 +02:00
Juergen Hoeller cc917de24d Polishing 2014-06-26 11:44:07 +02:00
Juergen Hoeller 779ca99f38 SelectTag consistently checks specified 'multiple' attribute now, never falling back to forceMultiple in case of user-provided value
Issue: SPR-11903
2014-06-25 12:36:51 +02:00
Brian Clozel 13c4a0396d Refactor VersionResourceResolver in strategies
Prior to this commit, one of the available strategies for resolving
resources was the PrefixResourceResolver. Reconsidering the core goal of
this resolver and the FingerprintResourceResolver, we found that the
true core feature is versioning static resources application-wide.

This commit refactors both Resolvers by:
* having only on VersionResourceResolver
* that resolver takes a mapping of paths -> VersionStrategy
* provided VersionStrategy implementations are ContentBasedVS
  (previously FingerprintRR), FixedVS (previously PrefixRR)

One can add a VersionResourceResolver like this:

  Map<String, VersionStrategy> versionStrategies = new HashMap<>();
  versionStrategies.put("/**/*.js", new PrefixVersionStrategy("prefix"));
  versionStrategies.put("/**", new ContentBasedVersionStrategy());

  VersionResourceResolver versionResolver = new VersionResourceResolver();
  versionResolver.setVersionStrategyMap(versionStrategies);

  List<ResourceResolver> resolvers = new ArrayList<ResourceResolver>();
  resolvers.add(versionResolver);
  resolvers.add(new PathResourceResolver());

Issue: SPR-11871
2014-06-24 18:18:05 +02:00
Juergen Hoeller 18131bf611 Consistent declaration of private static final logger variables
Issue: SPR-11905
2014-06-24 14:02:05 +02:00
Rossen Stoyanchev 0dc6082b01 Support java.util.Optional for @MVC named value args
After this change, java.util.Optional is supported with @RequestParam,
@RequestHeader, and @MatrixVariable arguments in Java 8. When Optional
is used the required flag is effectively ignored.

Issue: SPR-11829
2014-06-16 14:16:56 -04:00
Brian Clozel 72baa9bf27 Ignore external resources in CssLinkResourceTransormer
Prior to this commit, the CssLinkResourceTransformer would transform
"external resources", i.e. resources not served by the web application.

This commit only allows transformation for resources which path don't
contain scheme such as "file://" or "http://". Only relative and
absolute paths for resources served by the webapp are valid.

Issue: SPR-11860
2014-06-12 10:54:41 +02:00
Rossen Stoyanchev 9f4d4d1829 Check X-Forwarded-Host in ServletUriComponentsBuilder
Issue: SPR-11855
2014-06-11 22:40:48 -04:00
Brian Clozel 80a16c6d10 PathMatching options:configure all HandlerMappings
Since SPR-11486 and SPR-10163, Path Matching options can be configured
to customize path matching options for RequestMappingHandlerMapping.
Prior to this commit, the defined pathMatcher and pathHelper instances
were only used in RequestMappingHandlerMapping.

This commit now registers pathMatcher and pathHelper beans under
well-known names and share them with several HandlerMappings beans,
such as ViewControllerMappings and ResourcesMappings.

Issue: SPR-11753
2014-06-11 17:07:04 +02:00
Rossen Stoyanchev 6b129c52e3 Add "mvcUrl" function to Spring tag library
This commit adds a new function to the Spring tag library for preparing
links to @Controller methods. For more details see the Javadoc of
MvcUriComponentsBuilder.fromMappingName.

Issue: SPR-5779
2014-06-10 18:11:11 -04:00
Rossen Stoyanchev 2140648246 Fix failing test 2014-06-10 15:03:17 -04:00
Rossen Stoyanchev 5b02222a9f Add resolveTemplate method to Groovy markup configurer 2014-06-10 11:59:11 -04:00
Brian Clozel 0ecfa8e404 Add Spring View support for Groovy Markup Templates
This commit adds support for Groovy Markup templates.
Spring's support requires Groovy 2.3.1+.

To use it, simply create a GroovyMarkupConfigurer and a
GroovyMarkupViewResolver beans in the web application context.

Issue: SPR-11789
2014-06-10 11:37:53 -04:00
Rossen Stoyanchev 0cb6f8c88c Polish MappingJackson2JsonView 2014-06-09 09:39:17 -04:00
Sebastien Deleuze 5dc27ee134 Add JSONP support to MappingJackson2JsonView
Enable JSONP support by wrapping the JSON output into
a callback when a JSONP query parameter specifying the
function name to use as callback is detected.

Default query parameter names recognized as JSONP ones
are "jsonp" and "callback". This list can be customized if
needed.

This commit also fixes JSONView support by removing
the view name specified in the model from the output.

Issue: SPR-8346
2014-06-09 09:39:17 -04:00
Rossen Stoyanchev de1a41ac27 Fix issue with RequestBody(required=true)
Issue: SPR-11828
2014-06-06 12:07:14 -04:00
Juergen Hoeller f7b465390c Moved @Uses annotations to org.springframework.lang; fixed Base64Utils to declare Java 8, and fixed PathResource's declaration to refer to Java 7.
Issue: SPR-11604
2014-06-04 21:34:23 +02:00
Rossen Stoyanchev c9d0ebd730 Rename ResponseBodyInterceptor to ResponseBodyAdvice
Issue: SPR-10859
2014-05-30 17:02:28 -04:00
Rossen Stoyanchev 2655c507e0 Parameterize ResponseBodyInterceptor on the type level
Issue: SPR-10859
2014-05-30 17:02:28 -04:00
Juergen Hoeller e4aabd5288 MarshallingView unwraps JAXBElement value for Marshaller.supports(Class) check
Issue: SPR-11827
2014-05-30 17:27:34 +02:00
Juergen Hoeller 4e17685008 Made transform test pass on Windows 2014-05-30 17:27:14 +02:00
Rossen Stoyanchev 3944f7ad97 Fix animalSniffer warning 2014-05-27 21:27:35 -04:00
Rossen Stoyanchev 6966e89578 Add ResourceTransformer and CSS link implementation
This change adds a ResourceTransformer that can be invoked in a chain
after resource resolution. The CssLinkResourceTransformer modifies a
CSS file being served in order to update its @import and url() links
(e.g. to images or other CSS files) to match the resource resolution
strategy (e.g. adding MD5 content-based hashes).

Issue: SPR-11800
2014-05-27 20:54:22 -04:00
Rossen Stoyanchev e3a6fce403 Add Gson converter to MVC config
Issue: SPR-9488
2014-05-22 22:23:00 -04:00
Rossen Stoyanchev 1338d46a6e Add JSONP support for MappingJackson2MessageConverter
Issue: SPR-9899
2014-05-20 12:13:44 -04:00
Juergen Hoeller 61b47ba7d9 Consistent MvcUriComponentsBuilder assertion handling 2014-05-20 01:43:01 +02:00
Juergen Hoeller 73c9d09024 UriComponentsBuilder.toUriString instead of RequestContext.getMvcUrl (breaking cyclic dependency between web.servlet.support and web.servlet.mvc) 2014-05-20 00:35:09 +02:00
Rossen Stoyanchev 51fc3b4aaf Refactor @JsonView support w/ ResponseBodyInterceptor
The newly added support for ResponseBodyInterceptor is a good fit for
the (also recently added) support for the Jackson @JsonView annotation.

This change refactors the original implementation of @JsonView support
for @ResponseBody and ResponseEntity controller methods this time
implemented as an ResponseBodyInterceptor.

Issue: SPR-7156
2014-05-19 15:47:16 -04:00
Rossen Stoyanchev 96b18c8dc2 Add ResponseBodyInterceptor
This change introduces a new ResponseBodyInterceptor interface that can
be used to modify the response after @ResponseBody or ResponseEntity
methods but before the body is actually written to the response with the
selected HttpMessageConverter.

The RequestMappingHandlerAdapter and ExceptionHandlerExceptionResolver
each have a property to configure such interceptors. In addition both
RequestMappingHandlerAdapter and ExceptionHandlerExceptionResolver
detect if any @ControllerAdvice bean implements ResponseBodyInterceptor
and use it accordingly.

Issue: SPR-10859
2014-05-19 15:47:16 -04:00
Juergen Hoeller ea88bc2c81 Servlet/PortletResponse supported as a resolvable dependency now (in particular for web controllers)
This feature required support for response exposure on Servlet/PortletRequestAttributes, instead of just in the Servlet/PortletWebRequest subclasses.

Issue: SPR-11795
2014-05-16 18:06:29 +02:00
Sebastien Deleuze be0b69cbf1 Add support for Jackson serialization views
Spring MVC now supports Jackon's serialization views for rendering
different subsets of the same POJO from different controller
methods (e.g. detailed page vs summary view).

Issue: SPR-7156
2014-05-15 23:03:33 -04:00
Juergen Hoeller e04fb15a5e Compilation compatibility with JasperReports 5.5.2 2014-05-12 20:34:38 +02:00
Juergen Hoeller 782d10c66f JasperReports-related polishing 2014-05-12 20:27:53 +02:00
Rossen Stoyanchev 426b77b834 Support path segment URI var expansion in UrlTag
Before this change UrlTag expanded URI vars and encoded them using
UriUtils.encodePath.

This change makes it possible to expand using
UriUtils.encodePathSegment, which means a "/" is encoded as "%2F".

To expand with path segment semantics, prefix the URI var name "/":

<spring:url value="/url/path/{/var}">
    <spring:param name="var" value="my/Id" />
</spring:url>

Issue: SPR-11401
2014-05-06 19:41:17 -04:00
Rossen Stoyanchev 9d479feadd Add naming strategy for @MVC request mappings.
This change adds a strategy for assigning a default name to an
@RequestMapping controller method. The @RequestMapping annotation
itself now has a name attribute allowing the explicit assignment
of a mapping name.

This is mainly intended for use in EL expressions in views. The
RequestContext class now provides a getMvcUrl method that internally
delegates to MvcUriComponents to look up the handler method.

See the Javadoc of MvcUriComponents.fromMappingName.

Issue: SPR-5779
2014-05-06 15:27:53 -04:00
Rossen Stoyanchev cb2834c10a Fix compile error 2014-05-01 13:40:23 -04:00
Rossen Stoyanchev 676282c66e Support ListenableFuture on @RequestMapping methods
Issue: SPR-11695
2014-05-01 12:28:59 -04:00
Rossen Stoyanchev 0d2aa51576 Update ContentNegotiationManager for unknown path exts
This change refines the logic of "mapping" content negotiation
strategies with regards to how to handle cases where no mapping is
found.

The request parameter strategy now treats request parameter values that
do not match any mapped media type as 406 errors.

The path extension strategy provides a new flag called
"ignoreUnknownExtensions" (true by default) that when set to false also
results in a 406. The same flag is also exposed through the
ContentNegotiationManagerFactoryBean and the MVC Java config.

Issue: SPR-10170
2014-05-01 12:03:06 -04:00
Stephane Nicoll bd85c916eb Integrate animal sniffer
Animal sniffer provides tools to assist verifying that classes
compiled with a newer JDK are compatible with an older JDK.

This integratesthe latest version of the tool (1.11) that
permits the use of custom annotations. Added @UsesJava7,
@UsesJava8 and @UsesSunHttpServer and annotated the few places
where we rely on a specific environment.

The verification process can be invoked by running the 'sniff'
task.

Issue: SPR-11604

polishing
2014-04-30 13:51:01 +02:00
Sebastien Deleuze 59a050f3b9 Include more guidance about DispatcherServlet context
Also update <mvc:annotation-driven /> comment in XSD.

Issue: SPR-11703
2014-04-28 22:07:55 -04:00
Rossen Stoyanchev 1f630a5fb9 Add CachingResourceResolver 2014-04-25 16:49:49 -04:00
Rossen Stoyanchev e24b876164 Remove "Public" from the ResourceUrlProvider name
Also respect HandlerMapping order in ResourceUrlProvider
2014-04-25 16:49:32 -04:00
Brian Clozel 564a555619 Fix NPE in PrefixResourceResolver
The ResourceResolverChain can return null, so PrefixResourceResolver
should be skipped in that case.
2014-04-25 15:15:53 +02:00
Rossen Stoyanchev f5cbd9aa4a Switch to vararg for configuring ResourceResolver's 2014-04-25 00:01:24 -04:00
Brian Clozel c4843577ba Fix PrefixResourceResolver implementation
The configured prefix should not begin with a "/", since
PublicResourceUrlProvider is already taking path mapping into account
when resolving resources and URLs.
2014-04-24 14:43:26 +02:00
Juergen Hoeller ec7d80b851 Polishing 2014-04-23 23:03:47 +02:00
Rossen Stoyanchev b1158aa913 Polish logging in resource handling 2014-04-23 15:43:39 -04:00
Juergen Hoeller 5b47816183 DispatcherServlet skips multipart resolution if error page exception attribute indicates MultipartException as root cause
Issue: SPR-11716
2014-04-23 14:36:14 +02:00
Rossen Stoyanchev 10e1a80540 Update Javadoc for PublicResourceUrlProvider 2014-04-22 11:34:46 -04:00
Sam Brannen 3d18cfeab6 Polish static resource handling mechanism
- ResourceResolver and ResourceResolverChain now have a consistent API
  with regard to method names and terminology.

- ResourceResolver and ResourceResolverChain now accept
  List<? extends Resource> instead of List<Resource> for simplified
  programmatic use.

- Improved Javadoc across the package.

- Formatted code to align with standards.

- Removed all references to ResourceUrlPathTranslator.

Issue: SPR-10933
2014-04-22 10:48:12 -04:00
Stephane Nicoll 5559209233 Remove useless imports 2014-04-22 09:57:12 +02:00
Sam Brannen 5365171f24 Fix Javadoc formatting in ResourceHttpRequestHandler 2014-04-22 00:53:34 -04:00
Rossen Stoyanchev 6cb9a144db Expand static resource handling mechanism
An initial commit with expanded support for static resource handling:

- Add ResourceResolver strategy for resolving a request to a Resource
  along with a few implementations.

- Add PublicResourceUrlProvider to get URLs for client-side use.

- Add ResourceUrlEncodingFilter and
  PublicResourceUrlProviderExposingInterceptor along with initial
  MVC Java config support.

Issue: SPR-10933
2014-04-16 23:42:44 -04:00
Juergen Hoeller 8d8766dda9 SelectTag correctly detects multiple="true" again
Issue: SPR-11678
2014-04-09 17:42:32 +02:00
Juergen Hoeller 8006696613 Revised ByteArrayOutputStream handling in MarshallingView and co
Issue: SPR-11646
2014-04-02 20:57:09 +02:00
Juergen Hoeller 3a96f16654 ResourceHttpRequestHandler explicitly closes a Resource's InputStream
Issue: SPR-11644
2014-04-02 20:54:12 +02:00
Sam Brannen 6aaae7e258 Execute as many Jasper Reports tests in IDE as possible
Previously, the use of Assume.group(CUSTOM_COMPILATION) in
AbstractJasperReportsTests excluded all JR tests when executing in the
IDE (e.g., Eclipse). This commit executes the assumption only where
necessary.
2014-03-28 14:06:00 +01:00
Sam Brannen db66ef0f6f Clean up warnings in spring-webmvc 2014-03-28 13:34:43 +01:00
Juergen Hoeller ea1e27efa2 Require Jackson 2.0+, EhCache 2.5+, Quartz 2.1.4+
Issue: SPR-11262
2014-03-27 21:59:23 +01:00
Rossen Stoyanchev e92bbc8014 Revert "Improve suffix pattern check"
This reverts commit 3474afb165.

Unfortunately this change is likely to cause issues for applications
that use regular expressions in a URI variable. I think we will have
to leave at: if there are any dots in the last segment of the
request path, regardless of whether they're in a URI var or not,
the suffix pattern match is off.

Issue: SPR-11532
2014-03-26 11:37:11 -04:00
Juergen Hoeller 074590730b Polishing 2014-03-25 00:54:02 +01:00
Juergen Hoeller 465ca24ab2 DispatcherServlet logs request URI in encoded form only
Issue: SPR-11591
2014-03-24 23:26:05 +01:00
Juergen Hoeller dd7f54c3c0 Revised ResizableByteArrayOutputStream as an actual subclass of ByteArrayOutputStream, and consistently applied appropriate ByteArrayOutputStream initial capacities across the codebase
Issue: SPR-11594
2014-03-24 22:57:38 +01:00
Juergen Hoeller c10eeb414c Polishing 2014-03-24 14:37:08 +01:00
Juergen Hoeller 7399723165 Introduced getFlashMapsMutex template method and optimized SessionFlashMapManager's locking
SessionFlashMapManager also clears the session attribute now when the given FlashMap List is empty.

Issue: SPR-11538
2014-03-24 11:16:56 +01:00
Juergen Hoeller 0af6e1bb1b MVC handler method detection ignores scoped targets in favor of proxies
Issue: SPR-11548
2014-03-24 11:02:03 +01:00
Stephane Nicoll 4cd818b9e4 Harmonize log configuration
Prior to this commit, the codebase was using a mix of log4j.xml
and log4j.properties for test-related logging configuration. This
can be an issue as log4j takes the xml variant first when looking
for a default bootstrap configuration.

In practice, some modules declaring the properties variant were
taking the xml variant configuration from another module.

The general structure of the configuration has also been
harmonized to provide a standard console output as well as an
easy way to enable trace logs for the current module.
2014-03-20 09:43:29 -07:00
Juergen Hoeller e0757e7ed6 Detect ControllerAdvice beans in ancestor contexts as well
Issue: SPR-11570
2014-03-18 22:29:50 +01:00
Juergen Hoeller 189cd663c5 Polishing 2014-03-15 00:46:06 +01:00
Juergen Hoeller 791f58e6be Polishing 2014-03-13 17:31:39 +01:00
Rossen Stoyanchev 3474afb165 Improve suffix pattern check
After this change dots inside URI variables in a request mapping
pattern are ignored and no longer considered an indication that
the pattern contains a suffix itself.

Issue: SPR-11532
2014-03-12 16:42:16 -04:00
Juergen Hoeller 4d3ca4319e Polishing 2014-03-11 22:09:46 +01:00
Rossen Stoyanchev 0036d9a5c9 Polish 2014-03-06 12:28:06 -05:00
Sebastien Deleuze 2f8bc6eec1 Decode target parameter names prior to saving a FlashMap
In addition to the target parameter values (SPR-9657), the target
parameter names must also be decoded to be able to match
them to the parameter names of incoming requests.

Issue: SPR-11504
2014-03-06 11:56:28 -05:00
Sam Brannen 9891bdc7b4 Clean up "abstract" test issues
- Deleted empty AbstractWebSocketClientTests class.

 - AbstractServletHandlerMethodTests and AbstractHttpRequestTests are
   now actually declared as abstract.

 - The following classes are not abstract but currently have an
   "Abstract" prefix and therefore get ignored by the Gradle build.
   This commit renames each of these by deleting the "Abstract" prefix.

   - AbstractFlashMapManagerTests
   - AbstractMappingContentNegotiationStrategyTests
   - AbstractSockJsServiceTests
   - AbstractWebSocketHandlerRegistrationTests
2014-03-05 12:41:26 +01:00
Rossen Stoyanchev 035bac025a Use unique names when auto-registering Filters
AbstractDispatcherServletInitializer now adds a unique suffix to a
filter name if it fails to register it.

Issue: SPR-11493
2014-02-28 09:56:46 -05:00
Brian Clozel fc05df0f14 Expose path matching settings in MVC Java config
Prior to this commit, one had to provide her own
RequestMappingHandlerMapping instance (i.e extend
WebMvcConfigurationSupport and override the requestMappingHandlerMapping
method) in order to customize path matching properties on that bean.

Since SPR-10163, XML config users can do that using the
<mvc:path-matching/> XML tag. This commit adds the same feature to MVC
Java config with a PathMatchConfigurer.

Issue: SPR-11486
2014-02-28 15:50:01 +01:00
Rossen Stoyanchev 801237aec1 Add getMatchingPatterns method to Patterns condition
Issue: SPR-11484
2014-02-27 16:27:40 -05:00
Juergen Hoeller 8a96d1a6ee Polishing 2014-02-14 23:40:03 +01:00
Juergen Hoeller 14e5a02870 Mixed polishing along with recent changes 2014-02-14 21:39:40 +01:00
Juergen Hoeller 9c6df766cd Related polishing
Issue. SPR-11428
2014-02-14 21:38:44 +01:00
Juergen Hoeller f913940402 Avoid unnecessary getMappingForMethod repeat (in particular for RequestMappingInfo)
Issue. SPR-11428
2014-02-14 20:48:40 +01:00
Juergen Hoeller 72fe7ebc34 Objects with multi-threaded access should not lazily populate a hash field
Issue. SPR-11428
2014-02-14 20:46:34 +01:00
Juergen Hoeller 34d397efa9 Restored original detectHandlerMethods call chain for backwards compatibility with custom subclasses (such as in Spring Integration) 2014-02-14 01:30:16 +01:00
Rossen Stoyanchev 741b4b229a Add encoding for the default action in FormTag
Issue: SPR-11426
2014-02-13 14:36:12 -05:00
Rossen Stoyanchev 0cb27f4bc5 Allow HttpMethod as a controller method argument
Issue: SPR-11425
2014-02-13 12:16:24 -05:00
Juergen Hoeller 0ec99fdef7 Polishing 2014-02-12 18:36:04 +01:00
Juergen Hoeller 6f58491b9c MarshallingView explicitly skips BindingResult when searching for a model object
Just implementing common custom subclass behavior out-of-the-box...

Issue: SPR-11417
2014-02-12 18:35:36 +01:00
Juergen Hoeller 4a45af0038 AbstractHandlerMethodMapping should reuse BeanFactory.getType result 2014-02-12 00:11:36 +01:00
Juergen Hoeller 5f1592a61a Consistently avoid close() call on Servlet OutputStream
Issue: SPR-11413
2014-02-11 23:42:37 +01:00
Juergen Hoeller 648245b200 MarshallingView should not close response OutputStream after copying to it
Also throws IllegalStateException instead of ServletException now, consistent with other Spring MVC classes.

Issue: SPR-11411
2014-02-11 23:41:09 +01:00
Sam Brannen ac22b786be Delete unused imports 2014-02-09 18:58:41 +01:00
Juergen Hoeller 57c4eca039 Revised ExcelViewTests 2014-02-09 01:34:34 +01:00
Juergen Hoeller 53aab24690 Polishing 2014-02-09 01:08:56 +01:00
Sam Brannen 1f778530b5 Polish test classes
- Consistent importing of org.junit.Assert.*;
- Proper declaration of expected exceptions via @Test(expected).
- Renamed SpEL ExpressionTestCase to AbstractExpressionTests.
- Formatting and test method naming conventions.
2014-02-08 17:24:11 +01:00
Sam Brannen f717b55035 Fix test bug related to legacy JUnit AssertionFailedError
AssertionFailedError was thrown by JUnit 3.8. Since RedirectViewTests
has been upgraded to JUnit 4, now standard java.lang.AssertionErrors are
thrown. Thus, attempting to catch an AssertionFailedError is futile.

Of course, since these tests have not been failing, it is likely a moot
point, but changing the try-catch blocks to catch a possible
AssertionError can't be a bad thing.
2014-02-08 16:14:26 +01:00
Rossen Stoyanchev 42d0470d94 Improve expanding in MvcUriComponentsBuilder
Before this change MvcUriComponentsBuilder could not create a
UriComponentsBuilder for methods where the mapping has a URI variable
and no matching method argument for it.

For example a URI variable may be in the type-level mapping but not
all methods may have an @PathVariable argument for it.

This fix addresses the shortcoming such that MvcUriComponentsBuilder
expands the method argument values available to it and leaves remaining
URI variables to be further expanded via UriComponents.expand().

Issue: SPR-11391
2014-02-06 16:55:19 -05:00
Rossen Stoyanchev bdb742b8db Polish MvcUriComponentsBuilder
Issue: SPR-11391
2014-02-06 16:55:19 -05:00
Juergen Hoeller 09e2e5897d Removed outdated hibernate3 references across the codebase
Issue: SPR-9028
2014-02-06 22:15:59 +01:00
Juergen Hoeller 8c4e372558 Introduced SpringNamingPolicy for CGLIB
Issue: SPR-11398
2014-02-06 20:25:11 +01:00
Sebastien Deleuze 261a863e8f Fix EvalTagTests with locales other than english
Fix testPrintFormattedScopedAttributeResult test in org.springframework.web.servlet.tags.EvalTagTests class by making an assertion which is not locale dependent.

Issue: SPR-11392
2014-02-05 18:01:57 +01:00
Juergen Hoeller 4f60b98bca Consistent iteration over actualValue in Velocity and FreeMarker macros
This requires consistent exposure of an actualValue in BindStatus, even if no BindingResult available.

Issue: SPR-10837
2014-01-31 22:39:20 +01:00
Juergen Hoeller 1e303ac1af Polishing 2014-01-28 14:44:44 +01:00
Brian Clozel cc0a845653 Support Part/MultiPartFile arrays in ArgumentResolvers
Prior to this commit, parts of a multipart HTTP request could be
injected in @RequestPart and @RequestParam annotated arguments, when
using types:
* MultipartFile, Collection<MultiPartFile>
* javax.servlet.Part, Collection<Part>

This commits updates @RequestParam and @RequestPart argument resolvers
and now allows the array versions of those types:
* Part[]
* MultiPartFile[]

Note that the MockHtpServletRequest backing tests for standard
Servlets implementations now uses a MultiValueMap to store parts
(versus a simple hashmap).

Issue: SPR-11353
2014-01-27 18:09:29 +01:00
Juergen Hoeller bb28d198f5 Polishing 2014-01-26 01:04:21 +01:00
Juergen Hoeller 56b7d7a94a Consistently declare @SuppressWarnings("serial") instead of dummy serialVersionUID 2014-01-26 00:11:11 +01:00
Juergen Hoeller 21eb8db5bc Polishing
Issue: SPR-11357
2014-01-24 18:30:31 +01:00
Rossen Stoyanchev ab5f1256bf Allow consolidating config in root context with Java
This change makes it possible to provide no configuration for the
DispatcherServlet when extending
AbstractAnnotationConfigDispatcherServletInitializer, and therefore
provide all config through the "root" context.

Issue: SPR-11357
2014-01-24 11:09:12 -05:00
Juergen Hoeller 12c393eb6d Switched 'order' attributes across namespaces to 'xsd:token'
Issue: SPR-10886
Issue: SPR-7342
2014-01-22 11:35:21 +01:00
Brian Clozel eac4881809 Make RequestMappingHandlerMapping xml config easier
Prior to this commit, it was necessary to override
the HandlerMapping definition to change properties
like useSuffixPatternMatch, useSuffixPatternMatch...
Also, one couldn't set custom pathmatcher/pathhelper
on RequestMappingHandlerMapping via XML configuration.

This commits adds a new "mvc:annotation-driven"
subelement called "mvc:path-matching" for the tag
that allows to configure such properties:
* suffix-pattern
* trailing-slash
* registered-suffixes-only
* path-matcher
* path-helper

Note: this is a new take on this issue, since
96b418cc has been reverted by e2b99c3.

Issue: SPR-10163
2014-01-21 09:35:36 +01:00
Brian Clozel 8edb7a18cc Revert previous impl for SPR-10163
This reverts commit 96b418cc8a,
"Make RequestMappingHandlerMapping xml config easier".

This implementation makes the mvc:annotation namespace less readable,
and future configuration items would add even more to this namespace.

Issue: SPR-10163
2014-01-21 09:35:36 +01:00
Rossen Stoyanchev 17e492e641 Polish
Issue: SPR-11129
2014-01-20 21:48:57 -05:00
Stephane Nicoll 7df25764af Allow HttpHeaders return values for @MVC methods
Allow HttpHeader instances to be returned directly from MVC controller
methods managed by HandlerMethodReturnValueHandler rather than needing
to be wrapped in a ResponseEntity.

Issue: SPR-11129
2014-01-20 21:48:57 -05:00
Phillip Webb b92e4299b8 Upgrade to jexcelapi 2.6.12 and fix test failures
Upgrade to the latest release of jexcelapi and work-around the
ArrayIndexOutOfBounds test exception on *nix machines.

Issue: SPR-11334
2014-01-20 16:52:15 -08:00
Juergen Hoeller 96d6963d61 Deprecated AbstractJExcelView since JExcelAPI is an abandoned project
JXL had no release since 2009, and has some serious bugs remaining: e.g. JXL on Unix cannot read template files created on Windows, using the 'latest' JXL 2.6.12 release.
2014-01-21 01:22:43 +01:00
Juergen Hoeller 8281b93596 General ExcelViewTests code update
Issue: SPR-11334
2014-01-21 00:20:54 +01:00
Juergen Hoeller 5e5add4862 Locale/ThemeChangeInterceptor alignment and javadoc polishing
Issue: SPR-11128
2014-01-20 21:49:36 +01:00
Juergen Hoeller cc81aae8c1 Consistent evaluation of empty theme names to default theme name
Issue: SPR-11128
2014-01-20 21:49:28 +01:00
Brian Clozel 96b418cc8a Make RequestMappingHandlerMapping xml config easier
Prior to this commit, it was necessary to override
the HandlerMapping definition to change properties
like useSuffixPatternMatch, useSuffixPatternMatch...

This commits adds new attributes on the
mvc:annotation-driven XML tag that allows to configure
such flags:
* use-suffix-pattern-match
* use-trailing-slash-match
* use-registered-suffix-pattern-match

Issue: SPR-10163
2014-01-17 11:21:25 +01:00
Juergen Hoeller 444b3720bc Added tests for context initializers on DispatcherServlet
Issue: SPR-11314
2014-01-16 00:04:07 +01:00
Juergen Hoeller 91881ff036 Introduced "globalInitializerClasses" next to the existing "contextInitializerClasses", applying to FrameworkServlets as well
Issue: SPR-11314
2014-01-15 22:21:27 +01:00
Erik van Paassen 070c5c3d33 Fixed a typo in RequestMappingHandlerMapping.java 2014-01-14 14:28:19 -05:00
Juergen Hoeller 5d3484c74a Upgraded Tiles2 TilesContainer to Tiles 2.2.2 (following the Spring 4.0 baseline)
In sync with our Tiles3 TilesContainer implementation now, as far as possible.

Issue: SPR-11285
2014-01-06 00:19:36 +01:00
Juergen Hoeller 3948727b13 Polishing 2014-01-03 23:14:50 +01:00
Rossen Stoyanchev de280b01fe Support custom PathMatcher for MappedInterceptor's
Issue: SPR-11197
2014-01-03 16:44:01 -05:00
Brian Clozel b9c8f47b01 Use OptionalValidatorFactoryBean in Configurers
Configurers and BeanDefinitionParsers should use
OptionalValidatorFactoryBean instead of
LocalValidatorFactoryBean.

The Optional implementation catches and logs setup
exceptions, useful when a validation API is present on
the classpath but not the actual implementation.

Issue: SPR-11272
2014-01-03 22:36:56 +01:00
Juergen Hoeller 6a5a3c97ed Introduced OptionalValidatorFactoryBean for scenarios where the JSR-303 API is present but no Bean Validation Provider is available (used by the MVC namespace)
Issue: SPR-11272
2014-01-03 18:18:55 +01:00
Juergen Hoeller 8d1e55d101 Avoid hard reference to LocalValidatorFactoryBean in <mvc:annotation-driven> parser
Issue: SPR-11272
(cherry picked from commit c48da0d)
2014-01-03 16:38:22 +01:00
Juergen Hoeller 6aabb5f17e Support varargs for DomUtils.getChildElementsByTagName
Issue: SPR-11272
(cherry picked from commit e334489)
2014-01-03 16:18:48 +01:00
Brian Clozel 1c83e8653a Switch to Jackson 2 in unit tests
Prior to this commit, some unit tests were using
Spring's Jackson 1.x implementations. Now Jackson
2.x implementations are the default ones used in
unit tests.

Even if Jackson 1.x support is deprecated, Jackson 1.x
unit tests are kept.

Issue: SPR-11121
2014-01-03 09:50:43 +01:00
Juergen Hoeller bc3064cbb7 Polishing 2013-12-20 01:28:40 +01:00
Juergen Hoeller 2faf008c2e Polishing
Issue: SPR-11225
2013-12-19 23:08:18 +01:00
Juergen Hoeller 11fb12b920 Fixed AbstractMessageConverterMethodArgumentResolver's type variable resolution
Issue: SPR-11225
2013-12-19 23:04:23 +01:00
Juergen Hoeller 260bbe319d Fixed accidental use of Java 8 getParameterCount(), plus polishing of related classes
Issue: SPR-11245
2013-12-18 18:08:32 +01:00
Phillip Webb f57c4a09ee Polish 2013-12-10 21:13:11 -08:00
Rossen Stoyanchev 5f38996cd6 Add methods for static resolution of @ExceptionHandler 2013-12-09 08:19:17 -05:00
Rossen Stoyanchev 7713a55f6b Add test case for multivalue x-forwarded host header
Issue: SPR-11140
2013-12-03 09:24:40 -05:00
Juergen Hoeller 2a52decbbc Polishing (including removal of javadoc imports that show as package cycles in IntelliJ) 2013-12-02 23:57:00 +01:00
Phillip Webb 5e02a6dda3 Fix casing in spring mvc namespace attributes
Update "enableMatrixVariables" and "ignoreDefaultModelOnRedirect" to
use the more conventional XML form "enable-matrix-variables" and
"ignore-default-model-on-redirect".

Both forms are now supported by `AnnotationDrivenBeanDefinitionParser`,
with newer names being defined in the 4.0 XSD and the older names
remaining in the 3.2 XSD.

Issue: SPR-11136
2013-12-02 12:28:56 -08:00
Phillip Webb 043a41e382 Consistent whitespace after imports
Update code to have a consistent number of new-line characters after
import statements.
2013-11-26 15:14:43 -08:00
Phillip Webb 15698860e1 General polish of new 4.0 classes
Apply consistent styling to new classes introduced in Spring 4.0.

- Javadoc line wrapping, whitespace and formatting
- General code whitespace
- Consistent Assert.notNull messages
2013-11-26 15:11:18 -08:00
Phillip Webb a31ac882c5 Fix various javadoc warnings 2013-11-26 13:25:37 -08:00
Eric Dahl e9f78f6043 Fix various typos
Fix a variety of typos throughout the project, primarily in
comments (javadoc or otherwise) but also in a handful of log messages
and a couple exception messages.

ISSUE: SPR-11123
2013-11-25 15:58:27 -08:00
Phillip Webb 59002f2456 Fix remaining compiler warnings
Fix remaining Java compiler warnings, mainly around missing
generics or deprecated code.

Also add the `-Werror` compiler option to ensure that any future
warnings will fail the build.

Issue: SPR-11064
2013-11-25 12:52:42 -08:00
Juergen Hoeller 0de112198e Rely on presence of Servlet 2.5's ServletContext.getContextPath() 2013-11-20 14:50:32 +01:00
Brian Clozel cc4faa5990 Fix standard multipart binding + Polish
Fixing standard multipart binding when multiple parts share
the same name.

Uncomment previously @Ignored tests now that Jetty supports
Servlet 3.0 spec.

Issue: SPR-10591
2013-11-19 17:13:31 -08:00
Rossen Stoyanchev b5bd4d8a8a Add div around extra hidden fields in FormTag
Issue: SPR-10926
2013-11-05 20:45:50 -05:00
Rossen Stoyanchev 18b69903ca Return 415 on bad request body content-type
Issue: SPR-10982
2013-11-05 15:38:55 -05:00