Commit Graph

671 Commits

Author SHA1 Message Date
Arjen Poutsma 7de0a70f0c Netty support for (Async)RestTemplate
This commit introduces an AsyncClientHttpRequestFactory based on Netty
4, for use with the (Async)RestTemplate.
2014-10-27 13:57:37 -04:00
Sam Brannen 6463878f2d Polish Javadoc for @RequestMapping 2014-10-24 14:59:58 +02:00
Brian Clozel a0c210457b Use response encoding when escaping HTML
With SPR-9293, it is now possible to HTML escape text while taking into
account the current response encoding. When using UTF-* encodings, only
XML markup significant characters are escaped, since UTF-* natively
support those characters.

This commit adds a new servlet context parameter to enable this fix by
default in a Spring MVC application:

    <context-param>
      <param-name>responseEncodedHtmlEscape</param-name>
      <param-value>true</param-value>
    </context-param>

Issue: SPR-12350, SPR-12132
2014-10-24 11:53:47 +02:00
Rossen Stoyanchev d5eb669416 Add mention of java.util.Optional in @MVC
Issue: SPR-12370
2014-10-23 16:53:00 -04:00
Craig Andrews d5bf6713ed Add author attribution for htmlEscape methods
Issue: SPR-9293
2014-10-23 11:29:32 -07:00
Juergen Hoeller 2035b17925 Polishing 2014-10-23 17:24:00 +02:00
Sebastien Deleuze 1c217aae40 Support text/xml and application/*+xml in Jackson XML message converter
Issue: SPR-12366
2014-10-23 16:48:11 +02:00
Rossen Stoyanchev 051c5fb66a Update javadoc 2014-10-22 22:28:21 -04:00
Rossen Stoyanchev df090235bb Update documentation for Map arguments
Issue: SPR-12347
2014-10-22 22:17:51 -04:00
Brian Clozel a011b360d1 Polish SPR-12286
Issue: SPR-12286
2014-10-22 21:15:34 +02:00
Brian Clozel 86d97baf65 Allow defining default content negotiation strategy
During the HTTP Content Negotiation phase, the ContentNegotiationManager
uses configured ContentNegotiationStrategy(ies) to define the list of
content types accepted by the client.

When HTTP clients don't send Accept headers, nor use a configured
file extension in the request, nor a request param, developers can
define a default content type using the
ContentNegotiationConfigurer.defaultContentType() method.

This change adds a new overloaded defaultContentType method that takes a
ContentNegotiationStrategy as an argument. This strategy will take the
current request as an argument and return a default content type.

Issue: SPR-12286
2014-10-22 16:32:12 +02:00
Juergen Hoeller 3106905877 Polishing 2014-10-22 01:19:14 +02:00
Brian Clozel 369cabf064 Conditionally htmlEscape chars based on encoding
This commit adds new htmlEscape methods that take the character encoding
as a parameter. According to specs and recommendations, the list of
chars to be html escaped depends on the encoding used in the response.
If the current char encoding supports chars natively, we shouldn't
escape those; of course, reserved chars (<,>,',",&) should always be
escaped.

See: http://www.w3.org/TR/html4/sgml/entities.html#h-24.3
See: spring-projects/spring-framework#385 by @candrews

Issue: SPR-9293
2014-10-21 17:49:37 +02:00
Sam Brannen 66069333f1 Fix JUnit imports in SourceHttpMessageConverterTests
When org.junit.Assert.* is statically imported, the class does not
compile in Eclipse/STS since XMLAssert extends junit.framework.Assert.
2014-10-21 16:18:23 +02:00
Juergen Hoeller 8325b10080 Consistent formatting of license headers, package javadocs, and import declarations 2014-10-21 01:44:07 +02:00
Rossen Stoyanchev 956b66bbd4 Fix issue with async return value type determination
Before this change, the type of asynchronously produced return values
(e.g. Callable, DeferredResult, ListenableFuture) could not be
properly determined with an actual resulting value of null. Or even
with an actual value returned, the generic type could not be properly
determined. This change fixes both of those issues.

Issue: SPR-12287
2014-10-15 16:39:03 -04:00
Juergen Hoeller c7e7d11156 Polishing 2014-10-14 14:27:03 +02:00
Juergen Hoeller d501137f4e Consistently accept empty Content-Type header and empty character encoding
Issue: SPR-12173
2014-10-14 14:26:07 +02:00
Juergen Hoeller 0fb8f0b469 Polishing 2014-10-13 17:58:15 +02:00
Juergen Hoeller 8760be7d64 ResponseEntity's HeadersBuilder allows for specifying existing HttpHeaders
Issue: SPR-12324
2014-10-13 17:22:27 +02:00
Brian Clozel 0a68d265fb Polish indentation 2014-10-08 17:02:26 +02:00
Sebastien Deleuze f518ad9009 Add (de)serializerByType() and mixIn() to Jackson2ObjectMapperBuilder
Issue: SPR-12313
2014-10-08 10:57:29 +02:00
Tadaya Tsuyukubo 25bb58a1e8 Add shortcuts for Jackson mix-in annotations registration
This commit adds support for direct Jackson mix-in annotations registration in
Jackson2ObjectMapperFactoryBean and Jackson2ObjectMapperBuilder.

Issue: SPR-12144
2014-10-07 18:07:00 +02:00
Juergen Hoeller 20a8416c2e Jackson2ObjectMapperBuilder allows for regular constructor usage as well
Issue: SPR-12243
2014-10-01 02:29:46 +02:00
Juergen Hoeller 3a3c52dbdd Polishing 2014-10-01 01:10:25 +02:00
Juergen Hoeller d778037f40 Jackson2ObjectMapperFactoryBean builds on revised Jackson2ObjectMapperBuilder now
Issue: SPR-12243
2014-10-01 01:04:16 +02:00
Juergen Hoeller 69998e3d50 Remove outdated references to ContextLoaderServlet
Issue: SPR-7725
(cherry picked from commit b45d08f)
2014-10-01 01:02:56 +02:00
Sam Brannen 62fc39cca1 Suppress warnings in MappingJackson2XmlHttpMessageConverterTests 2014-09-30 16:58:47 +02:00
Sebastien Deleuze 77abe07807 Set Jackson DEFAULT_VIEW_INCLUSION property to false by default
Issue: SPR-12179
2014-09-30 05:18:15 +02:00
Sebastien Deleuze 42aef5f5dc Set Jackson FAIL_ON_UNKNOWN_PROPERTIES property to false by default
Issue: SPR-11891
2014-09-30 05:18:15 +02:00
Sebastien Deleuze 4e24d66ff7 Create a builder for Jackson ObjectMapper
Jackson2ObjectMapperBuilder now allows to create ObjectMapper and XmlMapper
instances easily thanks to its fluent API.

This builder is used in Jackson message converters and views to instantiate default
ObjectMapper and XmlMapper.

This commit also add a createXmlMapper property to
Jackson2ObjectMapperFactoryBean in order to allow to create easily a XmlMapper
instance.

Issue: SPR-12243
2014-09-30 05:18:15 +02:00
Juergen Hoeller 7bc8e5199e Polishing 2014-09-29 23:50:23 +02:00
Juergen Hoeller 7f43f02a13 FormHttpMessageConverter uses a delegate class for JavaMail-based MIME encoding (isolating the JavaMail API dependency)
Issue: SPR-12108
2014-09-29 22:35:13 +02:00
Juergen Hoeller bf99d6a3b5 WebAsyncManager avoids concurrentResult.toString() and builds correct DeferredResultProcessingInterceptor keys
Issue: SPR-12253
2014-09-26 14:15:21 +02:00
Sam Brannen 24d09a3b8d Fix Javadoc link to DEFAULT_NONE in @RequestMapping 2014-09-26 12:56:25 +02:00
Rossen Stoyanchev 2a64834a44 Fix test dependency 2014-09-26 00:03:46 -04:00
Rossen Stoyanchev 9be0cf21e5 Support writing multipart non-ASCII file names
Issue: SPR-12108
2014-09-25 18:00:55 -04:00
Rossen Stoyanchev 6cbe1433e2 Polish FormHttpMessageConverter 2014-09-25 16:32:01 -04:00
Juergen Hoeller 1f3e195dac Polishing 2014-09-25 17:00:45 +02:00
Juergen Hoeller cfc821d179 DataBinder unwraps Optional objects and allows for proper handling of Optional.empty()
Issue: SPR-12241
2014-09-25 17:00:36 +02:00
Brian Clozel 26326fb40b Mention DEFAULT_NONE in @RequestMapping's Javadoc
This change mentions `ValueConstants.DEFAULT_NONE` in @RequestMapping's
Javadoc, in order to explain the default value.

Issue: SPR-9967
2014-09-22 18:38:19 +02:00
Brian Clozel b9348bb89c Fix Protobuf support - HTTP headers already written
Prior to this commit, the `ProtobufHttpMessageConverter` would call
`outputMessage.getBody()` at the beginning of the `writeInternal`
method, thus writing HTTP headers. Since this method is trying to write
"x-protobuf" headers after that, protobuf support wasn't working
properly for the default "x-protobuf" media type.

Thanks Toshiaki Maki for the repro project!

Also fixed:
* improve `MockHttpOutputMessage` behavior to reproduce the read-only
state of HTTP headers once they've been written.

Issue: SPR-12229
2014-09-22 14:02:35 +02:00
Sebastien Deleuze 2989fe4203 Support Jackson based XML serialization in RestTemplate
Issue: SPR-12225
2014-09-22 01:10:21 +02:00
Sam Brannen 4aa97f8945 Remove references to CommonsHttpInvokerRequestExecutor 2014-09-21 19:53:54 +02:00
Phillip Webb 2667956a30 Initialize JNDI to fix failing Environment test
Issue: SPR-12223
2014-09-20 09:01:16 -07:00
Juergen Hoeller a833889c2a Polishing 2014-09-17 21:55:46 +02:00
Juergen Hoeller 15320db414 Polishing 2014-09-17 02:35:41 +02:00
Juergen Hoeller f394c8aa2a Polishing
Issue: SPR-12196
2014-09-16 15:03:21 +02:00
Juergen Hoeller 26a93b6a33 Client request implementations enforce RFC 6265 (cookies in a single header)
Issue: SPR-12196
2014-09-16 15:02:21 +02:00
Juergen Hoeller 70412a9d0a Accept empty Content-Type header
Issue: SPR-12173
2014-09-12 16:44:56 +02:00
Juergen Hoeller 1e7bfd91a7 Polishing 2014-09-10 01:28:54 +02:00
Juergen Hoeller 5790fc904a Consistent support for java.util.Optional for all applicable handler method arguments
Issue: SPR-12171
2014-09-10 01:27:46 +02:00
Juergen Hoeller c8bbd0bae4 Polishing 2014-09-07 22:51:21 +02:00
Juergen Hoeller a5a56d5052 Polishing 2014-09-04 11:20:11 +02:00
Juergen Hoeller 81ba3b33f6 Dropped RequestEntity's template variable methods in order to remove dependencies on org.springframework.web
Instead, as outlined in the revised javadoc, let's recommend manual UriTemplate usage for RequestEntity URI input.

Issue: SPR-11752
2014-09-04 11:19:59 +02:00
Juergen Hoeller d75f128752 Polishing 2014-09-04 03:03:12 +02:00
Juergen Hoeller 86b7118da8 Polishing 2014-09-04 02:30:25 +02:00
Juergen Hoeller 20c2ba35dc Polishing 2014-09-04 00:55:38 +02:00
Juergen Hoeller f4f7f40f18 Test for actual HttpInvokerProxyFactoryBean usage with plain FactoryBean return type
Issue: SPR-12141
2014-09-04 00:33:36 +02:00
Sebastien Deleuze 36542549fa Add HTTP status to ServletRequestHandledEvent
Issue: SPR-12119
2014-08-29 21:47:03 -04:00
Rossen Stoyanchev a0b231d36d Update port related code in UriComponentsBuilder
Use null to indicate no port has been provided.
Raise exception when port has not been expanded.

Issue: SPR-12123
2014-08-29 09:21:15 -04:00
Sebastien Deleuze 8fbd310b07 Support port URI template variables
This commit makes it possible to specify port with an URI template variable.

For example :
RestTemplate restTemplate = new RestTemplate();
restTemplate.getForObject("http://localhost:{port}/resource", String.class, 8080);

Issue: SPR-12123
2014-08-29 08:59:11 -04:00
Juergen Hoeller b93dd95475 Polishing 2014-08-22 22:55:57 +02:00
Juergen Hoeller 439ce4a1a5 Polishing
Issue: SPR-12112
2014-08-22 14:00:28 +02:00
Arjen Poutsma dbe337f932 ResponseEntity provides static "badRequest()" convenience method as well
Issue: SPR-12112
2014-08-22 13:36:45 +02:00
Juergen Hoeller b73c531527 PropertySource implementations perform conversion to String arrays via StringUtils (getting rid of EMPTY_NAMES_ARRAY) 2014-08-21 22:46:33 +02:00
Juergen Hoeller 0c32d66cbd ShallowEtagHeaderFilter supports Servlet 3.1's setContentLengthLong as well
Issue: SPR-12097
2014-08-19 20:17:42 +02:00
Juergen Hoeller 2ef3d66c89 Polishing 2014-08-18 19:27:08 +02:00
Sebastien Deleuze ebc726a915 Allow null ObjectMapper in Jackson2ObjectMapperFactoryBean.getObjectType()
Issue: SPR-11785
2014-08-14 13:40:47 +02: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
Roy Clarkson d6fd40d6dc Upgrade to Gson 2.3
This release contains the following new features:

- The new @JsonAdapter annotation to specify a Json TypeAdapter for a
  class field
- JsonPath support: JsonParser.getPath() method returns the JsonPath
  expression
- New public methods in JsonArray (similar to the java.util.List):
  contains(JsonElement), remove(JsonElement), remove(int index),
  set(int index, JsonElement element)
- Many other smaller bug fixes

See: https://groups.google.com/forum/#!topic/google-gson/MOqf5RGtIzk
2014-08-12 11:47:40 +03: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 ad475ffadf Consistent vararg declarations for String array setters 2014-08-08 17:17:09 +02:00
Juergen Hoeller 5862ddc869 ResponseEntity provides static "notFound()" convenience method as well
Issue: SPR-12070
2014-08-07 22:28:35 +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
Sebastien Deleuze ebc5fea77b Add more HttpHeaders constants for standard HTTP headers
Issue: SPR-12063
2014-08-05 11:11:09 +02:00
Stephane Nicoll 3da68cfe21 Remove unused imports 2014-08-04 14:13:40 +02:00
Rossen Stoyanchev 5859649af7 Update UriTemplate Javadoc
Issue: SPR-10497
2014-07-31 17:08:08 -04:00
Rossen Stoyanchev c4d7976c37 Update RestTemplate Javadoc
Issue: SPR-10497
2014-07-31 17:02:30 -04:00
Rossen Stoyanchev 135a3ff3d8 Use raw status code in RestTemplate logResponseStatus
Issue: SPR-12022
2014-07-30 15:43:43 -04:00
Juergen Hoeller 8f484d382e Polishing 2014-07-29 11:42:37 +02:00
Juergen Hoeller 8cc0fa5ae1 Polishing 2014-07-28 22:05:40 +02:00
Rossen Stoyanchev 5be1ff281c Polish 2014-07-22 16:56:59 -04:00
Brian Clozel b56703eadc Add Google Protobuf support with a MessageConverter
This change adds a new HttpMessageConverter supporting
Google protocol buffers (aka Protobuf).
This message converter supports the following media types:
* application/json
* application/xml
* text/plain
* text/html (output only)
* and by default application/x-protobuf

Note, in order to generate Proto Message classes, the protoc binary
must be available on your system.

Issue: SPR-5807/SPR-6259
2014-07-22 16:56:59 -04:00
Juergen Hoeller f0bcb773f9 ResourceHttpMessageConverter does not call contentLength() on InputStreamResource
Issue: SPR-12017
2014-07-22 17:00:57 +02:00
Juergen Hoeller 9d6c38bd54 Consistent bracket alignment 2014-07-18 17:21:58 +02:00
Juergen Hoeller 188e58c46a Fixed javadoc links 2014-07-18 17:21:44 +02:00
Sebastien Deleuze 86e8bdab6b Make ListenableFuture compliant with Java 8 lambda
Make it possible to use a ListenableFuture with Java 8
lambda expressions, using a syntax like
listenableFuture.addCallback(() -> ..., () -> ...);

Issue: SPR-11820
2014-07-16 16:06:24 +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
Brian Clozel a4484bb767 Fix UriComponentsBuilder.fromUriString parsing error
This commit fixes cases where part of the URI was mistaken for the
userinfo when:
* the URI did not contain any path
* the query string contained the "@"

Issue: SPR-11964
2014-07-09 16:58:11 +02:00
Juergen Hoeller 1222ca38fb RestTemplate accepts getMessageConverters() List on setMessageConverters again
Issue: SPR-11962
2014-07-07 14:33:48 +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 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 0451232eb4 Polishing
(cherry picked from commit 86ea305)
2014-07-01 15:14:31 +02:00
Juergen Hoeller e90143e03b Polishing 2014-07-01 12:52:09 +02:00
Juergen Hoeller 37ba1b966e Seamless support for Groovy bean definitions mixed with XML bean definitions
GroovyBeanDefinitionReader and Groovy ApplicationContexts redirect ".xml" files to XmlBeanDefinitionReader now, similar to what they've been doing for importBeans directives already. Analogously, @ImportResource for configuration classes redirects ".groovy" to GroovyBeanDefinitionReader now.

Issue: SPR-11924
2014-06-30 22:53:25 +02:00
Juergen Hoeller 442bd682a7 Polishing
Issue: SPR-11910
2014-06-26 18:14:51 +02:00
Juergen Hoeller a9b650fd0f DefaultAdvisorChainFactory never passes null into ClassFilter, enabling async advisor to work without target class as well
Issue: SPR-11910
2014-06-26 18:12:44 +02:00
Juergen Hoeller 98d6f7b443 Polishing 2014-06-26 16:01:24 +02:00
Juergen Hoeller cc917de24d Polishing 2014-06-26 11:44:07 +02:00
Juergen Hoeller b3e3c5312f Introduced AnnotationConfigRegistry as common interface for AnnotationConfig(Web)ApplicationContext
Issue: SPR-11814
2014-06-26 11:43:03 +02:00
Brian Clozel 9919a98231 HttpHeaders fails getAllow if set to EmptyCollection
Prior to this commit, calls to getAllow would fail is setAllow was set
to an EmptyCollection right before.

    java.lang.IllegalArgumentException: No enum constant
    org.springframework.http.HttpMethod

This commit fixes this by testing the header value for an empty value
before trying to use it to get a value from the Enum.

Issue: SPR-11917
2014-06-25 23:12:35 +02:00
Juergen Hoeller d239016a8c UriComponentBuilder allows for multiple independent build() calls on same builder instance
Issue: SPR-11885
2014-06-25 13:19:28 +02:00
Juergen Hoeller 18131bf611 Consistent declaration of private static final logger variables
Issue: SPR-11905
2014-06-24 14:02:05 +02:00
Juergen Hoeller 88eabe874c Latest dependency updates (Jackson 2.4, Jetty 9.2.1, H2 1.4.178, Apache HttpClient 4.3.4) 2014-06-17 21:58:11 +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
Rossen Stoyanchev b214db3fc8 Rename HttpStatus 308 to Permanent Redirect
Issue: SPR-11854
2014-06-10 18:51:22 -04:00
Rossen Stoyanchev 56a82c1cbe Add dependency ordering for @ModelAttribute methods
Before this change @ModelAttribute methods were not invoked in any
particular order other than ensuring global @ControllerAdvice methods
are called first and local @Controller methods second.

This change introduces a simple algorithm that selects the next
@ModelAttribute method to invoke by making a pass over all methods and
looking for one that has no dependencies (i.e. @ModelAttribute
input arguments) or has all dependencies resolved (i.e. available in
the model). The process is repeated until no more @ModelAttribute
methods remain.

If the next @ModelAttribute method cannot be determined because all
remaining methods have unresolved dependencies, the first available
method is picked anyway just as before, i.e. with required
dependencies created through the default constructor.

Examples in ModelFactoryOrderingTests.

Issue: SPR-6299
2014-06-07 16:21:36 -04:00
Rossen Stoyanchev e374769ecc Polish ModelFactory 2014-06-07 16:21:35 -04:00
Juergen Hoeller ae66e45887 Refined tests for FactoryBean return type resolution on @Bean methods
Issue: SPR-11842
2014-06-07 00:24:45 +02:00
Juergen Hoeller 85b2c7d116 AbstractAutowireCapableBeanFactory's getTypeForFactoryBean considers FactoryBean<Object> declarations as non-indicative (just like raw declarations)
Issue: SPR-11842
2014-06-06 18:43:29 +02:00
Rossen Stoyanchev c269d27bde Improve no content handling in MockHttpServletRequest
Issue: SPR-11764
2014-06-06 11:25:15 -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
Juergen Hoeller 64bb308763 GsonBuilderUtils for programmatic Base64 serialization setup; common Base64Utils class adapts between Java 8 and Commons Codec
Issue: SPR-9488
2014-06-04 13:22:11 +02:00
Juergen Hoeller 5ed9bedf32 Introducing GroovyWebApplicationContext along the lines of XmlWebApplicationContext and GenericGroovyApplicationContext
Also includes minor dependency updates such as Groovy 2.3.2.

Issue: SPR-11371
2014-05-30 17:35:00 +02:00
Juergen Hoeller 8220832c4e Polishing 2014-05-27 18:29:51 +02:00
Juergen Hoeller 22a38d4547 Revised GsonFactoryBean's configuration properties; made prettyPrinting test pass on Windows
Issue: SPR-9488
2014-05-27 18:26:48 +02:00
Juergen Hoeller 8f2ed66b4a ServletRequestAttributes considers standard Number subclasses (as defined in NumberUtils) as immutable
Issue: SPR-11738
2014-05-27 17:43:31 +02:00
Rossen Stoyanchev bc3ca2dea1 Polish 2014-05-22 22:21:52 -04:00
Roy Clarkson 811330f5c8 Add GsonHttpMessageConverter
This commit adds support to read and write JSON using the Google Gson
library. GsonHttpMessageConverter offers default Gson configuration, but
can be customized by using GsonFactoryBean. GsonFactoryBean includes
several convenience properties for configuring the internal GsonBuilder
and the resulting Gson object.

By default Gson converts byte arrays to JSON arrays instead of a Base64
encoded string. GsonBase64ByteArrayJsonTypeAdapter provides support to
read and write Base64 encoded byte arrays, and can be enabled in
GsonFactoryBean.

RestTemplate will enable GsonHttpMessageConverter only if Jackson 2 is
not found on the class path, because by default GsonHttpMessageConverter
supports the same media types as Jackson.

Issue: SPR-9488
2014-05-22 22:21:52 -04:00
Rossen Stoyanchev 1338d46a6e Add JSONP support for MappingJackson2MessageConverter
Issue: SPR-9899
2014-05-20 12:13:44 -04:00
Juergen Hoeller c7d1c49d6d Servlet 3 multipart request implements getParameterMap defensively as well
Issue: SPR-11074
2014-05-20 11:10:16 +02:00
Juergen Hoeller 6fef8b996c Polishing 2014-05-20 10:46:06 +02:00
Rossen Stoyanchev 8e096aeef5 Disable URL resolution in DTD declarations
Issue: SPR-11768
2014-05-19 22:45:12 -04:00
Juergen Hoeller a16eeabc4e Further UriComponentsBuilder javadoc revision
(cherry picked from commit 54636b3)
2014-05-20 01:26:08 +02:00
Juergen Hoeller d9b39ad691 Consistent use of IllegalStateException instead of InternalError for UnsupportedEncodingException cause 2014-05-20 00:37:09 +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
Juergen Hoeller 6188550a48 ServletRequestAttributes skips well-known immutable values when updating accessed session attributes
Issue: SPR-11738
2014-05-19 16:00:29 +02:00
Juergen Hoeller 82336c320d Servlet 3 multipart request implements getParameterNames defensively (for WebLogic 12 compatibility)
This commit also includes lazy resolution support for StandardServletMultipartResolver, along the lines of existing lazy mode in CommonsMultipartResolver.

Issue: SPR-11074
Issue: SPR-11730
2014-05-18 20:26:02 +02: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
Rossen Stoyanchev 3bdf8aefa9 Polish 2014-05-15 13:59:36 -04:00
Arjen Poutsma 0499fcbeb2 Move ResponseEntityBuilder into ResponseEntity
Moved the ResponseEntityBuilder into the ResponseEntity itself.

Issue: SPR-11752
2014-05-15 13:41:25 -04:00
Brian Clozel f651065b5e Polish 2014-05-14 18:37:31 +02:00
Arjen Poutsma eb65a37f4b Provide builder for ResponseEntity
This commit introduces a ResponseEntityBuilder, which allows for
building of a ResponseEntity through a fluent API.

Issue: SPR-11752
2014-05-14 08:26:22 -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
Mattias Severson f2991da6d6 Made string constants in HttpHeaders public
Issue: SPR-11749
2014-05-01 13:37:39 -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
Chexpir 77a250ef92 Update RequestMapping javadoc typo. 2014-04-28 22:13:17 -04:00
Juergen Hoeller 8e6e6c22af Test for base package specified as config location
Issue: SPR-11647
2014-04-28 21:31:38 +02:00
Juergen Hoeller 6f2e61b19f Polishing
(cherry picked from commit c97c246)
2014-04-28 00:47:50 +02:00
Juergen Hoeller ec7d80b851 Polishing 2014-04-23 23:03:47 +02:00
Juergen Hoeller 21f9ca088d ServletServerHttpResponse specifically checks for Servlet 3.0's HttpServletResponse.getHeader(String) method
Issue: SPR-11712
2014-04-23 22:47:54 +02:00
Juergen Hoeller 794e859e68 checkNotModified leniently handles IE-10-style If-Modified-Since values and silently proceeds if header value cannot be parsed at all
Issue: SPR-11727
2014-04-23 18:16:43 +02:00
Juergen Hoeller 3f392e32f5 ShallowEtagHeaderFilter writes body early on sendError/sendRedirect and interprets setContentLength/setBufferSize as a hint for capacity increase
Issue: SPR-11705
Issue: SPR-11717
2014-04-22 23:14:48 +02:00