Commit Graph

141 Commits

Author SHA1 Message Date
Juergen Hoeller 0c51cd7fd3 Polishing 2012-12-04 15:38:06 +01:00
Juergen Hoeller 738c643592 Deprecated JSF 1.1 VariableResolver implementations in favor of Spring-provided ELResolvers 2012-12-04 15:38:05 +01:00
Sam Brannen e16f3b95cb Fix typo in Javadoc 2012-12-04 14:29:54 +01:00
Rossen Stoyanchev 7ff964afa8 Add JSON converters to FormHttpMessageConverter
The FormHttpMessageConverter now adds Jackson JSON converters
(version 1.x or 2.x) if available on the classpath.

Issue: SPR-10055
2012-12-03 15:11:13 -05:00
Rossen Stoyanchev d3c977b54b Fix failing tests failing when debug logging is on
Issue: SPR-10048
2012-12-03 15:11:12 -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
Rob Winch 1e62ad8665 Add beforeConcurrentHandling support
Previously CallableProcessingInterceptor and
DeferredResultProcessingInterceptor did not have support for capturing
the state of the original Thread just prior to processing. This made it
difficult to transfer the state of one Thread (i.e. ThreadLocal) to the
Thread used to process the Callable.

This commit adds a new method to CallableProcessingInterceptor and
DeferredResultProcessingInterceptor named beforeConcurrentHandling
which will be invoked on the original Thread used to submit the Callable
or DeferredResult. This means the state of the original Thread can be
captured in beforeConcurrentHandling and transfered to the new Thread
in preProcess.

Issue: SPR-10052
2012-11-30 11:10:07 -05: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 62ccc8dd7e 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:15:10 +01:00
Juergen Hoeller 9772eb8410 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-25 20:50:53 +01:00
Rossen Stoyanchev e3681c107d Set response to 503 for async requests that time out
Issue: SPR-10002
2012-11-22 15:39:22 -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
Juergen Hoeller ea95da126a Implement java.io.Closeable where appropriate
Issue: SPR-9962
2012-11-08 23:44:49 +01:00
Rossen Stoyanchev f528c39456 Add UnknownHttpStatusCodeException
This is more specific exception raised instead of RestClientException
when the raw HTTP status code received from the server is not one of
the HttpStatus enum values.

Issue: SPR-9406
2012-11-02 13:47:24 -04: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
Juergen Hoeller 7fdb637df0 Clarified ServletConfigAware behavior in case of no ServletConfig being available
Issue: SPR-9855
2012-10-31 09:38:12 +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 5d04ef4c4a Support selective filtering of error dispatches
OncePerRequestFilter now allows sub-classes to choose whether they
should ever get involved in processing an error dispatch.

Issue: SPR-9895
2012-10-28 12:47:00 -04:00
Rossen Stoyanchev d952da2338 Polish (minor) async support in filters
Issue: SPR-9895
2012-10-28 12:10:38 -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 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 cb86712187 Provide method to set async TimeoutHandler
Issue: SPR-9914
2012-10-25 12:35:23 -04:00
Rossen Stoyanchev b093b30315 Polish DeferredResult
After this change a DeferredResult can be set before a
DeferredResultHandler has been set.
2012-10-25 11:29:05 -04:00
Marten Deinum 5a91d60788 Allow setting WSDL document as a Resource
Prior to this change, LocalJaxWsServiceFactory allowed specifying a WSDL
document URL. Now users may also specify a WSDL document represented as
a Spring Resource object for convenience.

Issue: SPR-9909
2012-10-25 15:04:24 +02:00
Tim Meighen e16c40359a Support wildcard style media types in JSON converters
Add "application/*+json" to supported media types for both Jackson
message converters.

Issue: SPR-7905
2012-10-22 16:40:02 -04:00
Rossen Stoyanchev 2e1a68893d Update HttpHeaders.getAccept method
Some servlet containers (iPlanet) parse the Accept header and return
multiple values from request.getHeader("Accept"). The HttpHeaders
getAccept method has been updated to accommodate that hopefully
without causing any other issues.

The extra functionality is in effect only if we find only one
MediaType and there is more than one value for the 'Accept' header.

Issue: SPR-9655
2012-10-22 16:09:33 -04:00
Rossen Stoyanchev 0721146b14 Improve regex for parsing query params
Previously UriComponentsBuilder used a regular expression for parsing
query name-value pairs where both name and value were expected to not
contain neither '&', not '='. The idea is that the presence of reserved
characters makes it impossible to guess correctly how to parse the
query string (e.g. a=b&c).

This change relaxes the constraint on query param values, allowing them
to contain '='. In effect '&' is the ultimate separator of name-value
pairs, and any '=' in values is ignored. For example "q=1USD=?EUR" is
interpreted as "q equals '1USD=?EUR'".

Issue: SPR-9832
2012-10-22 11:04:48 -04:00
Rossen Stoyanchev dbcbdace9e Parameterize AsyncTask type 2012-10-15 12:17:39 -04:00
Juergen Hoeller 9eeb6f15e5 Minor changes along with 3.1.3 backport
Issue: SPR-9798
Issue: SPR-9804
2012-10-10 23:34:21 +02:00
Juergen Hoeller 6445f09c36 Consistently upgraded Apache HttpComponents usage to 4.2
Issue: SPR-9475
2012-10-10 14:28:53 +02:00
Juergen Hoeller 8bdc6be074 Consistent "this." reference to local variable 2012-10-10 14:28:52 +02:00
Juergen Hoeller 93aa411886 HttpComponentsHttpInvokerRequestExecutor uses HttpComponents 4.2 to explicitly release connections
Issue: SPR-9833
2012-10-10 14:28:51 +02:00
Rossen Stoyanchev 3eda02d1b4 Update MediaType's includes method
An additional update (after the last commit) of the "includes" and
"isCompatibleWith" methods of MediaType to accomodate wildcards
in media types with a suffix.

Issue: SPR-9841
2012-10-06 10:56:32 -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
Sam Brannen 4812c181d4 Polish LiveBeansView Javadoc and suppress warnings 2012-10-04 14:10:52 +02: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 2bb0104556 Polish ObjectToStringHttpMessageConverter
Issue: SPR-9738
2012-09-25 19:32:26 -04:00
Arjen Poutsma 6e45a79ecb Support opaque URIs in UriComponentsBuilder
Before this commit, UriComponentsBuilder did not handle opaque URIs at
all. After this commit it does.

Support is introduced by making UriComponents an abstract base class,
and having two concrete subclasses: HierarchicalUriComponents and
OpaqueUriComponents. The former is more or less the same as the old
UriComponents class.

Issue: SPR-9798
2012-09-25 10:18:49 -04:00
Dmitry Katsubo b2037c8316 Add ObjectToStringHttpMessageConverter
This new converter uses StringHttpMessageConverter internally combined
with a ConversionService for converting String content to and from the
target object type.

Issue: SPR-9738
2012-09-25 09:02:27 -04:00
Ritesh Rathore 0baa1a56c2 Add URI and method name on ResourceAccess
Issue: SPR-9325
2012-09-24 19:36:45 -04:00
Dmitry Katsubo 950786a8cc Add Jackson2ObjectMapperBeanFactory
Issue: SPR-9739
2012-09-24 19:22:33 -04:00
Juergen Hoeller e5f3669804 Introduced beta version of LiveBeansView for STS 3.1
LiveBeansView includes MBean exposure as well as Servlet exposure, with JSON as the initial output format. In order to identify an MBean per application, a new "getApplicationName()" method got introduced on the ApplicationContext interface, returning the Servlet container context path in case of a web application and defaulting to the empty String. MBean exposure can be driven by the "spring.liveBeansView.mbeanDomain" property, e.g. specifying "liveBeansView" as its value, leading to "liveBeansView:application=" or "liveBeansView:application=/myapp" style names for the per-application MBean.

Issue: SPR-9662
2012-09-24 23:15:58 +02:00
Juergen Hoeller 53ae345a88 Moved JacksonObjectMapperFactoryBean from web.context.support to http.converter.json
Issue: SPR-9125
2012-09-24 11:39:09 +02:00