Commit Graph

205 Commits

Author SHA1 Message Date
Juergen Hoeller 9317d8f43e Polishing
(cherry picked from commit caa1218)
2013-08-29 19:21:24 +02:00
Juergen Hoeller d8e3ef7640 Polishing
Issue: SPR-10752
Issue: SPR-10627
2013-08-01 00:35:51 +02:00
Juergen Hoeller ae0f23e942 Polishing
Issue: SPR-10752
Issue: SPR-10627
2013-07-31 22:42:27 +02:00
Rossen Stoyanchev 6c11fd3b5e Fix issue with parsing x-forwarded-host header
Issue: SPR-10701
2013-07-30 11:48:06 -04:00
Phillip Webb 8feeec4a60 Fix ResourceHttpRequestHandler empty location log
Fix ResourceHttpRequestHandler to only log warning when locations
is empty.

Issue: SPR-10780
(cherry picked from bc52469)
2013-07-24 16:52:47 -07:00
Rossen Stoyanchev dd7508d606 Replace assert w/ warning in ResourceHttpRequestHandl.
Issue: SPR-9186
2013-07-19 17:23:33 -04:00
Rossen Stoyanchev 3bf56dda56 Fix issue in MappingJacksonJsonView
Issue: SPR-10752
2013-07-19 17:23:33 -04:00
Rossen Stoyanchev 7fdd0c22b2 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 22:03:13 -04:00
Juergen Hoeller b6e20a4cc9 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
(cherry picked from commit 28164b4)
2013-05-16 00:02:31 +02:00
Rossen Stoyanchev 9c194699c7 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:30:59 -04:00
Rossen Stoyanchev 4bb0916202 Delay check if pattern ends with slash
This is a minor fix with no actual impact.

Issue: SPR-10504
2013-05-10 12:51:48 -04:00
Rossen Stoyanchev 399f887128 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 12:51:20 -04:00
Rossen Stoyanchev 532a7a3a02 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 12:50:24 -04:00
Juergen Hoeller 5bdd2d245c 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
(cherry picked from commit 9c09a0a)
2013-04-30 23:29:03 +02: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
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