Commit Graph

13300 Commits

Author SHA1 Message Date
Arjen Poutsma 10e157a5a2 Removed unnecessary Driver file 2016-09-07 17:24:34 +02:00
Arjen Poutsma f8ac17f278 Polishing
Two changes to web.reactive.function:

 - Changed Response.stream method to allow for specific Publisher types
 to be returned in Response.

 - Router now stores HttpMessageReader|Writer retrieved from
 Configuration in the attributes as supplier, not as stream, to allow
 for multiple reads.
2016-09-07 15:29:20 +02:00
Brian Clozel d1f60e3de1 Fix default encoding in CONTRIBUTING documentation
Sources should be using UTF-8.

Issue: SPR-14674
2016-09-07 10:47:00 +02:00
Arjen Poutsma bebaee9799 Removed attributes() from Request
Removes attributes() method from Request, as it exposes a mutable map.
2016-09-07 10:10:40 +02:00
Brian Clozel ccb3c44dbc Add ResolvedResource in resource handling chain
Prior to this commit, the resource handling chain and its
`ResourceResolvers` would use specific `Resource` implementations in
order to add resource metadata to the HTTP response. For example,
`VersionedResource` and `EncodedResource` are both adding specific HTTP
response headers.

This commit aims at making this mechanism more stable and reusable,
since the previous implementation would fail in case a resolved resource
would be both a `VersionedResource` wrapping a `EncodedResource` (or the
other way arount). Only one of the specific implementations would
contribute its metadata since the code supporting that in
`ResourceHttpRequestHandler` would only check for `instanceof` tests,
whereas those implementations are acutally delegating calls to
the wrapped resource.

Now both `VersionedResource` and `EncodedResource` have been replaced by
specific implementations of `ResolvedResource`, which directly provides
those HTTP response headers as part of `getResponseHeaders()`.

This commit applies the same changes for the web reactive
implementations and its `ResourceWebHandler`.

Issue: SPR-14264
2016-09-07 09:52:33 +02:00
Artem Yakshin 42f101fb5b Update CONTRIBUTING.md 2016-09-07 09:49:19 +02:00
Artem Yakshin 5496f11f3c Update README.md 2016-09-07 09:49:19 +02:00
Stephane Nicoll 05369a2fad Merge pull request #1158 from nkjackzhang:patch-6
* pr/1158:
  Fix typo
2016-09-07 09:37:36 +02:00
nkjackzhang 00bc0b455e Fix typo
Closes gh-1158
2016-09-07 09:37:00 +02:00
Brian Clozel cc5300c4d5 Align MVC checkNotModified with reactive support
Since SPR-14522, the web reactive framework supports checkNotModified
features. This commit aligns the existing MVC infrastructure with
web reactive's behavior.

Because of the new Servlet 3.0 baseline, some constraints
aren't relevant anymore and duplicate code has been removed in
`HttpEntityMethodProcessor`.

Issue: SPR-14659
2016-09-06 18:02:48 +02:00
Brian Clozel 72e4fac28d Fix missing resources in GzipResourceResolverTests 2016-09-06 15:39:28 +02:00
Rossen Stoyanchev 4346d15cb5 Resource handling configuration
Issue: SPR-14521
2016-09-05 21:59:22 -04:00
Rossen Stoyanchev 1ae64bfbd3 Resource handling support for Spring Web Reactive
A straight-forward port of the resource handling support in
spring-webmvc to spring-web-reactive. Primarily adapting contracts and
implementations to use the reactive request and response and the
reactive ResourceHttpMessageWriter.

Issue: SPR-14521
2016-09-05 21:59:22 -04:00
Rossen Stoyanchev 108ebe0f2b Polish resource handling tests 2016-09-05 21:59:22 -04:00
Sam Brannen 3dc6f1133c Fix section ID for parallel test execution
Issue: SPR-5863
2016-09-05 19:03:26 +02:00
Sam Brannen 3e96cab0bb Document parallel test execution support in the reference manual
Issue: SPR-5863
2016-09-05 18:58:39 +02:00
Sam Brannen 6efb166c36 Document before/after test execution callbacks in reference manual
Issue: SPR-4365
2016-09-05 17:48:47 +02:00
Sam Brannen 2699504cb8 Introduce concurrency tests for Spring's JUnit 4 support
Whereas the existing TestContextConcurrencyTests verify support for
concurrency in the TestContextManager and TestContext, this commit
introduces SpringJUnit4ConcurrencyTests that verify support for
concurrent test execution in Spring's JUnit 4 support, namely in the
SpringRunner, SpringClassRule, and SpringMethodRule.

The tests executed by this new test class come from a hand-picked
collection of test classes within the test suite that is intended to
cover most categories of tests that are currently supported by the
TestContext Framework on JUnit 4.

Note, however, that the chosen test classes intentionally do not
include any classes that fall under the following categories.

 - tests that make use of Spring's @DirtiesContext support

 - tests that make use of JUnit 4's @FixMethodOrder support

 - tests that commit changes to the state of a shared in-memory database

Issue: SPR-5863
2016-09-05 17:26:25 +02:00
Sam Brannen e822e4cbe8 Improve exception msg for inactive test ApplicationContext
This commit improves the exception message thrown when a test's
ApplicationContext is no longer active by explaining that the cause
may be due to parallel test execution.

Issue: SPR-5863
2016-09-05 13:39:21 +02:00
Sam Brannen fbfad8695e Further improve thread safety for attributes in DefaultTestContext
Issue: SPR-5863
2016-09-05 13:34:25 +02:00
Sebastien Deleuze 5755b67325 Upgrade to Reactor Core 3.0.2 2016-09-03 16:19:52 +02:00
Violeta Georgieva 00617d74de Fix AbstractRequestBodyPublisher to comply with the spec
As per specification "The Subscription MUST allow the Subscriber to
call Subscription.request synchronously from within onNext or
onSubscribe". With the current implementation if Subscription.request
is called more than once when Subscriber.onSubscribe ISE will be
thrown - java.lang.IllegalStateException: DEMAND.
With this fix the implementation will not throw ISE and will allow
many invocations of Subscription.request when
Subscriber.onSubscribe.
2016-09-02 23:37:20 +02:00
Brian Clozel 01bd8b9e01 Fix null body handling in ResponseEntityResultHandler
This commit fixes `ResponseEntityResultHandler` so that it only tries to
call `writeBody` if the `ResponseEntity` is not null. In case the
response entity body is null, the response is flushed right away and the
request is signaled as handled.

Issue: SPR-14663
2016-09-02 23:01:16 +02:00
Sam Brannen a10a8e56df Support concurrent execution in TestContextManager & DefaultTestContext
Prior to this commit, executing tests concurrently in the TestContext
Framework (TCF) was unsupported and typically lead to unpredictable
results.

This commit addresses this core issue by supporting concurrent
execution in the TestContextManager and the DefaultTestContext.

Specifically, the TestContextManager now uses ThreadLocal storage for
the current TestContext, thereby ensuring that any registered
TestExecutionListeners and the TestContextManager itself operate on a
TestContext specific to the current thread.

In order to avoid repeatedly incurring the costs of the overhead of the
TCF bootstrapping process, the original TestContext built by the
TestContextBootstrapper is used as a template which is then passed to
the copy constructor of the concrete implementation of the TestContext
to create the context for the current thread. DefaultTestContext now
implements such a copy constructor, and all concrete implementations of
TestContext are encouraged to do the same.

If the TestContext built by the TestContextBootstrapper does not
provide a copy constructor, thread-safety and support for concurrency
are left completely to the implementation of the concrete TestContext.

Note, however, that this commit does not address any thread-safety or
concurrency issues in the ContextLoader SPI or its implementations.

Issue: SPR-5863
2016-09-02 20:28:02 +02:00
Sam Brannen ec7aefa858 Improve concurrency in DefaultTestContext regarding attributes
This commit inlines the basic implementation of AttributeAccessorSupport
and converts the LinkedHashMap to a ConcurrentHashMap.

In addition, attributes are now included in toString().

Issue: SPR-5863
2016-09-02 19:14:31 +02:00
Sam Brannen 5fe3bcf8f9 Polishing 2016-09-02 18:39:31 +02:00
Rossen Stoyanchev c813405ca3 Add @since tags 2016-09-02 12:19:50 -04:00
Rossen Stoyanchev a1ac51256a Add MockServerHttpRequest/Response to spring-test
Issue: SPR-14421
2016-09-02 12:15:00 -04:00
Rossen Stoyanchev 73752c295d Refactor location of MockServerHttpRequest/Response
This change puts the MockHttpServerRequest/Response under
org.springframework.mock.http.server.reactive.test which
mirrors the arrangement we have with the Servlet mock equivalents
and sets up the addition of MockHttpServerRequest/Response in
spring-test.

Issue: SPR-14421
2016-09-02 12:15:00 -04:00
Rossen Stoyanchev e17132c217 Polish MockServerHttpRequest
Issue: SPR-14421
2016-09-02 12:15:00 -04:00
Sebastien Deleuze 2cd3135c3b Upgrade to Reactor Core 3.0.1 and Reactor Netty 0.5.1 2016-09-02 15:47:11 +02:00
Rossen Stoyanchev f3dd554dbe Fix typos in docs and polish 2016-09-02 09:26:15 -04:00
Rob Winch 7788879c5a Remove stray `
Remove stray ` in import-into-idea.md
2016-09-02 08:12:06 -05:00
Rossen Stoyanchev 08b2b0ba2a Merge pull request #1150 from neetkee/patch-1 2016-09-02 09:04:13 -04:00
Rossen Stoyanchev 833a3a0566 Polish import into IntelliJ instructions 2016-09-02 09:03:34 -04:00
Artem Yakshin 409fe478bd Update import-into-idea.md
Changes, according the latest information.
2016-09-02 08:52:53 -04:00
Brian Clozel a8ba065a6e Mention AntPathMatcher regexp support
This commit documents the regexp support in `AntPathMatcher` when
matching for URL patterns. This support is also mentioned in places
where developers can register patterns for ViewControllers or resource
handlers.

Issue: SPR-14652
2016-09-02 11:35:58 +02:00
Rossen Stoyanchev 0681519255 Add checkNotModified support for view resolution
Issue: SPR-14522
2016-09-01 18:07:23 -04:00
Rossen Stoyanchev 6071e01168 Add checkNotModified support in ServerWebExchange
Issue: SPR-14522
2016-09-01 17:44:51 -04:00
Rossen Stoyanchev 638e6cc7f8 Add checkNotModified support for ResponseEntity
Issue: SPR-14522
2016-09-01 17:44:51 -04:00
Rossen Stoyanchev 9f8791ac01 Add ServerWebExchangeArgumentResolver
Issue: SPR-14658
2016-09-01 17:44:51 -04:00
Sebastien Deleuze 02bed0a34b Polishing 2016-09-01 17:15:50 +02:00
Sebastien Deleuze 06d4bb6a1a Let users control SSE stream completion
This commit avoid merging automatically the SSE stream with
Flux.never(). Since browsers automatically reconnect when
the HTTP connection is closed, it is now the user responsability
to optionally perform a concatWith(Flux.never()) on streams that
complete in order to avoid receiving the data multiple times on
client side.

The behavior with hot streams that never complete does not change.

Issue: SPR-14578
2016-09-01 17:14:24 +02:00
Sam Brannen 1af2fbfbbb Delete unused imports in spring-context-indexer 2016-09-01 16:41:49 +02:00
Sam Brannen 5202250179 Polish SpringClassRule and SpringMethodRule 2016-09-01 16:34:03 +02:00
Stephane Nicoll 749ee6065c Merge pull request #1151 from sylvainlaurent:patch-1
* pr/1151:
  Fix class literal in instanceof
2016-09-01 16:23:08 +02:00
sylvainlaurent dc3f62d576 Fix class literal in instanceof
Closes gh-1151
2016-09-01 16:22:39 +02:00
Sebastien Deleuze 76ed101a23 Update Web Reactive documentation 2016-09-01 15:42:50 +02:00
Stephane Nicoll dcade06fa0 Support for candidate components index
This commit adds a "spring-context-indexer" module that can be added to
any project in order to generate an index of candidate components defined
in the project.

`CandidateComponentsIndexer` is a standard annotation processor that
looks for source files with target annotations (typically `@Component`)
and references them in a `META-INF/spring.components` generated file.

Each entry in the index is the fully qualified name of a candidate
component and the comma-separated list of stereotypes that apply to that
candidate. A typical example of a stereotype is `@Component`. If a
project has a `com.example.FooService` annotated with `@Component` the
following `META-INF/spring.components` file is generated at compile time:

```
com.example.FooService=org.springframework.stereotype.Component
```

A new `@Indexed` annotation can be added on any annotation to instructs
the scanner to include a source file that contains that annotation. For
instance, `@Component` is meta-annotated with `@Indexed` now and adding
`@Indexed` to more annotation types will transparently improve the index
with additional information. This also works for interaces or parent
classes: adding `@Indexed` on a `Repository` base interface means that
the indexed can be queried for its implementation by using the fully
qualified name of the `Repository` interface.

The indexer also adds any class or interface that has a type-level
annotation from the `javax` package. This includes obviously JPA
(`@Entity` and related) but also CDI (`@Named`, `@ManagedBean`) and
servlet annotations (i.e. `@WebFilter`). These are meant to handle
cases where a component needs to identify candidates and use classpath
scanning currently.

If a `package-info.java` file exists, the package is registered using
a "package-info" stereotype.

Such files can later be reused by the `ApplicationContext` to avoid
using component scan. A global `CandidateComponentsIndex` can be easily
loaded from the current classpath using `CandidateComponentsIndexLoader`.

The core framework uses such infrastructure in two areas: to retrieve
the candidate `@Component`s and to build a default `PersistenceUnitInfo`.
Rather than scanning the classpath and using ASM to identify candidates,
the index is used if present.

As long as the include filters refer to an annotation that is directly
annotated with `@Indexed` or an assignable type that is directly
annotated with `@Indexed`, the index can be used since a dedicated entry
wil be present for that type. If any other unsupported include filter is
specified, we fallback on classpath scanning.

In case the index is incomplete or cannot be used, The
`spring.index.ignore` system property can be set to `true` or,
alternatively, in a "spring.properties" at the root of the classpath.

Issue: SPR-11890
2016-09-01 15:30:47 +02:00
Sebastien Deleuze 48d67a245b Add support for RxJava 2
This commit adds support for RxJava 2 Completable,
Single, Observable and Flowable types (io.reactivex package).

Issue: SPR-14628
2016-09-01 14:48:16 +02:00