Java Code Examples for org.springframework.web.server.adapter.WebHttpHandlerBuilder#filters()

The following examples show how to use org.springframework.web.server.adapter.WebHttpHandlerBuilder#filters() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractMockServerSpec.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public WebTestClient.Builder configureClient() {
	WebHttpHandlerBuilder builder = initHttpHandlerBuilder();
	if (!CollectionUtils.isEmpty(this.filters)) {
		builder.filters(theFilters -> theFilters.addAll(0, this.filters));
	}
	if (!builder.hasSessionManager() && this.sessionManager != null) {
		builder.sessionManager(this.sessionManager);
	}
	if (!CollectionUtils.isEmpty(this.configurers)) {
		this.configurers.forEach(configurer -> configurer.beforeServerCreated(builder));
	}
	return new DefaultWebTestClientBuilder(builder);
}
 
Example 2
Source File: ExchangeMutatorTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void afterConfigurerAdded(WebTestClient.Builder builder,
		@Nullable WebHttpHandlerBuilder httpHandlerBuilder,
		@Nullable ClientHttpConnector connector) {

	Assert.notNull(httpHandlerBuilder, "Not a mock server");
	httpHandlerBuilder.filters(filters -> {
		filters.removeIf(filter -> filter instanceof IdentityFilter);
		filters.add(0, this.filter);
	});
}
 
Example 3
Source File: AbstractMockServerSpec.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public WebTestClient.Builder configureClient() {
	WebHttpHandlerBuilder builder = initHttpHandlerBuilder();
	if (!CollectionUtils.isEmpty(this.filters)) {
		builder.filters(theFilters -> theFilters.addAll(0, this.filters));
	}
	if (!builder.hasSessionManager() && this.sessionManager != null) {
		builder.sessionManager(this.sessionManager);
	}
	if (!CollectionUtils.isEmpty(this.configurers)) {
		this.configurers.forEach(configurer -> configurer.beforeServerCreated(builder));
	}
	return new DefaultWebTestClientBuilder(builder);
}
 
Example 4
Source File: ExchangeMutatorTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void afterConfigurerAdded(WebTestClient.Builder builder,
		@Nullable WebHttpHandlerBuilder httpHandlerBuilder,
		@Nullable ClientHttpConnector connector) {

	Assert.notNull(httpHandlerBuilder, "Not a mock server");
	httpHandlerBuilder.filters(filters -> {
		filters.removeIf(filter -> filter instanceof IdentityFilter);
		filters.add(0, this.filter);
	});
}
 
Example 5
Source File: ExchangeMutatorTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public void beforeServerCreated(WebHttpHandlerBuilder builder) {
	builder.filters(filters -> filters.add(0, this.filter));
}
 
Example 6
Source File: ExchangeMutatorTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public void beforeServerCreated(WebHttpHandlerBuilder builder) {
	builder.filters(filters -> filters.add(0, this.filter));
}