Skip to content

Commit

Permalink
[UNDERTOW-2230] Add priority to HandlerBuilder to override internal h…
Browse files Browse the repository at this point in the history
…andlers with predicate language
  • Loading branch information
xjusko committed Apr 3, 2024
1 parent ddb4aee commit 44ab3f7
Show file tree
Hide file tree
Showing 45 changed files with 239 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/src/main/java/io/undertow/predicate/PredicatesHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ public String toString() {
}
};
}

@Override
public int priority() {
return 0;
}
}

public static final class RestartHandlerBuilder implements HandlerBuilder {
Expand Down Expand Up @@ -296,6 +301,11 @@ public String toString() {
}
};
}

@Override
public int priority() {
return 0;
}
}


Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/io/undertow/server/JvmRouteHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper((String)config.get("value"), sessionCookieName == null ? "JSESSIONID" : sessionCookieName);
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper(peerMatches, defaultAllow == null ? false : defaultAllow, attribute);
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new ActiveRequestTrackerHandler.Wrapper();
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper((String[]) config.get("methods"));
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper();
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ public HandlerWrapper build(Map<String, Object> config) {
Boolean send = (Boolean) config.get("send-accept-ranges");
return new Wrapper(send != null && send);
}

@Override
public int priority() {
return 0;
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper();
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper();
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper((String[]) config.get("methods"));
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ public HandlerWrapper build(Map<String, Object> config) {
Boolean isChangeLocalAddrPort = (Boolean) config.get(CHANGE_LOCAL_ADDR_PORT);
return new Wrapper(isChangeLocalAddrPort == null ? DEFAULT_CHANGE_LOCAL_ADDR_PORT : isChangeLocalAddrPort);
}

@Override
public int priority() {
return 0;
}
}
private static class Wrapper implements HandlerWrapper {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,10 @@ public String defaultParameter() {
public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper(Predicates.truePredicate());
}

@Override
public int priority() {
return 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper();
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper(peerMatches, defaultAllow == null ? false : defaultAllow, failureStatus == null ? StatusCodes.FORBIDDEN : failureStatus);
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ public HandlerWrapper build(Map<String, Object> config) {
}
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,10 @@ public HttpHandler wrap(HttpHandler handler) {
}
};
}

@Override
public int priority() {
return 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper();
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper();
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper();
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper(isChangeLocalAddrPort == null ? DEFAULT_CHANGE_LOCAL_ADDR_PORT : isChangeLocalAddrPort);
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper((ExchangeAttribute) config.get("value"));
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,10 @@ public String defaultParameter() {
public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper((Integer) config.get("buffers"));
}

@Override
public int priority() {
return 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper();
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper((Integer) config.get("requests"));
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper((Integer)config.get("bytes"), (Long)config.get("time"), TimeUnit.MILLISECONDS);
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper();
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,10 @@ public HttpHandler wrap(HttpHandler handler) {
}
};
}

@Override
public int priority() {
return 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ public String defaultParameter() {
public HandlerWrapper build(Map<String, Object> config) {
return WRAPPER;
}

@Override
public int priority() {
return 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ public HttpHandler wrap(HttpHandler handler) {
}
};
}

@Override
public int priority() {
return 0;
}
}

public static class ClearBuilder implements HandlerBuilder {
Expand Down Expand Up @@ -201,6 +206,11 @@ public HttpHandler wrap(HttpHandler handler) {
}
};
}

@Override
public int priority() {
return 0;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ public HandlerWrapper build(Map<String, Object> config) {
return new Wrapper((Integer) config.get("response-code"));
}

@Override
public int priority() {
return 0;
}

}

private static class Wrapper implements HandlerWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,10 @@ public HttpHandler wrap(HttpHandler handler) {
}
};
}

@Override
public int priority() {
return 0;
}
}
}

0 comments on commit 44ab3f7

Please sign in to comment.