forked from wildfly/wildfly
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request wildfly#17466 from pferraro/WFLY-18813
WFLY-18813 Fix gzip and mod_cluster filter creation regression
- Loading branch information
Showing
16 changed files
with
116 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,17 +19,15 @@ | |
import java.util.Collection; | ||
import java.util.function.Consumer; | ||
|
||
import io.undertow.server.HandlerWrapper; | ||
|
||
/** | ||
* @author Tomaz Cerar (c) 2013 Red Hat Inc. | ||
* @author <a href="mailto:[email protected]">Richard Opalka</a> | ||
*/ | ||
class FilterAdd extends AbstractAddStepHandler { | ||
|
||
private HandlerWrapperFactory factory; | ||
private PredicateHandlerWrapperFactory factory; | ||
|
||
FilterAdd(HandlerWrapperFactory factory, Collection<AttributeDefinition> attributes) { | ||
FilterAdd(PredicateHandlerWrapperFactory factory, Collection<AttributeDefinition> attributes) { | ||
super(attributes); | ||
this.factory = factory; | ||
} | ||
|
@@ -39,8 +37,8 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod | |
final String name = context.getCurrentAddressValue(); | ||
final ServiceTarget target = context.getServiceTarget(); | ||
final ServiceBuilder<?> sb = target.addService(UndertowService.FILTER.append(name)); | ||
final Consumer<HandlerWrapper> serviceConsumer = sb.provides(UndertowService.FILTER.append(name)); | ||
HandlerWrapper wrapper = this.factory.createHandlerWrapper(context, model); | ||
final Consumer<PredicateHandlerWrapper> serviceConsumer = sb.provides(UndertowService.FILTER.append(name)); | ||
PredicateHandlerWrapper wrapper = this.factory.createHandlerWrapper(context, model); | ||
sb.setInstance(Service.newInstance(serviceConsumer, wrapper)); | ||
sb.setInitialMode(ServiceController.Mode.ON_DEMAND); | ||
sb.install(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
undertow/src/main/java/org/wildfly/extension/undertow/filters/PredicateHandlerWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.extension.undertow.filters; | ||
|
||
import io.undertow.Handlers; | ||
import io.undertow.predicate.Predicate; | ||
import io.undertow.server.HandlerWrapper; | ||
import io.undertow.server.HttpHandler; | ||
|
||
/** | ||
* Like {@link io.undertow.server.HandlerWrapper}, but for filters. | ||
* @author Paul Ferraro | ||
*/ | ||
public interface PredicateHandlerWrapper { | ||
|
||
HttpHandler wrap(Predicate predicate, HttpHandler next); | ||
|
||
static PredicateHandlerWrapper filter(HandlerWrapper wrapper) { | ||
return new PredicateHandlerWrapper() { | ||
@Override | ||
public HttpHandler wrap(Predicate predicate, HttpHandler next) { | ||
HttpHandler handler = wrapper.wrap(next); | ||
return (predicate != null) ? Handlers.predicate(predicate, handler, next) : handler; | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.