Commit Graph

243 Commits

Author SHA1 Message Date
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
Chris Beams 9540d2c81b Replace <code> with {@code} throughout Javadoc
Issue: SPR-10128
2012-12-28 22:36:02 +01:00
Chris Beams 8597ec25ec Fix various Javadoc warnings
Issue: SPR-10128
2012-12-28 22:36:02 +01:00
Phillip Webb 2cf45bad86 Replace space indentation with tabs
Issue: SPR-10127
2012-12-28 20:49:56 +01:00
Phillip Webb 1762157ad1 Remove trailing whitespace in source files
find . -type f -name "*.java" -or -name "*.aj" | \
    xargs perl -p -i -e "s/[ \t]*$//g" {} \;

Issue: SPR-10127
2012-12-28 20:49:45 +01:00
Juergen Hoeller 531318a4b2 Polishing 2012-12-13 00:03:26 +01:00
Juergen Hoeller b9df7d68d9 Consistent fine-tuning of synchronized and concurrent data structures
In particular, avoiding synchronized Sets and Maps wherever possible (preferring a ConcurrentHashMap even instead of a synchronized Set) and specifying appropriate ConcurrentHashMap initial capacities (even if we end up choosing 16).
2012-12-12 23:46:26 +01:00
Chris Beams f26534700a Eliminate all Javadoc warnings
- Support external Javadoc links using Gradle's javadoc.options.links

 - Fix all other Javadoc warnings, such as typos, references to
   non-existent (or no longer existent) types and members, etc,
   including changes related to the Quartz 2.0 upgrade (SPR-8275) and
   adding the HTTP PATCH method (SPR-7985).

 - Suppress all output for project-level `javadoc` tasks in order to
   hide false-negative warnings about cross-module @see and @link
   references (e.g. spring-core having a @see reference to spring-web).
   Use the `--info` (-i) flag to gradle at any time to see project-level
   javadoc warnings without running the entire `api` task. e.g.
   `gradle :spring-core:javadoc -i`

 - Favor root project level `api` task for detection of legitimate
   Javadoc warnings. There are now zero Javadoc warnings across the
   entirety of spring-framework. Goal: keep it that way.

 - Remove all @link and @see references to types and members that exist
   only in Servlet <= 2.5 and Hibernate <= 4.0, favoring 3.0+ and 4.0+
   respectively. This is necessary because only one version of each of
   these dependencies can be present on the global `api` javadoc task's
   classpath. To that end, the `api` task classpath has now been
   customized to ensure that the Servlet 3 API and Hibernate Core 4 jars
   have precedence.

 - SPR-8896 replaced our dependency on aspectjrt with a dependency on
   aspectjweaver, which is fine from a POM point of view, but causes
   a spurious warning to be emitted from the ant iajc task that it
   "cannot find aspectjrt on the classpath" - even though aspectjweaver
   is perfectly sufficient. In the name of keeping the console quiet, a
   new `rt` configuration has been added, and aspectjrt added as a
   dependency to it. In turn, configurations.rt.asPath is appended to
   the iajc classpath during both compileJava and compileTestJava for
   spring-aspects.

Issue: SPR-10078, SPR-8275, SPR-7985, SPR-8896
2012-12-12 12:55:10 +01:00
Juergen Hoeller c55446da9d Polishing 2012-12-12 03:29:47 +01:00
Juergen Hoeller 9deaefe74d AbstractCachingViewResolver uses a cache limit of 1024 by default, avoiding overflow for redirect URLs
Issue: SPR-10065
2012-12-12 03:29:45 +01:00
Rossen Stoyanchev 85a552daed Fix package cycle among http message converters
This change introduces a new AllEncompassingFormHttpMessageConverter
class that adds JSON and XML converters for individual mime parts of
a multi-part request. The new converter is used in place of the
previously used XmlAwareFormHttpMessageConverter.

Issue: SPR-10055
2012-12-07 18:12:11 -05:00
Rossen Stoyanchev 3643d92cb8 Fix issue with creating ServletRequestAttributes
Prevously the FrameworkServlet created a new ServletRequestAttributes
instance for every request, unless the RequestContextHolder already
contained an instance whose type is not ServletRequestAttributes.
The main intent was that if RequestContextHolder contains a
PortletRequestAttributes, it should be left in place.

This change does an "instanceof" check against the request in
RequestContextHolder instead of an "equals" check on the type.
It still leaves PortletRequestAttributes in place but also allows
the previous request to be any sub-class of ServletRequestAttributes.

Issue: SPR-10025
2012-12-07 15:19:38 -05:00
Sam Brannen 2233949a0f Fix typo 2012-12-07 12:06:21 +01:00
Rossen Stoyanchev 9cc4bd892a Fix issue with suffix pattern match
Spring Framework 3.2 M2 added the ability to map requests using only
file extensions registered through the configured through a
ContentNeotiationManager, as opposed to allowing any file extension
(i.e. ".*"). The MVC namespace the MVC Java config automatically
register extensions such as ".json" and ".xml" depending on libraries
found on the classpath. That in turn causes issues in cases where
additional extensions are in use but not registered (e.g. ".html").

This change ensures that matching with registered file extensions only
works only if explicitly enabled through a property on
RequestMappingHandlerMapping.

Issue: SPR-10061, SPR-8474
2012-12-06 18:31:32 -05:00
Rob Winch 149e6f6425 polish web.Mock* classpath
Previously when running the tests for spring-web, spring-webmvc,
spring-test-mvc, and spring-orm there were possible collissions in the
classpath due to the fact that each had its own copy of the web.Mock*
classes in it. This causes uncertainty for which class the code was
running against. Furthermore, the maintance of keeping the copies up to
date was tedious.

Now there are two copies of the web.Mock* classes. The ones that exist
in spring-test main sources and a copy that supports servlet 3 within
spring-web test sources. The copy in spring-web test sources has been
moved to a new package to avoid having the classes exist twice on the
classpath within Eclipse.
2012-11-30 11:15:58 -05:00
Juergen Hoeller 48f405e8fd Finally added generics to JasperReports API signatures (motivated by JasperReports 5.0) 2012-11-29 23:15:41 +01:00
Rob Winch 157a1d6ee2 Rename MvcAsyncTask to WebAsyncTask
The name MvcAsyncTask is misleading because the class is part of Spring
Web as apposed to Spring MVC. This is also inconsistent with the other
async classes which use Web instead of Mvc.

This commit changes MvcAsyncTask to WebAsyncTask making it more
consistent with the jar it is found in and the other async classes.

Issue: SPR-10051
2012-11-28 16:55:45 -05:00
Rossen Stoyanchev 5cb1930550 Fix issue in Callable processing interceptor chain 2012-11-26 16:04:17 -05:00
Juergen Hoeller b8d86330d1 Deprecated Spring's own JSP expression evaluation
Since web applications declaring a Servlet 2.3 web.xml become really rare now, we're finally deprecating Spring's own ExpressionEvaluationUtils class. As a consequence, we're also setting "springJspExpressionSupport" to false by default, avoiding the potential double EL evaluation problem on pre-Servlet-3.0 containers.

Issue: SPR-5308
2012-11-26 00:35:47 +01:00
Rossen Stoyanchev 2d8bacace7 Set the ApplicationContext prop of ExceptionResolver
The MVC Java config now sets the ApplicationContext property of
ExceptionHandlerExceptionResolver.

Issue: SPR-9997
2012-11-23 15:12:52 -05:00
Rossen Stoyanchev b7f7fae78a Fix issue with @RequestBody args that are type vars
The change to support generic @RequestBody arguments introduced in
3.2 M2 also introduced a regression in reading arguments that are
type variables. This change fixes the issue.

Issue: SPR-9964
2012-11-22 11:35:22 -05:00
Rossen Stoyanchev 11cf978394 Define behavior of null Callable or DeferredResult
When a controller method declares Callable or DeferredResult as its
return value, and returns null, async processing will not start and
the request will be considered "handled" by the controller method.

Issue: SPR-9951
2012-11-20 15:12:58 -05:00
Rossen Stoyanchev 77223d7ced Deprecate pre 3.1 @MVC support classes
Issue: SPR-10005
2012-11-20 14:59:01 -05:00
Rossen Stoyanchev ecce7520fb Support HttpMessageConverter refs in mvc namespace
Issue: SPR-9469
2012-11-13 21:47:59 -05:00
Rossen Stoyanchev 62f2858f7f Fix issue with SpEL in mvc namespace
This change ensures that the location attribute of a resource mapping
and the path attribute of an interceptor mapping support SpEL
expressions.

Issue: SPR-9291, SPR-9848
2012-11-13 21:13:52 -05:00
Phillip Webb 950f00a280 Fix Collections import
Replace backport Collections class with stock JDK version
2012-11-12 13:15:25 -08:00
Chris Beams 1070e4d5c1 Initialize FrameworkServlet property sources eagerly
Prior to this change,
FrameworkServlet#configureAndRefreshWebApplicationContext called
 #postProcessWebApplicationContext(wac) and #applyInitializers(wac)
prior to #refresh, but because servlet-based property source stubs were
not replaced until #refresh, any post-processing or initialization
routines could not benefit from accessing the Environment to retrieve
properties from the ServletContext or ServletConfig.

The workaround to this problem is detailed in SPR-9610 - the user simply
needed to call WebApplicationContextUtils#initServletPropertySources
manually within their ApplicationContextInitializer (or overridden
 #postProcessWebApplicationContext method)

This commit ensures that
FrameworkServlet#configureAndRefreshWebApplicationContext calls
WebApplicationContextUtils#initServletPropertySources eagerly, prior to
invoking #postProcessWebApplicationContext and #applyInitializers.
Related Javadoc has also been updated throughout to clarify the behavior
of #initServletPropertySources, when it can be called and what the
effects are, etc.

Note also that a reproduction issue was added to demonstrate the problem
and verify its resolution [1].

[1]: https://github.com/SpringSource/spring-framework-issues/tree/master/SPR-9610

Issue: SPR-9610
2012-11-02 13:05:48 +01:00
Rossen Stoyanchev c0baea58c0 Fix issue with generic @RequestBody arguments
The original commit c9b7b1 ensured the ability to read parameterized
type @RequestBody arguments via GenericHttpMessageConverter (e.g.
application/json and List<String>). However, it also affected the
ability to read @RequestBody arguments that happen are parameterized
but aren't treated as such (e.g. application/x-www-form-urlencoded and
MultiValueMap<String, String>). This commit corrects the issue.

Issue: SPR-9570
2012-10-31 21:15:16 -04:00
Rossen Stoyanchev 0e3aa0eec4 Peek into the content for @RequestBody(required=false)
For @RequestBody(required=false), it is not sufficient to check if the
InputStream is null. This change reads the first byte of the request
InputStream to determine if the request body is empty or not.

If the InputStream implementation supports mark(int) and reset(), then
we use those. Otherwise we use PushbackInputStream to read and unread
the first byte.

All of this is done only if the required flag of @RequestBody is set
to "false" (default is "true").

Issue: SPR-9942
2012-10-31 21:15:15 -04:00
Sam Brannen 8bb19f05ea Fix typos in Javadoc 2012-10-31 16:22:16 +01:00
Rossen Stoyanchev 1acd5cff8f Polish methods to register async interceptors 2012-10-30 22:38:39 -04:00
Rossen Stoyanchev d701464517 Add onTimeout/onCompletion callbacks to DeferredResult
Issue: SPR-9914
2012-10-30 21:58:44 -04:00
Rossen Stoyanchev d8469d118b Fix issue with extracting matrix variables
The servlet spec recommends removing path parameters from the
contextPath, servletPath, and pathInfo but not from the requestURI.
This poses a challenge for the UrlPathHelper, which determines the
lookup path by comparing the above.

This change introduces a method that matches the requestURI to the
contextPath and servletPath ignoring path parameters (i.e. matrix
variables) for comparison purposes while also preserving them in the
resulting lookup path.
2012-10-29 19:09:00 -04:00
Rossen Stoyanchev 826057bcde Expose convenience method in MVC Java config
The new method allows modifying or overriding the
ConfigurableWebBindingInitializer instance used for data binder
initialization.

Issue: SPR-8984
2012-10-29 05:56:30 -04:00
Rossen Stoyanchev f7ec738857 Sync up MockAsyncContext implementations in src/test 2012-10-28 12:10:38 -04:00
Sam Brannen 591aa01741 Configurable locales in MockHttpServletRequest
Prior to this commit the MockHttpServletRequest constructor chain set
the preferred local to Locale.ENGLISH. Furthermore, it was possible to
add additional preferred locales "in front" of ENGLISH; however, it was
not possible to delete ENGLISH from the list of preferred locales.

This commit documents the fact that ENGLISH is the default preferred
locale and makes it possible to set the list of preferred locales via a
new setPreferredLocales(List<Locale> locales) method.

Issue: SPR-9724
2012-10-27 18:13:13 +02:00
Rossen Stoyanchev e14ba9dec3 Add config options for MVC async interceptors
The MVC namespace and the MVC Java config now allow configuring
CallableProcessingInterceptor and DeferredResultProcessingInterceptor
instances.

Issue: SPR-9914
2012-10-26 21:29:54 -04:00
Rossen Stoyanchev e4a13cd4ad Polish (minor) RequestMappingHandlerAdapter
Revise order of fields reflecting configurable vs internal fields and
also grouping them accordingly.
2012-10-26 18:24:22 -04:00
Rossen Stoyanchev f036ed639f Polish (major) MVC async processing interceptors
New afterTimeout and afterCompletion callbacks

afterTimeout can provide a concurrent result to be used instead of the
one that could not be set or returned on time

Interceptor exceptions cause async processing to resume treating the
exception as the concurrent result

Adapter classes for convenient implementation of the interfaces

Issue: SPR-9914
2012-10-26 18:04:27 -04:00
Rossen Stoyanchev c7e7e80a3a Update AbstractView with method to set content type
Before this change View implementations set the response content type
to the fixed value they were configured with.

This change makes it possible to configure a View implementation with
a more general media type, e.g. "application/*+xml", and then set the
response type to the more specific requested media type, e.g.
"application/vnd.example-v1+xml".

Issue: SPR-9807.
2012-10-22 17:23:57 -04:00
Rossen Stoyanchev dbcbdace9e Parameterize AsyncTask type 2012-10-15 12:17:39 -04:00
Rossen Stoyanchev e98dc50f99 Fix issue in PatternsRequestCondition 2012-10-15 12:17:39 -04:00
Rossen Stoyanchev dc01f088f7 Fix issue in message conversion
This change ensures that when the Accept and the Producible media types
are equally specific, we use the one from the Accept header, which may
for example carry a different charset.
2012-10-12 08:49:30 -04:00
Juergen Hoeller 014f7f0242 Changes along with 3.1.3 backport
Aside from minor polishing, this change sets the "systemProperties" and "systemEnvironment" beans at each factory level as well.

Issue: SPR-9756
Issue: SPR-9764
2012-10-10 23:34:22 +02:00
Rossen Stoyanchev d4fa5c0331 Fix NPE in AbstractMessageConverterMethodProcessor
Issue: SPR-9868
2012-10-10 09:00:43 -04:00
Rossen Stoyanchev 3552173b81 Fix issue in AnnotationMethodHandlerExceptionResolver
Caching of resovled exceptions introduced in SPR-7703 also introduced a
side effect whereby if exactly one exception was previously cached, any
other exception would appear as a match to the previously matched
@ExceptionHandler method.

This change ensures use of a fresh map when determining matching
@ExceptionHandler methods while also updating the cache.

Issue: SPR-9209
2012-10-06 21:58:34 -04:00
Rossen Stoyanchev 7718936158 Recognize wildcards in media types with a suffix
The "includes" and "isCompatibleWith" methods of MediaType take into
account media types with suffices (e.g. application/soap+xml) including
wildcards with suffices (e.g. application/*+xml). However before this
change, the isWildcardSubtype() method returned true only for subtype
"*". Now a media type such as application/*+xml is also recognized as
having a wildcard subtype.

Issue: SPR-9841
2012-10-06 10:01:56 -04:00
Rossen Stoyanchev 7513e2124a Sync up MockHttpServletResponse copies in test sources 2012-10-02 15:57:22 -04:00
Rossen Stoyanchev 4566db82f5 Polish MockFilterChain
A reset method now allows it to be invoked more than once each time
storing the request and response with which it was invoked.
2012-09-27 12:06:35 -04:00
Rossen Stoyanchev 7b30ffd522 Work around Servlet dependency in content negotiation
Before this change the PathExtensionContentNegotiationStrategy accessed
the ServletContext via request.getServletContext, which is Servlet 3
specific. To work around it, there is now a Servlet-specific sub-class
that accepts a ServletContext as a constructor argument.

The ContentNegotiationManagerFactoryBean is now ServletContextAware and
if it has a ServletContext it creates the Servlet-specific sub-class
of PathExtensionContentNegotiationStrategy.

The ContentNegotiationManagerFactoryBean is now also used in several
places internally -- MVC namespace, MVC Java config, and the
ContentNegotiatingViewResolver -- to reduce duplication.

Issue: SPR-9826
2012-09-26 09:28:43 -04:00
Rossen Stoyanchev ef9d35c473 Add PATCH to "Allow" header for OPTIONS requests 2012-09-24 19:57:04 -04:00
Phillip Webb c0729756d7 Protect RequestCondition against unkown HTTP methods
The RequestMethodsRequestCondition is now protected against HTTP
request method values not present in the RequestMethod enumeration
(e.g. PROPFIND).

Issue: SPR-9815
2012-09-21 11:05:45 -04:00
Phillip Webb b0153ada19 Polish trailing whitespace 2012-09-21 10:55:17 -04:00