Commit Graph

5393 Commits

Author SHA1 Message Date
Chris Beams 2ec7834124 Resolve nested placeholders via PropertyResolver
Prior to this change, PropertySourcesPropertyResolver (and therefore
all AbstractEnvironment) implementations failed to resolve nested
placeholders as in the following example:

    p1=v1
    p2=v2
    p3=${v1}:{$v2}

Calls to PropertySource#getProperty for keys 'p1' and 'v1' would
successfully return their respective values, but for 'p3' the return
value would be the unresolved placeholders. This behavior is
inconsistent with that of PropertyPlaceholderConfigurer.

PropertySourcesPropertyResolver #getProperty variants now resolve any
nested placeholders recursively, throwing IllegalArgumentException for
any unresolvable placeholders (as is the default behavior for
PropertyPlaceholderConfigurer). See SPR-9569 for an enhancement that
will intoduce an 'ignoreUnresolvablePlaceholders' switch to make this
behavior configurable.

This commit also improves error output in
PropertyPlaceholderHelper#parseStringValue by including the original
string in which an unresolvable placeholder was found.

Issue: SPR-9473, SPR-9569
2012-07-06 15:45:40 +02:00
Rossen Stoyanchev b9786ccaca Fix minor issue in HandlerMethod
Before this change HandlerMethod used ClassUtils.getUserClass(Class<?>)
to get the real user class, and not one generated by CGlib. However it
failed to that under all circumstances. This change fixes that.

Issue: SPR-9490
2012-07-05 16:02:36 -04:00
Rossen Stoyanchev a4240d2864 Add defaultCharset field to StringHttpMessageConverter
Before this change the StringHttpMessageConverter used a fixed charset
"ISO-8859-1" if the requested content type did not specify one. This
change adds a defaultCharset field and a constructor to configure it in
StringHttpMessageConverter.

Issue: SPR-9487
2012-07-05 15:53:49 -04:00
Juergen Hoeller 4d297b475c preparations for 3.2 M2 2012-07-05 00:50:35 +02:00
Juergen Hoeller d97a4b5b3c polishing 2012-07-05 00:31:51 +02:00
Juergen Hoeller 596571059e DispatcherPortlet does not forward event exceptions to the render phase by default
Issue: SPR-9287
2012-07-05 00:19:01 +02:00
Juergen Hoeller 8bd1fd3715 moved getInputStream() not-null requirement to InputStreamSource itself; removed misleading "throws IllegalStateException" declaration
Issue: SPR-9561
2012-07-04 23:32:49 +02:00
Juergen Hoeller 5a7b3f65ec added "repeatCount" bean property to Quartz SimpleTriggerFactoryBean
Issue: SPR-9521
2012-07-04 23:22:01 +02:00
Juergen Hoeller fdb9de1445 Use BufferedInputStream in SimpleMetaDataReader to double performance
Issue: SPR-9528
2012-07-04 22:58:58 +02:00
Juergen Hoeller 309e51ba5b refined fix so that XStreamMarshaller does not wrap IllegalArgumentException
Issue: SPR-9536
2012-07-04 22:58:57 +02:00
Rossen Stoyanchev e870c9a392 Reduce logging in HandlerExecutionChain
Before this change the HandlerExecitionChain logged errors each time a
an AsyncHandlerInterceptor returned a null async Callable, a condition
which is acceptable.

SPR-9524
2012-07-02 17:56:39 -04:00
Rossen Stoyanchev 8fbfe9b502 Merge pull request #101 from philwebb/SPR-9530
* SPR-9530:
  Improve SimpleStreamingClientHttpRequest performance
2012-07-02 17:05:44 -04:00
Phillip Webb ecc6a5aed2 Improve SimpleStreamingClientHttpRequest performance
Ensure that NonClosingOutputStream calls with a byte array call the
corresponding methods of the underlying OutputStream rather than
relying on the default NonClosingOutputStream implementation, which
writes one bte at a time. This significantly improves performance.

Issues: SPR-9530
2012-07-02 17:03:07 -04:00
Chris Beams dc822cdca0 Reflect 3.2=>3.1.2 backports in @since tags etc
Issue: SPR-9443, SPR-6847, SPR-9446, SPR-9444, SPR-9439, SPR-9302,
       SPR-9507, SPR-9238, SPR-9397, SPR-9406, SPR-9502
2012-06-27 23:07:48 +02:00
Chris Beams f6de5d4360 Reflect @Async executor qual. 3.2=>3.1.2 backport
@Async executor qualification has been backported to 3.1.2. This commit
updates all @since tags appropriately, as well as carrying over the
changes backported to the spring-task-3.1 schema.

Issue: SPR-6847, SPR-9443
2012-06-27 23:04:25 +02:00
Rossen Stoyanchev 7dff02b2c1 Fix import issue introduced in prior commit
Issue: SPR-9289
2012-06-26 18:07:12 -04:00
Rossen Stoyanchev 3f5fa44d32 Polish PathVariableMapMethodArgumentResolver
Return an empty map when there are no path variables, rather than
raising an exception. This is consistent with similar resolvers for
extracting headers and request parameters.

Issue: SPR-9289
2012-06-26 10:23:01 -04:00
Rossen Stoyanchev 4fd7645efd Enable smart suffix pattern match for request mapping
Following the introduction of ContentNegotiationManager that allows,
among other things, to configure the file extensions to use for content
negotiation, this change adds "smart" suffix pattern match that matches
against the configured file extensions only rather than against any
extension.

Given the request mapping "/jobs/{jobName}" and one configured file
extension ("json"), a request for "/jobs/my.job" will select the
pattern "/jobs/{jobName}" while a request for "/jobs/my.job.json" will
select the pattern "/jobs/{jobName}.json". Previously, both requests
would have resulted in the pattern "/jobs/{jobName}.*".

Issue: SPR-7632, SPR-8474
2012-06-25 21:30:10 -04:00
Rossen Stoyanchev f94aed8386 Polish ContentNegotiationStrategy support
Issue: SPR-8410, SPR-8417, SPR-8418,SPR-8416, SPR-8419,SPR-7722
2012-06-25 15:24:05 -04:00
Rossen Stoyanchev 4623568bce Polish client support for HTTP PATCH
Issue: SPR-7985
2012-06-25 14:13:35 -04:00
Chris Beams 8e568466dc Work around apparent bug in README markdown parsing
The exact text above the "Staying in touch" section caused "Staying in
touch" to lose it's formatting as a second-level heading.  Adding
" for details" to the sentence above works around the problem.
2012-06-25 19:42:22 +02:00
Chris Beams c85b611600 Update copyright header for XStreamMarshaller
Issue: SPR-9536
2012-06-25 14:27:05 +02:00
Arjen Poutsma 4c29ad76e0 XStreamMarshaller wraps exception for empty stream
XStreamMarshaller should convert XStream StreamException to Spring
exception in case of unmarshalling an empty stream.

Issue: SPR-9536
2012-06-25 11:34:51 +02:00
Rossen Stoyanchev a0747458e7 Add support for HTTP PATCH method
The HTTP PATCH method is now supported whereever HTTP methods are used.
Annotated controllers can be mapped to RequestMethod.PATCH.

On the client side the RestTemplate execute(..) and exchange(..)
methods can be used with HttpMethod.PATCH. In terms of HTTP client
libraries, Apache HttpComponents HttpClient version 4.2 or later is
required (see HTTPCLIENT-1191). The JDK HttpURLConnection does not
support the HTTP PATCH method.

Issue: SPR-7985
2012-06-22 16:57:22 -04:00
Rossen Stoyanchev f05e2bc56f Add abstractions for content negotiation
Introduced ContentNeogtiationStrategy for resolving the requested
media types from an incoming request. The available implementations
are based on path extension, request parameter, 'Accept' header,
and a fixed default content type. The logic for these implementations
is based on equivalent options, previously available only in the
ContentNegotiatingViewResolver.

Also in this commit is ContentNegotiationManager, the central class to
use when configuring content negotiation options. It accepts one or
more ContentNeogtiationStrategy instances and delegates to them.

The ContentNeogiationManager can now be used to configure the
following classes:

- RequestMappingHandlerMappingm
- RequestMappingHandlerAdapter
- ExceptionHandlerExceptionResolver
- ContentNegotiatingViewResolver

Issue: SPR-8410, SPR-8417, SPR-8418,SPR-8416, SPR-8419,SPR-7722
2012-06-22 11:55:46 -04:00
Chris Beams 35055fd866 Refactor PropertyResolver impl for consistency
PropertySourcesPropertyResolver#containsProperty now
calls #containsProperty on each underlying PropertySource instead of
calling #getProperty and checking for null.

Issue: SPR-9529
2012-06-21 12:53:51 +02:00
Sam Brannen 027e49c58a Document default scripts for embedded databases
The reference manual currently documents the wrong file name for the
default data SQL script used by EmbeddedDatabaseBuilder. In addition,
the testing chapter of the reference manual does not link to the testing
section of the JDBC chapter.

 - Updated the "Testing data access logic with an embedded database"
   section of the reference manual appropriately.
 - Added a new paragraph to the "JDBC Testing Support" section of the
   testing chapter which cross references the "Testing data access logic
   with an embedded database" section.

Issue: SPR-9467
2012-06-19 20:48:07 +02:00
Sam Brannen 5eae22abb8 Document SPR-9493 in the changelog
Issue: SPR-9493
2012-06-19 20:13:46 +02:00
Sam Brannen e3d8ab2088 Fix Javadoc typo in ConfigurableWebEnvironment 2012-06-19 19:34:38 +02:00
Chris Beams 08498d57dd Fix line endings in new JacksonObjectMapper classes
Commit aa415d7c0c introduced
JacksonObjectMapperFactoryBean and associated tests, but with Windows
(CRLF) line endings instead of the conventional Unix (LF) line endings.

This commit converts these files to LF endings using the handy
`dos2unix` utility.

Issue: SPR-9125
2012-06-19 18:14:56 +02:00
Sam Brannen 64d6605974 Merge pull request #97 from sbrannen/SPR-9493
* SPR-9493:
  Infer return type of parametrized factory methods
2012-06-19 18:07:28 +02:00
Sam Brannen c461455c7c Infer return type of parametrized factory methods
Currently, if a factory method is parameterized and the corresponding
variable types are declared on the method itself instead of on the
enclosing class or interface, Spring always predicts the return type to
be Object, even if the return type can be explicitly inferred from the
method signature and supplied arguments (which are available in the bean
definition).

This commit introduces a new resolveParameterizedReturnType() method in
GenericTypeResolver that attempts to infer the concrete type for the
generic return type of a given parameterized method, falling back to the
standard return type if necessary. Furthermore,
AbstractAutowireCapableBeanFactory now delegates to
resolveParameterizedReturnType() when predicting the return type for
factory methods.

resolveParameterizedReturnType() is capable of inferring the concrete
type for return type T for method signatures similar to the following.
Such methods may potentially be static. Also, the formal argument list
for such methods is not limited to a single argument.

 - public <T> T foo(Class<T> clazz)
 - public <T> T foo(Object obj, Class<T> clazz)
 - public <V, T> T foo(V obj, Class<T> clazz)
 - public <T> T foo(T obj)

Issue: SPR-9493
2012-06-19 18:05:41 +02:00
Chris Beams 9fc05a80d0 Reformat and add links to README
The readme is heavy on links and hard to read in source form when using
typical inline Markdown links. The following changes have been made to
increase readability.

 - Wrap lines at 80 characters
 - Use 'implicit link name' shortcut syntax as described at [1]
 - Add link to 'spring-mvc' Stack Overflow tag as well
 - Add link to new 'lifecycle of an issue' wiki doc

[1]: http://daringfireball.net/projects/markdown/syntax
2012-06-19 17:56:18 +02:00
Chris Beams e5bbec7e2b Add Gradle task for building zip with dependencies
Some Spring Framework users and teams cannot use transitive dependency
management tools like Maven, Gradle and Ivy. For them, a `distZip` task
has been added to allow for creating a Spring Framework distribution
from source that includes all optional and required runtime
dependencies for all modules of the framework.

This 'dist-with-deps' zip is not published to the SpringSource
repository nor to the SpringSource community download page. It is
strictly an optional task introduced as a convenience to the users
mentioned above.

Detailed instructions for building this zip locally have been added to
the wiki and the README has been updated with a link to that new doc.

Issue: SPR-6575
2012-06-19 16:49:31 +02:00
Sam Brannen 726655af50 Fix outdated Javadoc in the TestContext framework
Fixed outdated Javadoc regarding support for 'annotated classes' in
the TestContext Framework.
2012-06-19 12:52:24 +02:00
Chris Beams de04d9c654 Fix typo in MessageSource reference docs
Issue: SPR-5022
2012-06-19 11:56:05 +02:00
Rossen Stoyanchev 7dcca4bcfb Merge pull reqest #88 from dmak/SPR-9125
* SPR-9125:
  BeanFactory for configuring a Jackson ObjectMapper
2012-06-18 17:13:35 -04:00
Dmitry Katsubo aa415d7c0c BeanFactory for configuring a Jackson ObjectMapper
The BeanFactory makes it easier to configure a customized Jackson
ObjectMapper (for example enable/disable certain features).
This bean factory is usually used with
MappingJacksonHttpMessageConverter or MappingJacksonJsonView.
See JavaDoc for examples.

Issue: SPR-9125
2012-06-18 17:12:09 -04:00
Rossen Stoyanchev 5959de5d9e Merge pull reqest #92 from DavidBiesack/master
* DavidBiesack-master:
  Minor fix in Javadoc for RequestMapping
2012-06-18 07:22:45 -04:00
David J. Biesack 7cd0b16403 Minor fix in Javadoc for RequestMapping
Issue: SPR-9483
2012-06-18 07:20:03 -04:00
Rossen Stoyanchev 277a115f8b Minor Javadoc fix
Issue: SPR-9513
2012-06-18 06:30:34 -04:00
Chris Beams e8bf25ba9d Merge pull request #95 from rstoyanchev/SPR-4984
* rstoyanchev/SPR-4984:
  Add splitIndex Javadoc option to the root project
2012-06-15 11:01:18 +02:00
Rossen Stoyanchev b0f80d6358 Add splitIndex Javadoc option to the root project
Splits the very large index page with all classes into individual pages
organized by first letter.

Issue: SPR-4984
2012-06-14 12:17:54 -04:00
Rossen Stoyanchev 2abcdaab1e Merge pull request #93 from maxcom/SPR-8917
* SPR-8917:
  Allow parsing of media types with single-quotes
2012-06-14 08:55:18 -04:00
Maxim Valyanskiy 7cdc53487d Allow parsing of media types with single-quotes
Previously MediaType could only parse double-quoted parameters without
raising an IllegalArgumentException. Now parameters can also be
single-quoted.

Issue: SPR-8917
2012-06-14 08:51:52 -04:00
Rossen Stoyanchev ab4952a959 Raise RestClientException for unknown status codes
HttpStatus cannot be created with an unknown status code. If a server
returns a status code that's not in the HttpStatus enum values, an
IllegalArgumentException is raised. Rather than allowing it to
propagate as such, this change ensures the actual exception raised is
a RestClientException.

Issue: SPR-9406
2012-06-13 08:27:16 -04:00
Chris Beams 0e3a1d8176 Require aopalliance dependency for spring-aop
A recent commit made aopalliance optional for spring-aop, while
continuing to require it for spring-tx. On review, this is probably
overly aggressive, and for convenience aopalliance should remain
required for spring-aop. There are use cases for which aopalliance is
indeed optional, but core functionality such as <aop:scoped-proxy>
should never result in a ClassNotFoundException.

This commit returns the aopalliance dependency for spring-aop to
required status, and also explicitly notes the same dependency in other
modules that compile directly against aopalliance types.

Issue: SPR-9501
2012-06-13 13:47:47 +02:00
Chris Beams 49fd20319d Upgrade to Gradle 1.0 GA
Issue: SPR-9494
2012-06-12 11:16:08 +02:00
Sam Brannen 369d77bdf0 spring-test module now depends on junit:junit-dep
The junit:junit Maven artifact includes a bundled version of hamcrest
core. For projects that depend on later versions of hamcrest this causes
significant issues in terms of dependency management.

The spring-test module now depends on junit:junit-dep, thus allowing
developers to better manage their test dependencies on a more fine
grained level.

Also tidied up dependency issues regarding hamcrest-core and
hamcrest-all across the build.

Issue: SPR-6966
2012-06-10 02:39:27 +02:00
Sam Brannen 04a6827290 Reproduce claims raised in SPR-8849
This commit introduces a test suite (Spr8849Tests) that demonstrates
the claims made in SPR-8849.

Specifically, if <jdbc:embedded-database id="xyz" /> is used to create
an embedded HSQL database in an XML configuration file and that
configuration file is imported in different sets of configuration files
that are used to load ApplicationContexts for different integration
tests, the embedded database will be initialized multiple times using
any nested <jdbc:script /> elements. If such a script is used to create
a table, for example, subsequent attempts to initialize the database
named "xyz" will fail since an embedded database named "xyz" already
exists in the JVM.

As a work-around, this test suite uses a SpEL expression to generate a
random string for each embedded database instance:

  id="#{T(java.util.UUID).randomUUID().toString()}"

See the Javadoc in Spr8849Tests for further information.

Issue: SPR-8849
2012-06-10 00:31:05 +02:00