Skip to content

Commit

Permalink
Bump Micronaut to 4.3.0 and fix internal breakage (#626)
Browse files Browse the repository at this point in the history
* Bump Micronaut to 4.3.0 and fix internal breakage

* Stop using deprecated request lifecycle methods
  • Loading branch information
timyates authored Jan 24, 2024
1 parent d393599 commit 6293ffb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
micronaut = "4.2.3"
micronaut = "4.3.0"
micronaut-docs = "2.0.0"
micronaut-test = "4.0.1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ public void service(ServletExchange<REQ, RES> exchange) {
final HttpRequest<Object> req = exchange.getRequest();
applicationContext.publishEvent(new HttpRequestReceivedEvent(req));

ServletRequestLifecycle lc = new ServletRequestLifecycle(routeExecutor, req);
ServletRequestLifecycle lc = new ServletRequestLifecycle(routeExecutor);

if (exchange.getRequest().isAsyncSupported()) {
exchange.getRequest().executeAsync(asyncExecution -> {
try (PropagatedContext.Scope ignore = PropagatedContext.getOrEmpty().plus(new ServerHttpRequestContext(req)).propagate()) {
lc.handleNormal()
.onComplete((response, throwable) -> onComplete(exchange, req, response, throwable, httpResponse -> {
lc.handleNormal(req)
.onComplete((response, throwable) -> onComplete(exchange, req, response.toMutableResponse(), throwable, httpResponse -> {
asyncExecution.complete();
requestTerminated.accept(httpResponse);
}));
Expand All @@ -219,10 +219,10 @@ public void service(ServletExchange<REQ, RES> exchange) {
} else {
try (PropagatedContext.Scope ignore = PropagatedContext.getOrEmpty().plus(new ServerHttpRequestContext(req)).propagate()) {
CompletableFuture<?> termination = new CompletableFuture<>();
lc.handleNormal()
lc.handleNormal(req)
.onComplete((response, throwable) -> {
try {
onComplete(exchange, req, response, throwable, requestTerminated);
onComplete(exchange, req, response.toMutableResponse(), throwable, requestTerminated);
} finally {
termination.complete(null);
}
Expand Down Expand Up @@ -501,17 +501,17 @@ private String getDefaultMediaType(Object result) {
}

private final class ServletRequestLifecycle extends RequestLifecycle {
ServletRequestLifecycle(RouteExecutor routeExecutor, HttpRequest<?> request) {
super(routeExecutor, request);
ServletRequestLifecycle(RouteExecutor routeExecutor) {
super(routeExecutor);
}

ExecutionFlow<MutableHttpResponse<?>> handleNormal() {
return normalFlow();
ExecutionFlow<HttpResponse<?>> handleNormal(HttpRequest<?> request) {
return normalFlow(request);
}

@Override
protected FileCustomizableResponseType findFile() {
return matchFile(request().getPath()).orElse(null);
protected FileCustomizableResponseType findFile(HttpRequest<?> request) {
return matchFile(request.getPath()).orElse(null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"io.micronaut.http.server.tck.tests.filter.ClientResponseFilterTest", // responseFilterThrowableParameter fails under Graal https://ge.micronaut.io/s/ufuhtbe5sgmxi
"io.micronaut.http.server.tck.tests.FilterProxyTest", // see https://github.com/micronaut-projects/micronaut-core/issues/9725
"io.micronaut.http.server.tck.tests.LocalErrorReadingBodyTest", // Cannot read body as text once stream is exhausted trying to read it as a different type See https://github.com/micronaut-projects/micronaut-servlet/pull/548
"io.micronaut.http.server.tck.tests.filter.options.OptionsFilterTest" // needs https://github.com/micronaut-projects/micronaut-core/pull/10126
})
public class JettyHttpServerTestSuite {
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"io.micronaut.http.server.tck.tests.filter.ClientResponseFilterTest", // responseFilterThrowableParameter fails under Graal https://ge.micronaut.io/s/ufuhtbe5sgmxi
"io.micronaut.http.server.tck.tests.FilterProxyTest", // see https://github.com/micronaut-projects/micronaut-core/issues/9725
"io.micronaut.http.server.tck.tests.LocalErrorReadingBodyTest", // Cannot read body as text once stream is exhausted trying to read it as a different type See https://github.com/micronaut-projects/micronaut-servlet/pull/548
"io.micronaut.http.server.tck.tests.filter.options.OptionsFilterTest" // needs https://github.com/micronaut-projects/micronaut-core/pull/10126
})
public class TomcatHttpServerTestSuite {
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"io.micronaut.http.server.tck.tests.StreamTest", // The outputstream in Undertow is marked ready asynchronously, and we throw the error early, so sometimes there's no body for statusErrorAsFirstItem.
"io.micronaut.http.server.tck.tests.FilterProxyTest", // see https://github.com/micronaut-projects/micronaut-core/issues/9725
"io.micronaut.http.server.tck.tests.LocalErrorReadingBodyTest", // Cannot read body as text once stream is exhausted trying to read it as a different type See https://github.com/micronaut-projects/micronaut-servlet/pull/548
"io.micronaut.http.server.tck.tests.filter.options.OptionsFilterTest" // needs https://github.com/micronaut-projects/micronaut-core/pull/10126
})
public class UndertowHttpServerTestSuite {
}

0 comments on commit 6293ffb

Please sign in to comment.