Commit Graph

795 Commits

Author SHA1 Message Date
Juergen Hoeller b5763fe326 Consistent attribute documentation/formatting in spring-context and spring-mvc schemas 2014-08-20 16:36:12 +02:00
Juergen Hoeller 891335a604 FlashMap's equals implementation needs to call super.equals(...) as well 2014-08-19 23:29:12 +02:00
Rossen Stoyanchev 1ca0460534 Add equals/hashcode to FlashMap
Brings consistency with the existing compareTo implementation.
2014-08-19 16:00:55 -04:00
Rossen Stoyanchev bb8be509cd Remove return statements in finally blocks 2014-08-19 15:27:59 -04:00
Rossen Stoyanchev 0e49040707 Fix hashcode/equals issue in HeadersRequestCondition 2014-08-19 15:16:41 -04:00
Sebastien Deleuze 6665634675 Support Jackson based XML serialization/deserialization
This commit adds support for XML serialization/deserialization based on
the jackson-dataformat-xml extension. When using @EnableWebMvc or
<mvc:annotation-driven/>, Jackson will be used  by default instead of JAXB2
if jackson-dataformat-xml classes are found in the classpath.

This commit introduces MappingJackson2XmlHttpMessageConverter and
MappingJackson2XmlView classes, and common parts between JSON
and XML processing have been moved to AbstractJackson2HttpMessageConverter
and AbstractJackson2View classes.

MappingJackson2XmlView supports serialization of a single object. If the model
contains multiple entries, MappingJackson2XmlView.setModelKey() should be
used to specify the entry to serialize.

Pretty print works in XML, but tests are not included since a Woodstox dependency
is needed, and it is better to continue testing spring-web and spring-webmvc
against JAXB2.

Issue: SPR-11785
2014-08-13 16:22:58 +02:00
Juergen Hoeller 92bd240474 Polishing
Issue: SPR-12079
2014-08-13 15:04:58 +02:00
Juergen Hoeller 626a5fe4eb BeanNameViewResolver ignores non-View beans
Issue: SPR-12079
2014-08-13 14:57:40 +02:00
Phillip Webb ac8326d2df Polish mockito usage
Consistent use of BDDMockito rather than standard Mockito.
2014-08-11 16:23:11 -07:00
Juergen Hoeller 4db258b9e3 Polishing 2014-08-11 22:32:03 +02:00
Juergen Hoeller 7c57424b48 Tiles 3 TilesViewResolver allows for specifying custom TilesView subclasses as well
Issue: SPR-12075
2014-08-10 01:08:27 +02:00
Juergen Hoeller a05b748d42 InternalResourceViewResolver's exposure of context beans is now available at UrlBasedViewResolver level
Issue: SPR-8064
2014-08-10 00:54:42 +02:00
Juergen Hoeller ad475ffadf Consistent vararg declarations for String array setters 2014-08-08 17:17:09 +02:00
Juergen Hoeller 3a419872c8 Polishing 2014-08-07 23:06:08 +02:00
Sebastien Deleuze 3922f6fc53 Update references to RFC 2616
Replace references to the old RFC 2616 (HTTP 1.1) with references
to the new RFCs 7230 to 7235.

This commit also deprecates:
 - HttpStatus.USE_PROXY
 - HttpStatus.REQUEST_ENTITY_TOO_LARGE in favor of HttpStatus.PAYLOAD_TOO_LARGE
 - HttpStatus.REQUEST_URI_TOO_LONG in favor of HttpStatus.URI_TOO_LONG

Issue: SPR-12067
2014-08-07 14:50:45 +02:00
Stephane Nicoll 3da68cfe21 Remove unused imports 2014-08-04 14:13:40 +02:00
Brian Clozel 95e9b380d3 Update ResourceHandlerReg. API for Resource handling
This change adds new methods in the ResourceHandlerRegistration API
for registering ResourceResolvers and ResourceTransformers, allowing
to better handle server-side resources in web applications.i

Here is an example of configuration for an HTML5 web application
that uses JavaScript and HTML5 appcache manifests:

    registry.addResourceHandler("/**")
      .addResourceLocations("classpath:static/")
      .addTransformer(new AppCacheManifestTransfomer())
      .addVersion("v1", "/**/*.js")
      .addVersionHash("/**");

Issue: SPR-11982
2014-08-01 19:04:07 +02:00
Rossen Stoyanchev 16273473cb Update Javadoc
Issue: SPR-12028
2014-07-29 18:06:05 -04:00
Rossen Stoyanchev 968492c28b Update constructor for AbstractJsonpResponseBodyAdvice 2014-07-29 11:42:18 -04:00
Juergen Hoeller 3bcfc591e9 Polishing 2014-07-29 14:11:19 +02:00
Juergen Hoeller 8f484d382e Polishing 2014-07-29 11:42:37 +02:00
Juergen Hoeller 7bc966032b Rearranged statement whitespace in Velocity macros 2014-07-29 11:42:29 +02:00
Rossen Stoyanchev d917b8a923 Extract base interface for VersionStrategy
This change splits out a base VersionPathStrategy interface that
focuses on where in the URL path the version is embedded.
2014-07-29 10:41:02 +02:00
Rossen Stoyanchev 105ea196e4 Polish 2014-07-22 15:40:49 -04:00
Rob Winch 1b53882f55 Generate bracketless tag id in Velocity forms
Before this change if Velocity Spring form macro was bound to a path
which contains square brackets, those brackets would also appear in id
of generated tag, making the id invalid.

As of this fix all Velocity Spring form macros generate tag with id
that does not contain square brackets.

Issue: SPR-5172
2014-07-22 15:33:23 -04:00
Rossen Stoyanchev 6c4aff4c9d Polish 2014-07-22 11:21:39 -04:00
Sebastien Deleuze 9092102a83 Fix issue with @EnableWebMvc + existing ViewResolver
Issue: SPR-12013
2014-07-22 11:21:39 -04:00
Rossen Stoyanchev e41b14449e Restore method signature in ViewControllerRegistration
Issue: SPR-12016
2014-07-22 11:21:39 -04:00
Juergen Hoeller 9d6c38bd54 Consistent bracket alignment 2014-07-18 17:21:58 +02:00
Rossen Stoyanchev 27153b2982 Polish interceptor registration MVC config 2014-07-17 23:47:56 -04:00
Marten Deinum 84c11a5cc7 Allow interceptors with excludePathPattern only
Issue: SPR-11130
2014-07-17 23:36:41 -04:00
Sebastien Deleuze 52f1be7ade Add "-configurer" suffix to view configurer element names
Issue: SPR-7093
2014-07-17 23:18:41 -04:00
Rossen Stoyanchev 1ad22b922f Enhance view controller MVC config
This change adds support for configuring redirect view controllers and
also status controllers to the MVC Java config and the MVC namespace.

Issue: SPR-11543
2014-07-17 23:04:08 -04:00
Rossen Stoyanchev 0bbb7704b5 Add propagateQueryParams property to RedirectView
This change makes it possible to configure RedirectView such that the
query string of the current request is added to the target URL.

This change is preparation for SPR-11543.
2014-07-17 23:04:08 -04:00
Rossen Stoyanchev 0e2c5ee96c Enhance ParameterizableViewController
This change two new capabilities to ParameterizableViewController:

 - configure a View instance (in addition to view name)
 - configure response status code

The status code may be useful to send a 404 while also writing to the
body using a view.

The status code may also be used to override the redirect status code
of RedirectView. Even today it's possible to configure a "redirect:"
prefixed view name but the status code could not be selected. When a
3xx status is set, the code is passed on to the RedirectView while the
view name is automatically prefixed with "redirect:" (if not already).

For full control over RedirectView it is now also possible to
parameterize the controller with a View instance.

As one more possible resulting variation, given status 204 and no view
the request is considered handled (controller returns null).

This change is preparation for SPR-11543.
2014-07-17 23:04:08 -04:00
Rossen Stoyanchev dfcc1d7e8c Add default ViewResolver to MVC Java config
Since the MVC Java config always registers a ViewResolver (composite)
bean, at a very minimum we must add an InternalResourceViewResolver
consistent with default DispatcherServlet configuration and by
extension with the MVC namespace which falls back on DispatcherServlet
implicity if no <view-resolvers> element is present.

Issue: SPR-7093
2014-07-17 23:04:08 -04:00
Rossen Stoyanchev 7f7fd7d311 Polish view controller MVC config 2014-07-17 23:04:08 -04:00
Rossen Stoyanchev 61ec8fd236 Polish 2014-07-17 23:04:08 -04:00
Rossen Stoyanchev d23b0fec0c Polish 2014-07-16 21:43:30 -04:00
Sebastien Deleuze 80f4ea13c7 Add Groovy markup templating support to the MVC config
Issue: SPR-11998
2014-07-16 21:43:30 -04:00
Juergen Hoeller 980f971236 SelectedValueComparator defensively handles null values in exhaustiveCompare
Issue: SPR-12001
2014-07-16 15:11:19 +02:00
Rossen Stoyanchev 10a4c2cd81 Remove FreeMarker/Velocity/TilesConfigurer MVC config
After some further discussion:

The MVC config simplifies ViewResolver configuration especially where
content negotiation view resolution is involved.

The configuration of the underlying view technology however is kept
completely separate. In the case of the MVC namespace, dedicated
top-level freemarker, velocity, and tiles namespace elements are
provided. In the case of the MVC Java config, applications simply
declare FreeMarkerConfigurer, VelocityConfigurer, or TilesConfigurer
beans respectively.

Issue: SPR-7093
2014-07-15 14:27:01 -04:00
Rossen Stoyanchev 5e1a5c8d51 Update view-resolver namespace
Issue: SPR-7093
2014-07-13 22:53:29 -04:00
Rossen Stoyanchev f54cee47b0 Update ViewResolver registration classes
Following the separation of FreeMarker/Velocity/TilesConfigurer-related
configuration via separate interface, simplify and streamline the
view registration helper classes which no longer have much difference
(most are UrlBasedViewResolver's).

Updates to Javadoc and tests.

Issue: SPR-7093
2014-07-13 22:53:23 -04:00
Rossen Stoyanchev 5bc793768c Introduce Freemarker/Velocity/TilesWebMvcConfigurer
This change improves the support for auto-registration of FreeMarker,
Velocity, and Tiles configuration.

The configuration is now conditional not only based on the classpath
but also based on whether a FreeMarkerConfigurer for example is already
present in the configuration.

This change also introduces FreeMarker~, Velocity~, and
TilesWebMvcConfigurer interfaces for customizing each view technology.

The WebMvcConfigurer can still be used to configure all view resolvers
centrally (including FreeMarker, Velocity, and Tiles) without some
default conifguration, i.e. without the need to use the new
~WebMvcConfigurer interfaces until customizations are required.

Issue: SPR-7093
2014-07-12 17:23:47 -04:00
Sebastien Deleuze cc7e8f5558 Support Java and MVC namespace view resolution config
This commit improves and completes the initial MVC namespace
view resolution implementation. ContentNegotiatingViewResolver
registration is now also supported.

Java Config view resolution support has been added.
FreeMarker, Velocity and Tiles view configurers are registered
depending on the classpath thanks to an ImportSelector.

For both, a default configuration is provided and documented.

Issue: SPR-7093
2014-07-12 17:23:47 -04:00
Sebastien Deleuze a26b1ef8d9 Make Tiles 3 the default implementation in spring-webmvc
Move spring-webmvc-tiles3 content to spring-webmvc, and
create a spring-webmvc-tiles2 module with Tiles 2 support.

Its allows View Resolution to configure Tiles 3 instead of Tiles 2.

Issue: SPR-7093
2014-07-12 17:23:47 -04:00
Siva Prasad Valluru 92402e7715 Add initial support for MVC namespace view resolution config
<mvc:view-resolution /> now allows to configure easily
view resolvers.

Issue: SPR-7093
2014-07-12 17:23:47 -04:00
Rossen Stoyanchev 2ba8fd7e59 Polish 2014-07-11 09:17:02 -04:00
Brian Clozel 2c77de10dd Fix X-Forwarded-* behavior in ServletUriComponentsBuilder
When using ServletUriComponentsBuilder.fromRequest, this change
makes sure that:
* the default port is used when the "X-Forwarded-Host" header is set
and no port is defined in that header value
* to use the scheme defined in the "X-Forwarded-Proto" header if set

Issue: SPR-11872
2014-07-11 00:55:17 +02:00
Brian Clozel bf7dac5fc8 Rename AppCacheResourceTransformer
This change renames AppCacheResourceTransformer to
AppCacheManifestTransfomer, in order to avoid confusion between this
transformer and the CacheResourceTransformer (which caches
transformations done by the chain to save CPU/memory at runtime).

Issue: SPR-11964
2014-07-10 18:17:48 +02:00
Brian Clozel f11815c960 Add AppCacheResourceTransformer
This change adds a new ResourceTransformer that helps handling resources
within HTML5 AppCache manifests for HTML5 offline application.

This transformer:
* modifies links to match the public URL paths
* appends a comment in the manifest, containing a Hash (e.g. "# Hash:
9de0f09ed7caf84e885f1f0f11c7e326")

See http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#offline
for more details on HTML5 offline apps and appcache manifests.

Here is a WebConfig example:

  @Override
  public void addResourceHandlers(ResourceHandlerRegistry registry) {

    AppCacheResourceTransformer appCacheTransformer =
          new AppCacheResourceTransformer();

      registry.addResourceHandler("/**")
          .addResourceLocations("classpath:static/")
          .setResourceResolvers(...)
          .setResourceTransformers(..., appCacheTransformer);
  }

Issue: SPR-11964
2014-07-10 16:55:25 +02:00
Juergen Hoeller 3c726aa6c1 Polishing 2014-07-09 21:24:59 +02:00
Juergen Hoeller 777085bbfc MappingJackson2JsonView/MessageConverter calls non-deprecated Jackson 2.1+ createGenerator API
Also removing workaround for https://github.com/FasterXML/jackson-databind/issues/12 (fixed in 2.1+)

Issue: SPR-11262
2014-07-09 21:23:09 +02:00
Rossen Stoyanchev fa33ed4b4b Support <ref> for arg resolvers return value handlers
Issue: SPR-11927
2014-07-09 15:11:20 -04:00
Rossen Stoyanchev 0d5c5a3d33 Fix white space issue 2014-07-09 15:11:19 -04:00
Agim Emruli 19760f9eb9 Add support to reference external HandlerMethodArgumentResolver beans which might contain already configured instances (e.g. through a 3rd-party namespace handler).
Users can not mix and match between "inner bean" argument resolver and "external bean" argument resolver. This commit only focuses only on argument-resolver, while the support could be extended to return value handlers as well.

 Issue: SPR-11927
2014-07-09 15:11:19 -04:00
Juergen Hoeller b559f15a00 Polishing 2014-07-07 21:45:40 +02:00
Brian Clozel ea4a5d4722 Add XML config support ResourceResolver & ResourceTransformer
This change adds support for configuring ResourceResolvers and
ResourceTransformers with ResourceHttpRequestHandlers.

This is an example configuration:

    <mvc:resources mapping="/resources/**" location="/">
      <mvc:resolvers>
        <bean class="org.springframework.web.servlet.resource.PathResourceResolver"/>
        <ref bean="myResourceResolver"/>
      </mvc:resolvers>
      <mvc:transformers>
        <bean class="org.springframework.web.servlet.resource.CssLinkResourceTransformer" />
      </mvc:transformers>
    </mvc:resources>

    <bean id="myResourceResolver" class="org.example.resource.MyResourceResolver"/>

Issue: SPR-10951
2014-07-02 16:47:08 +02:00
Juergen Hoeller 367b0394a2 Spring's ROME support requires ROME 1.5 (com.rometools.rome) now
Issue: SPR-11893
2014-07-02 15:04:41 +02:00
Rossen Stoyanchev 476864f3e9 Expose handled exception as request attribute
This change exposes exceptions handled in the DispatcherServlet with a
HandlerExceptionResolver as a request attribute. This is done only when
the resolver returns an empty ModelAndView indicating the exception was
resolved but not view is required (e.g. status code was set). In such
cases the exception may be useful to any handlers in an ERRPR dispatch
by the servlet container.

Issue: SPR-11686
2014-07-01 23:32:27 -04:00
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
Juergen Hoeller 4ac680103b Only retrieve the FlashMapManager if a non-empty output FlashMap has been found
Issue: SPR-10937
2013-11-05 13:38:10 +01:00
Rossen Stoyanchev a7af9505de Avoid filling up AntPathMatcher cache
This change avoid use of AntPathMatcher to extract URI template
variables when the lookup path is used as the best matching pattern.

Issue: SPR-10803
2013-10-30 12:39:31 -04:00
Rossen Stoyanchev 7d5b34a7c5 Fix warnings 2013-10-29 21:37:26 -04:00
Juergen Hoeller bfa30913fb Polishing 2013-10-30 00:53:55 +01:00
Phillip Webb 4043b1d381 Workaround Javadoc bug with JDK 8 (b112+)
Remove Javadoc linkplain to ExceptionHandler#value() from
AnnotationMethodHandlerExceptionResolver to work around JDK
Javadoc bug 9007707.
2013-10-29 09:55:54 -07:00
Rossen Stoyanchev 558aec294c Polish MvcUriComponentsBuilder 2013-10-29 11:39:59 -04:00
Rossen Stoyanchev 24dfe8ec19 Replace use of jdk 1.8 api 2013-10-27 18:00:16 -04:00
Rossen Stoyanchev 14b9931ee3 Update MvcUriComponentsBuilder to use DispServlet WAC
Issue: SPR-8826
2013-10-25 23:25:13 -04:00
Rossen Stoyanchev cf5db8362b Replace MvcUrls with MvcUriComponentsBuilder
Issue: SPR-8826
2013-10-25 22:29:38 -04:00
Phillip Webb 12e896ed8b Polish 2013-10-25 16:42:47 -07:00
Rossen Stoyanchev b8809daf5f Refactor HandlerMethod support in spring-messaging
Introduce base class AbstractMethodMessageHandler for
HandlerMethod-based message handling.

Add MessageCondition interface for mapping conditions to messages
with support for combining type- and method-level annotation
conditions, the ability to match conditions to messages, and also
comparing matches to select the best match.

Issue: SPR-11024
2013-10-24 21:50:49 -04:00
Sam Brannen 6b0a62569b Fix broken test in MvcNamespaceTests
The testDefaultConfig() method in MvcNamespaceTests creates a new Date()
in its test fixture but then performs an assertion against a hard coded
data string of "2013-10-21". This test therefore only passed yesterday,
on October 21, 2013.

This commit addresses this by changing the hard coded date string to one
based on the current date.

Issue: SPR-10665, SPR-8826
2013-10-22 22:38:32 +02:00
Rossen Stoyanchev bafc73f147 Integrate suggested support for creating MVC URLs
The key contract is MvcUrls. An instance is automatically created with
the Spring MVC namespace and the MVC Java config but can also be easily
created in any configuration.

Some example tests can be found in DefaultMvcUrlsTests.

Issue: SPR-10665, SPR-8826
2013-10-21 16:26:08 -04:00
Oliver Gierke 4fd27b12fc Introduced MvcUriComponentsBuilder to create URIs pointing to controller methods.
MvcUriComponentsBuilder allows creating URIs that point to Spring MVC
controller methods annotated with @RequestMapping. It builds them by
exposing a mock method invocation API similar to Mockito, records the
method invocations and thus builds up the URI by inspecting the mapping
annotations and the parameters handed into the method invocations.

Introduced a new SPI UriComponentsContributor that should be implemented 
by HandlerMethodArgumentResolvers that actually contribute path segments 
or query parameters to a URI. While the newly introduced 
MvcUriComponentsBuilder looks up those UriComponentsContributor instances 
from the MVC configuration.

The MvcUriComponentsBuilderFactory (name to be discussed - MvcUris maybe?) 
prevents the multiple lookups by keeping the UriComponentsBuilder 
instances in an instance variable. So an instance of the factory could 
be exposed as Spring bean or through a HandlerMethodArgumentResolver to 
be injected into Controller methods.

Issue: SPR-10665, SPR-8826
2013-10-21 16:26:07 -04:00
Phillip Webb b0ff834ee3 Multicaster support for events with null source
Update `AbstractApplicationEventMulticaster` to support `EventObjects`
with a null source (which can happen if they have been serialized).

Issue: SPR-10945
2013-10-21 11:59:46 -07:00
Brian Clozel c4a8bf9c4d Add new features on @ControllerAdvice
Prior to this commit, @ControllerAdvice annotated beans would
assist all known Controllers, by applying @ExceptionHandler,
@InitBinder, and @ModelAttribute.

This commit updates the @ControllerAdvice annotation,
which accepts now base package names, assignableTypes,
annotations and basePackageClasses.

If attributes are set, only Controllers that match those
selectors will be assisted by the annotated class.
This commit does not change the default behavior when
no value is set, i.e. @ControllerAdvice().

Issue: SPR-10222
2013-10-18 11:35:06 -04:00
Rossen Stoyanchev 190bf247a3 Add helper method to ResourceHandlerRegistry 2013-10-15 09:49:54 -04:00
Rossen Stoyanchev cf7889e226 Fix issue with DeferredResult on @RestController
Before this change, async result handling on controller methods failed
to observe type-level annotations annotations. The issue was never
noticed until we started supporting type-level @ResponseBody and the
@RestController meta annotation.

Issue: SPR-10905
2013-10-14 21:06:53 -04:00
Juergen Hoeller 3bd6dfe047 Autowiring of generic types
Includes revisions of MethodParameter and DependencyDescriptor (in particular towards a reference to the containing class). Also refines several ResolvableType method signatures.

Issue: SPR-9965
2013-10-15 00:11:23 +02:00
Brian Clozel 5de5198005 Allow greater flexibility for template method createDataBinderFactory
Prior to this commit, the template method createDataBinderFactory
would only allow ServletRequestDataBinderFactory as a return type.

This commit updates the method signature and allows
InitBinderDataBinderFactory, a superclass of the previous one.
Then other implementations can override this method and return
other InitBinderDataBinderFactory types.

Issue: SPR-10920
2013-10-14 10:21:09 +02:00
Phillip Webb 501a1cbb5d Refactor from deprecated GenericTypeResolver calls
Refactor AbstractMessageConverterMethodArgumentResolver and
BridgeMethodResolver to use ResolvableType in preference to deprecated
GenericTypeResolver calls.

Issue: SPR-10980
2013-10-10 00:19:51 -07:00
Rossen Stoyanchev 6a323292d8 Revert "Add initial cut of expanded resource handling"
This reverts commit d4a0e628d5, reversing
changes made to 8abe949734.
2013-10-07 21:18:41 -04:00
Rossen Stoyanchev 80e5513918 Revert "Remove unintended changes from last commit"
This reverts commit 1ba806b185.
2013-10-07 21:14:07 -04:00
Rossen Stoyanchev 2670d94c6a Revert "Update Spring MVC Java config for ResourceResolvers"
This reverts commit f8e1f06d08.
2013-10-07 21:13:22 -04:00
Rossen Stoyanchev 5c62c86fc9 Revert "Fix failing test"
This reverts commit c01f45fa59.
2013-10-07 21:10:05 -04:00
Juergen Hoeller 4574528a27 Comprehensive update to the framework's TimeZone handling, including a new TimeZoneAwareLocaleContext and a LocaleContextResolver for Spring MVC
A few noteworthy minor changes: LocaleContext.getLocale() may return null in special cases (not by default), which our own accessing classes are able to handle now. If there is a non-null TimeZone user setting, we're exposing it to all collaborating libraries, in particular to JSTL, Velocity and JasperReports. Our JSR-310 and Joda-Time support falls back to checking the general LocaleContext TimeZone now, adapting it to their time zone types, if no more specific setting has been provided. Our DefaultConversionService has TimeZone<->ZoneId converters registered. And finally, we're using a custom parseTimeZoneString method now that doesn't accept the TimeZone.getTimeZone(String) GMT fallback for an invalid time zone id anymore.

Issue: SPR-1528
2013-10-04 23:14:08 +02:00
Juergen Hoeller 52cca48f40 Polishing 2013-10-04 22:53:49 +02:00
Juergen Hoeller 8b3afda6f4 Marked Jackson 1.x support classes as deprecated 2013-10-04 22:52:47 +02:00
Rossen Stoyanchev 52d663e596 Make method in RequestMappingHandlerMapping protected
Issue: SPR-10950
2013-10-02 17:47:31 -04:00
Rossen Stoyanchev c01f45fa59 Fix failing test 2013-10-01 14:56:21 -04:00
Rossen Stoyanchev f8e1f06d08 Update Spring MVC Java config for ResourceResolvers 2013-10-01 14:43:38 -04:00
Rossen Stoyanchev 1ba806b185 Remove unintended changes from last commit 2013-09-27 21:17:02 -04:00
Rossen Stoyanchev 5a2e30c18b Refactor Resource URL generation and Servlet Filter
Renamed ResourceUrlMapper to ResourceUrlGenerator and refactored it
to be configured with Resource-serving HandlerMappings as opposed to
having them detected in the ApplicationContext through the
BeanPostProcessor contact.

Renamed and polished ResourceUrlEncodingFilter to ResourceUrlFilter
and added tests.
2013-09-27 21:07:31 -04:00
Rossen Stoyanchev 3c48b42106 Refactor ResourceResolverChain + resolver class names
This change splits out resource transformation out from the
ResourceResolverChain so that chain is focused entirely on resource
resolution (as its name suggests). The invocation of transformers
is left as a separate step, it uses a different (recursive)
algorithm in any case and iterates over a different set of objects.

Also ResourceResolverChain is now limited strictly to methods that
a ResourceResolver should be able to use to delegate to remaining
resolvers.

Furthermore, ResourceResolverChain now maintains an internal index
of the "current" resolver so that resolvers don't have to pass the
chain when invoking it much like a (Servlet API) FilterChain works.
If the last resolver calls the chain again, a null value is returned.
2013-09-27 21:07:31 -04:00
Rossen Stoyanchev 0e58125b15 Polish 2013-09-27 21:07:31 -04:00
Jeremy Grelle 61e61bd5fd Asset pipeline proposal. 2013-09-27 21:07:31 -04:00
Brian Clozel 62d6a43c61 Add NoHandlerFoundException to DispatcherServlet
Prior to this commit, the DispatcherServlet would send an error
response using the HttpServlet API when no Handler was found to
handle this request.

Now the DispatcherServlet can be configured to throw a
NoHandlerFoundException, when the throwExceptionIfNoHandlerFound
property is set to "true".
Those exceptions can be later on caught by default or custom
HandlerExceptionResolvers/ExceptionHandlers.

Issue: SPR-10481
2013-09-25 14:11:01 -04:00
Rossen Stoyanchev 50178550eb Add option to remove path ext in ServletUriCompBuilder
Issue: SPR-10272
2013-08-29 13:39:26 -04:00
Juergen Hoeller caa1218d36 Polishing 2013-08-29 19:17:59 +02:00
Juergen Hoeller 88115212eb Consistent xsd header formatting 2013-08-22 19:37:42 +02:00
Juergen Hoeller 3d462b6dd9 Added missing spring.schemas entries for 4.0 xsds
Also fixing an old XmlBeanFactory test that relies on "ref local" which is gone in the 4.0 xsd now, redeclaring the affected file to an older xsd version.
2013-08-22 19:36:53 +02:00
Juergen Hoeller 1420b970a7 Introduced DefaultParameterNameDiscoverer which checks JDK 8's standard reflection first and then falls back to ASM-based debug symbol analysis
Also, StandardReflectionParameterNameDiscoverer calls "Parameter.isNamePresent()" now to return null (and pass on to the next discoverer) if no JDK 8 parameters are available. Note that this requires OpenJDK 8 b100 or higher to compile now.

Issue: SPR-10532
2013-08-08 15:52:43 +02:00
Rossen Stoyanchev 82a26024ae Allow @ResponseBody on the type level
This change enables having @ResponseBody on the type-level in which
case it inherited and does not need to be added on the method level.

For added convenience, there is also a new @RestController annotation,
a meta-annotation in turn annotated with @Controller and @ResponseBody.
Classes with the new annotation do not need to have @ResponseBody
declared on the method level as it is inherited.

Issue: SPR-10814
2013-08-07 18:54:36 -04:00
Rossen Stoyanchev eb4579b4d4 Extract MimeType as a base class of MediaType
MimeType is available in core-spring and does not include support
for quality parameters and media used in HTTP content negotiation.
The MediaType sub-class in org.springframework.http adds q-parameters.
2013-08-07 13:21:37 -04:00
Sam Brannen cc2e7bb3d7 Polish AbstractContextLoaderInitializer and subclasses
This commit polishes the Javadoc and assertion failure messages for
AbstractContextLoaderInitializer and its subclasses.
2013-08-05 19:13:16 +02:00
Juergen Hoeller 2af891683e Polishing
Issue: SPR-10752
Issue: SPR-10627
(cherry picked from commit ae0f23e)
2013-08-01 00:20:33 +02:00
Rossen Stoyanchev 803779d160 Support List<Part> method arguments
Issue: SPR-10591
2013-07-30 22:01:17 -04:00
Rossen Stoyanchev 1e90d02973 Fix issue with parsing x-forwarded-host header
Issue: SPR-10701
2013-07-30 11:56:42 -04:00
Phillip Webb bc5246938d Fix ResourceHttpRequestHandler empty location log
Fix ResourceHttpRequestHandler to only log warning when locations
is empty.

Issue: SPR-10780
2013-07-24 16:52:01 -07:00
Rob Winch f7c0795c1a Add TestGroup.CUSTOM_COMPILATION
Previously building with JDK > 1.8 b88 caused test failures due to errors
with custom compilers like Jibx and Jasper reports.

This commit adds a new TestGroup named CUSTOM_COMPILATION that allows the
CI server to continue to run these tests but allow committers to ignore
these tests.
2013-07-24 09:29:17 -05:00
twhitmorenz 504d5da71f Log view exception in DispatcherServlet
Issue: SPR-10340
2013-07-24 09:13:48 -04:00
Phillip Webb 4500bf7661 Fix malformed Javadoc 2013-07-22 13:30:38 -07:00
Nicholas Williams f9b17a708f Add <spring:argument> subtag for message/theme
Add a new <spring:argument> tag that cab be nested within
<spring:message> and <spring:theme>. The tag is based on the <fmt:param>
tag and uses conventions found throughout other Spring tags.

Issue: SPR-9678
2013-07-22 10:51:02 -07:00
Nicholas Williams 50bd70f13d Ensure ParamTag release resources
Update ParamTag to reset values when resources are released. This
prevents problems in containers that pool tags.

Issue: SPR-10769
2013-07-22 10:33:58 -07:00
Nicholas Williams 110db37f1c Fix malformed UrlTag Javadoc 2013-07-22 10:33:44 -07:00
Nicholas Williams 915e93cc81 Update TLD versions to 4.0 2013-07-22 10:32:59 -07:00
Rossen Stoyanchev d0d670cd7d Make the JSON prefix used in converters configurable
Issue: SPR-10627
2013-07-19 17:22:58 -04:00
Rossen Stoyanchev a4c15d6678 Replace assert w/ warning in ResourceHttpRequestHandl.
Issue: SPR-9186
2013-07-19 17:22:58 -04:00
Rossen Stoyanchev da1fafa930 Fix issue in MappingJacksonJsonView
Issue: SPR-10752
2013-07-19 17:22:58 -04:00
Rossen Stoyanchev 675ec4c3e2 Fix issue in ContentNeogitatingViewResolver
The following commit in 3.2.3 had a side effect on CNVR:
aaded7e30b

It appears that CNVR doesn't treat a request for "*/*" differently
from a request that does not request content types. Both should be
interpreted as "any content type is acceptable". This fix ensures
that CNVR treats these two cases the same way.

Issue: SPR-10683
2013-07-18 21:53:39 -04:00
Biju Kunjummen 83ea0fb9e0 Fix typo in ModelAndViewMethodReturnValueHandler
This commit fixes a typo in the class-level Javadoc for
ModelAndViewMethodReturnValueHandler.

Issue: SPR-10650
2013-07-11 01:33:02 +02:00
Sam Brannen 907e286e77 Fix typos in HandlerAdapter 2013-07-06 15:31:12 -04:00
Rossen Stoyanchev 62e23363cb Fix getters to match setters in RMHA
Issue: SPR-10519
2013-06-20 20:57:24 -04:00
Rossen Stoyanchev 4b22558a06 Add HTTP method to RequestDataValueProcessor method
Issue: SPR-10041, SPR-10652
2013-06-20 20:57:24 -04:00
Sam Brannen f311bf3daf Introduce TCP & UDP server port scanning utility
Prior to this commit the Spring Framework did not provide a public means
for scanning for available server ports. However, the Spring Framework
internally used a FreePortScanner in integration tests within its own
test suite. Furthermore, Spring Integration 2.2 provides similar support
in a SocketUtils class in the spring-integration-test module.

This commit introduces SocketUtils in spring-core to replace the
FreePortScanner which was previously only used internally within
Spring's test suite. This new implementation is inspired by both Spring
Framework's FreePortScanner and Spring Integration's SocketUtils and
consequently attempts to merge the best of both previous
implementations.

Issue: SPR-8032
2013-06-15 13:46:32 +02:00
Juergen Hoeller 28164b4b23 Introduced "jsonPrefix" bean property
This change involves a modification of the "writeContent" template method to include the "jsonPrefix" String instead of the "prefixJson" boolean flag. Since said template method has only been introduced in 3.2.2, this change should hopefully not be a problem.

Issue: SPR-10567
2013-05-15 23:54:51 +02:00
Rossen Stoyanchev d23de282a6 Reinstate removal of semicolon content
Commit 5b1165 was an attempt to leave semicolon content in the URL path
while ignoring it for request mapping purposes. However, it becomes
quite difficult to manage and semicolon content should not always be
ignored (sometimes a semicolon is used as a separator of multiple items
in a path segment, rather than for matrix variables).

This change effectively reverts back to the original approach in 3.2
where a flag on AbstractHandlerMapping can be used to have semicolon
content removed or kept. If kept, path segments with matrix variables
must be represented with a path segment.

The main difference is that by default it is removed everywhere
including the MVC namespace and Java config.

Issue: SPR-10427, SPR-10234
2013-05-14 21:32:09 -04:00
Rob Winch 9468548116 Add @Override to remaining source files
Issue: SPR-10130
2013-05-13 17:04:56 -05:00
Rossen Stoyanchev 0634555424 Delay check if pattern ends with slash
This is a minor fix with no actual impact.

Issue: SPR-10504
2013-05-10 12:47:44 -04:00
Rossen Stoyanchev c0cacfcd68 Add servletRelativeAction form tag attribute
A recent change in FormTag to prepend the context and servlet paths if
not present, causes issues when used in portlet applications.
This change introduces a servletRelativeAction form tag attribute that
must be used for the context and servlet paths to be prepended.

Issue: SPR-10382
2013-05-10 11:56:50 -04:00
Rossen Stoyanchev 78fcd28389 Invoke global, then local @InitBinder/@ModelAttribute
@InitBinder and @ModelAttribute methods in @ControllerAdvice classes
are now invoked first, allowing any such methods in the @Controller
class to override them.

Issue: SPR-10419
2013-05-10 10:42:42 -04:00
Juergen Hoeller 640555194b Introduced assertions for bean accessor delegation in AbstractApplicationContext
Issue: SPR-10307
2013-05-10 01:32:00 +02:00
Phillip Webb 19187fd365 Allow FrameworkServlet to be used as a bean
Change FrameworkServlet so that it can also be used as a bean within an
existing ApplicationContext. Primarily added to support use with
embedded servlet containers where Spring bootstraps the servlet
container, rather than the servlet container bootstrapping Spring.

Issue: SPR-10381
2013-05-08 15:14:58 -07:00
Juergen Hoeller 2a44228b98 Consistent use of <pre class="code">
Issue: SPR-8108
2013-05-07 21:31:26 +02:00
Juergen Hoeller fcb0cf27d7 MappingJackson(2)HttpMessageConverter alignment 2013-05-07 18:11:55 +02:00
Juergen Hoeller 0fc5a5d912 Introduced 4.0 versions of all XML configuration schemas
Removed spring-beans.dtd (the 1.x variant) and spring-oxm-1.5.xsd (pre-Spring-Framework variant), in order to raise the backwards compatibility limit a little bit at least. We'll keep supporting the 2.0 and 2.5 xsd versions for the time being, as well as spring-beans-2.0.dtd.

Removed the ref 'local' attribute in spring-beans-4.0.xsd since 'local' lost its differentiating role to a regular bean ref back in the 3.1 days when we started allowing for the same bean id to reappear in a different beans section of the same configuration file (with a different profile).

Issue: SPR-10437
2013-05-07 18:11:51 +02:00
Phillip Webb e1c25ff1a3 Workaround jasper report test fail on OSX
Add temporary Assume.canLoadNativeDirFonts() method allowing failing
jasper report tests to be bypassed on OSX.

This should be revisited when JDK 8 is released.

Issue: SPR-10537
2013-05-07 08:23:46 -07:00
Juergen Hoeller 0a8f5b2919 Removed deprecated helper classes and methods (that have been deprecated since 3.0 or before) 2013-05-02 17:25:10 +02:00
Juergen Hoeller 767bd3f3f8 Upgraded to Jackson 1.9 (raising minimum to 1.8+) and 2.2 2013-05-02 15:51:59 +02:00
Juergen Hoeller 9c09a0a037 Consistent Map/Set ordering
Use LinkedHashMaps/Sets wherever exposed to users, and code tests defensively in terms of expected Map/Set ordering. Otherwise, there'll be runtime order differences between JDK 7 and JDK 8 due to internal HashMap/Set implementation differences.

Issue: SPR-9639
2013-04-23 13:53:09 +02:00
Stevo Slavic d80ea16291 Fix JasperReport tests to ignore missing fonts
Add 'jasperreports.properties' to ignore missing fonts in order that
tests pass on Linux.

The upgraded JasperReports 5.0.4 throws a JRFontNotFoundException when
a report font is not found. This caused Spring MVC tests to fail since
the example reports used the 'Arial' font which is not shipped with most
Linux distributions.

An alternative fix would have been to package fonts with the reports
using JasperReports font extension support.

Issue: SPR-10438
2013-04-13 12:47:54 -07:00
Juergen Hoeller 8fab14dfeb Upgraded to JasperReports 5.0 (preserving compatibility with all previous releases) and POI 3.9 (preserving compatibility with POI 3.5+) 2013-03-29 14:52:30 +01:00
Juergen Hoeller 5472e975f6 Removed deprecated core.enums package 2013-03-19 23:31:50 +01:00
Juergen Hoeller 20fb418785 Removed Spring’s own JSP expression support (in favor of JSP 2.0+) 2013-03-19 16:30:46 +01:00
Juergen Hoeller f19f55a59b Removed Spring MVC command/form controller class hierarchy 2013-03-19 16:06:37 +01:00
Juergen Hoeller a03d125b4e Removed Servlet 2.4 forward attribute support in InternalResourceView and TilesView 2013-03-19 14:33:21 +01:00
Phillip Webb 4e1cab28df Merge branch '3.2.x'
* 3.2.x: (28 commits)
  Hide 'doc' changes from jdiff reports
  Document @Bean 'lite' mode vs @Configuration
  Final preparations for 3.2.2
  Remove Tiles 3 configuration method
  Polishing
  Extracted buildRequestAttributes template method from FrameworkServlet
  Added "beforeExistingAdvisors" flag to AbstractAdvisingBeanPostProcessor
  Minor refinements along the way of researching static CGLIB callbacks
  Compare Kind references before checking log levels
  Polish Javadoc in RequestAttributes
  Fix copy-n-paste errors in NativeWebRequest
  Fix issue with restoring included attributes
  Add additional test for daylight savings glitch
  Document context hierarchy support in the TCF
  Fix test for daylight savings glitch
  Make the methodParameter field of HandlerMethod final
  Disable AsyncTests in spring-test-mvc
  Reformat the testing chapter
  Document context hierarchy support in the TCF
  Document context hierarchy support in the TCF
  ...
2013-03-13 14:01:46 -07:00
Juergen Hoeller c75eba79b3 Polishing 2013-03-13 16:58:51 +01:00
Juergen Hoeller 1f55b4f2a8 Extracted buildRequestAttributes template method from FrameworkServlet
Also, RequestBindingInterceptor now obtains HttpServletRequest from locally passed-in request handle and delegates to buildRequestAttributes as well now.

Issue: SPR-10342
2013-03-13 16:58:29 +01:00
Rossen Stoyanchev 0fb4b747c2 Fix issue with restoring included attributes
Before this change the DispatcherServlet restored modified and also
removed added attributes but did not restore removed attributes.

Issue: SPR-10360
2013-03-11 10:34:05 -04:00
Phillip Webb 7bc5353e07 Do not sort the mvc:resources location attribute
Update ResourcesBeanDefinitionParser to use ensure that location
attribute values remain in the order that they are specified. The
order was inadvertently changed in commit 3838d159f3 due to the use
of StringUtils.commaDelimitedListToSet which sorts items.

Issue: SPR-10355
2013-03-06 11:18:49 -08:00
Phillip Webb 05765d7520 Replace EasyMock with Mockito
Issue: SPR-10126
2013-03-06 11:06:15 -08:00
Chris Beams ce4be3b46b Merge branch '3.2.x' into master
Conflicts:
	gradle.properties
	spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java
	spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java
	spring-core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java
	spring-core/src/main/java/org/springframework/core/env/ReadOnlySystemAttributesMap.java
	spring-jdbc/src/main/java/org/springframework/jdbc/datasource/LazyConnectionDataSourceProxy.java
	spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/AbstractLobHandler.java
	spring-web/src/main/java/org/springframework/http/client/BufferingClientHttpRequestWrapper.java
	spring-web/src/main/java/org/springframework/http/client/SimpleBufferingClientHttpRequest.java
	spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java
	spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java
2013-03-04 15:41:15 +01:00
Stevo Slavic ba03d5b0c7 Fix FreeMarker form checbox macro generated names
In Spring 3.2 a fix was implemented for all Spring Freemarker form
macros so that generated form input fields have valid bracketless IDs.
In the fix a regression was introduced manifesting in formCheckbox
macro no longer generating appropriate names for checkbox and hidden
input field.

This change fixes mentioned regression issue.

Issue: SPR-8732
2013-03-01 16:30:02 -05:00
Rossen Stoyanchev c611083415 Catch IAE when parsing content type
Issue: SPR-10308
2013-03-01 16:30:02 -05:00
Phillip Webb b27fc0ef30 Do not use Servlet 3.0 API in doOptions()
Refactor FrameworkServlet.doOptions() to capture the "Allow" header
by using a HttpServletResponseWrapper.

Prior to this commit the HttpServletResponse.getHeader() method was
used which is only available in Servlet 3.0 environments.

Issue: SPR-10341
2013-03-01 10:31:08 -08:00
Juergen Hoeller 06c6cbb6b9 AbstractCachingViewResolver does not use global lock for accessing existing View instances anymore
Issue: SPR-3145
2013-02-15 18:17:00 +01:00
Rossen Stoyanchev 5b1165b102 Ignore path parameters in request mappings
Before this change the presence of path params (e.g. "/foo;q=1/bar")
expected the request mapping to contain a URI variable in the place of
semicolon content (e.g. either "/{foo}/bar" or "/{foo};{fooParams}").

The change ensures path params are ignored in @RequestMapping patterns
so that "/foo/bar" matches to "/foo;q=1/bar" as well as
"/foo;q=1;p=2/bar".

Along with this change, the RequestMappingHandlerMapping no longer
defaults to having semicolon content removed from the URL, which means
@MatrixVariable is supported by default without the need for any
further configuration.

Issue: SPR-10234
2013-02-15 11:31:32 -05:00
Carson McDonald 6f0b4395e5 Fix a few typos
Minor changes to fix typos. Small adjustment to add a couple commas.
2013-02-12 09:04:28 -05:00
Juergen Hoeller f57bc1aaaa MappingJackson(2)JsonView allows subclasses to access the ObjectMapper and to override content writing
Issue: SPR-7619
2013-02-08 22:25:26 +01:00
Juergen Hoeller 188a11bdb9 Fixed setFavorPathExtension delegation code 2013-02-06 21:01:51 +01:00
Phillip Webb f464a45ba4 Polish formatting
Minor formatting polish across that codebase. Primarily fixing
whitespace issues.
2013-02-04 10:35:25 -08:00
Phillip Webb 065b1c0e46 Fix unused local variable warnings 2013-01-25 14:35:19 -08:00
Phillip Webb 88f5dd6ce1 Fix 'is already an instance of type' warnings 2013-01-25 11:29:54 -08:00
Rossen Stoyanchev 3c09b07652 Raise exception on missing request parameters
Issue: SPR-10193
2013-01-22 18:11:49 -05:00
Rossen Stoyanchev a3e190e1bf Support sub-types of ResponseEntity
Issue: SPR-10207
2013-01-22 17:26:51 -05:00
Sam Brannen 2a41de00e3 Polish Javadoc in Spring MVC async support
This commit fixes some typographical and grammatical errors in various
classes in Spring MVC's async support.
2013-01-22 12:09:00 +01:00
Chris Beams 3cdb866bda Relax ConfigurableWebEnvironment signatures
ConfigurableWebEnvironment was introduced in 3.2.0.M1 with SPR-9439 in
order to break a cyclic dependency. At the same time, certain signatures
such as AbstractRefreshableWebApplicationContext#getEnviroment and
GenericWebApplicationContext#getEnvironment were updated to take
advantage of covariant return types and return this newer, more narrow
type and providing cast-free calls to ConfigurableWebEnvironment methods
where necessary. Similar changes were made to HttpServletBean in
3.2.0.M2 with SPR-9763.

Narrowing #getEnvironment signatures in this fashion required enforcing
at the #setEnvironment level that any Environment instance provided
(explicitly or via the EnvironmentAware callback) must be an instance of
ConfigurableWebEnvironment. This is a reasonable assertion in typical
web application scenarios, but as SPR-10138 demonstrates, there are
valid use cases in which one may want or need to inject a non-web
ConfigurableEnvironment variant, e.g. during automated unit/integration
testing.

On review, it was never strictly necessary to narrow #getEnvironment
signatures, although doing so did provided convenience and type safety.
In order to maintain as flexible and backward-compatible an arrangement
as possible, this commit relaxes these #getEnvironment signatures back
to their original, pre-3.2 state. Namely, they now return
ConfigurableEnvironment as opposed to ConfigurableWebEnvironment, and in
accordance, all instanceof assertions have been removed or relaxed to
ensure that injected Environment instances are of type
ConfigurableEnvironment.

These changes have been verified against David Winterfeldt's Spring by
Example spring-rest-services project, as described at SPR-10138.

Issue: SPR-10138, SPR-9763, SPR-9439
2013-01-22 11:33:37 +01:00
Chris Beams d9a4fb410d Introduce "dummy" Environment implementation
For testing purposes in which an Environment implementation is required
but a ConfigurableEnvironment is not desirable.

All methods are no-ops and return null, therefore NPEs are likely.
2013-01-22 11:33:37 +01:00
Rossen Stoyanchev 660458a649 Fix init order issue in RequestMappingHandlerMapping
Issue: SPR-10173
2013-01-21 14:52:41 -05:00
Rossen Stoyanchev 902a136b6e Add helpful error message to DispServlet initializer
Issue: SPR-10168
2013-01-21 14:41:31 -05:00
Rossen Stoyanchev e4fcad9f93 Fix exception message about producible media types
Issue: SPR-10175
2013-01-21 12:34:56 -05:00
Sam Brannen f3e5f8bb4e Update copyright year, author tags, and Javadoc 2013-01-15 12:11:44 +01:00
Rossen Stoyanchev 9dc7b5feef Use MessageSource to resolve @ResponseStatus.reason
The reason attribute of @ResponseStatus can now be a code resolvable
through the ApplicationContext's MessageSource.

Issue: SPR-6044
2013-01-14 22:00:55 -05:00
Rossen Stoyanchev ad025b59c5 Prepend context/servlet path to FormTag action
The Form tag now fills in the context and servlet path if not present
in the specified action.

Issue: SPR-8684
2013-01-14 22:00:54 -05:00
Rossen Stoyanchev 2f6e45ff06 Add protected method to AbstractHandlerMethodMapping 2013-01-09 05:44:23 -05:00
Rossen Stoyanchev 68d4a70f8e Add option to always append 'must-revalidate'
Issue: SPR-9248
2013-01-08 11:44:24 -05:00
Chris Beams 0829cbfdd3 Update license header for recently modified files
Issue: SPR-7763, SPR-10140, SPR-10132, SPR-10093, SPR-10103
2013-01-08 16:23:46 +01:00
Rossen Stoyanchev c7d0054a9e Remove closing tag in form tag's extra hidden fields
The fields returned from a RequestDataValueProcessor are now
written as hidden fields without a closing tag.

Before:
<input type="hidden" name="xxx" value="yyy"></input>

After:
<input type="hidden" name="xxx" value="yyy" />

Issue: SPR-10103
2013-01-08 10:01:51 -05:00
Rossen Stoyanchev 87109b348c Add decoding matrix variable values
Issue: SPR-10140
2013-01-08 10:01:51 -05:00
Rossen Stoyanchev 7bc9667913 Add support for placeholders in @RequestMapping
@RequestMapping annotations now support ${...} placeholders.

Issue: SPR-9935
2013-01-07 18:06:47 -05:00
Rossen Stoyanchev 153508a300 Support "X-Forwarded-Host" in UriComponentsBuilder
ServletUriComponentsBuilder now supports setting the host to the
value held in the X-Forwarded-Host [0] header used in reverse
proxy scenarios.

[0] http://tools.ietf.org/html/draft-ietf-appsawg-http-forwarded-10

Issue: SPR-10110
2013-01-07 16:55:09 -05:00
Chris Beams 895feda349 Merge branch 'cleanup-3.2.x' into 3.2.x
* cleanup-3.2.x:
  Eliminate AJ @Async warning in test case
  Update Apache license headers for moved files
  Move namespace tests to root integration module
  Fix several miscellaneous compiler/Eclipse warnings
  Remove duplicate test resources
  Fix warnings due to unused import statements
  Update Apache license headers for affected sources
  Remove duplicate test classes
  Replace test beans with test objects
  Polish test sourceSet dependencies
  Add test dependencies sources for testCompile
2013-01-04 12:24:07 +01:00
Chris Beams 15e9fe638c Remove duplicate test resources
The files deleted in this commit existed in identical form in two places
within a given module; typically in src/test/java and
src/test/resources. The version within src/test/resources has been
favored in all cases.

This change was prompted by associated Eclipse warnings, which have now
been quelled.

Issue: SPR-9431
2013-01-04 11:38:58 +01:00
Chris Beams 51b307681a Fix warnings due to unused import statements
Issue: SPR-9431
2013-01-04 11:04:54 +01:00
Phillip Webb 42b5d6dd7e Remove duplicate test classes
Prior to this commit many test utility classes and sample beans were
duplicated across projects. This was previously necessary due to the
fact that dependent test sources were not shared during a gradle
build. Since the introduction of the 'test-source-set-dependencies'
gradle plugin this is no longer the case.

This commit attempts to remove as much duplicate code as possible,
co-locating test utilities and beans in the most suitable project.
For example, test beans are now located in the 'spring-beans'
project.

Some of the duplicated code had started to drift apart when
modifications made in one project where not ported to others. All
changes have now been consolidated and when necessary existing tests
have been refactored to account for the differences.

Conflicts:
	spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java
	spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java
	spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java
2013-01-04 10:02:29 +01:00
Chris Beams 7a737bebdd Merge branch '3.2.x' into master
* 3.2.x:
  Fix ClassCastException when setting media types
  Enable execution of TestNG tests in spring-test
  Polish support for topic branch-specific versions
  Segregate add'l long-running and performance tests
  Eliminate EBR dependencies and repository config
  Skip creation of IDEA metadata for spring-aspects
  Fix Eclipse compilation error in Gradle plugin
  Polish build.gradle
  Fix null parameterName issue in content negotiation
  Recursively add test dependencies
2013-01-03 22:31:52 +01:00
Rossen Stoyanchev 9f9f1ed253 Fix ClassCastException when setting media types
Issue: SPR-10019
2013-01-03 15:13:19 -05:00
Chris Beams 961dbdb68a Merge branch '3.2.x' into master
* 3.2.x:
  Exclude spring-build-src from maven publish
  Move spring-build-junit into spring-core
  Relocate MergePlugin package
  Develop a gradle plugin to add test dependencies
  Expose Gradle buildSrc for IDE support
  Fix [deprecation] compiler warnings
  Upgrade to xmlunit version 1.3
  Improve 'build' folder ignores
  Fix regression in static setter method support
  Fix SpEL JavaBean compliance for setters

Conflicts:
	spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java
2013-01-02 10:36:57 +01:00
Chris Beams 70eaf02b7f Revert "Merge branch 'SPR-10130' into cleanup-master"
This reverts commit 45fa50821a, reversing
changes made to a312d900f8.
2013-01-02 10:33:59 +01:00
Phillip Webb 6626a38730 Fix [deprecation] compiler warnings
Fix deprecation compiler warnings by refactoring code or applying
@SuppressWarnings("deprecation") annotations. JUnit tests of
internally deprecated classes are now themselves marked as
@Deprecated.

Numerous EasyMock deprecation warnings will remain until the
migration to mockito can be completed.
2013-01-01 13:42:15 -08:00
Chris Beams b2a048b6f3 Update Apache license headers for affected sources 2012-12-28 23:57:33 +01:00
Chris Beams 3b40ce76bf Add @Override annotations to main sources
Issue: SPR-10130
2012-12-28 23:53:24 +01:00
Chris Beams 8472a2b2ab Update Apache license headers for affected sources 2012-12-28 23:09:31 +01:00
Chris Beams 4c8cd7b0bd Add @Override annotations to test sources
Issue: SPR-10129
2012-12-28 23:05:44 +01:00
Chris Beams 4d97ff2479 Fix [dep-ann] warnings with @Deprecated 2012-12-28 22:50:45 +01:00
Phillip Webb 6c14eaad61 Fix [cast] compiler warnings 2012-12-28 22:41:06 +01:00
Phillip Webb b0986049a3 Fix [serial] compiler warnings
Fix serialization warnings by applying @SuppressWarnings("serial")
when appropriate.

In certain cases and for unknown reasons, a correctly-placed
@SuppressWarnings("serial") annotation will fix the warning at the
javac level (i.e. the Gradle command-line), but will produce an
"unnecessary @SuppressWarnings" warning within Eclipse. In these
cases, a private static final serialVersionUID field has been added
with the default value of 1L.
2012-12-28 22:41:06 +01:00
Phillip Webb 731d5be644 Fix warnings due to unused import statements 2012-12-28 22:40:49 +01:00