Skip to content

Commit

Permalink
Helidon 4.x container
Browse files Browse the repository at this point in the history
Signed-off-by: Maxim Nesen <[email protected]>
  • Loading branch information
senivam committed Sep 3, 2024
1 parent 9879938 commit ada3071
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import io.helidon.common.tls.Tls;
import io.helidon.common.tls.TlsConfig;
import io.helidon.config.Config;
import io.helidon.webserver.WebServerConfig;
import io.helidon.webserver.http.HttpRouting;
import jakarta.ws.rs.core.Application;
Expand Down Expand Up @@ -136,7 +137,8 @@ public Object parentContext() {

public HelidonHttpContainer build() {
configureBaseUri();
webServerBuilder.routing(configureRouting());
webServerBuilder.config(Config.global())
.routing(configureRouting());
this.tls = configureTls();
if (this.tls != null) {
webServerBuilder.tls(this.tls);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ class HelidonJerseyRoutingService implements HttpService {
private static final System.Logger LOGGER = System.getLogger(HelidonJerseyRoutingService.class.getName());
private static final Type REQUEST_TYPE = (new GenericType<Ref<ServerRequest>>() { }).getType();
private static final Type RESPONSE_TYPE = (new GenericType<Ref<ServerResponse>>() { }).getType();
private static final Set<InjectionManager> INJECTION_MANAGERS = Collections.newSetFromMap(new WeakHashMap<>());

private final HelidonJerseyBridge bridge;
private HelidonJerseyRoutingService(HelidonJerseyBridge bridge) {
this.bridge = bridge;
Expand Down Expand Up @@ -114,16 +112,13 @@ public void routing(HttpRules rules) {
@Override
public void beforeStart() {
appHandler().onStartup(container());
INJECTION_MANAGERS.add(appHandler().getInjectionManager());
}

@Override
public void afterStop() {
try {
final InjectionManager ij = appHandler().getInjectionManager();
if (INJECTION_MANAGERS.remove(ij)) {
appHandler().onShutdown(bridge.getContainer());
}
appHandler().onShutdown(bridge.getContainer());
} catch (Exception e) {
if (LOGGER.isLoggable(System.Logger.Level.DEBUG)) {
LOGGER.log(System.Logger.Level.DEBUG, "Exception during shutdown of Jersey", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public abstract class AbstractHelidonServerTester {
*/
protected final int getPort() {
if (server != null) {
System.out.println(server.port());
return server.port();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public String get() {

@Override
protected DeploymentContext configureDeployment() {
forceSet(TestProperties.CONTAINER_PORT, "8080");
forceSet(TestProperties.CONTAINER_PORT, "-1"); //Default not defined port in Helidon is -1

return DeploymentContext.builder(new ResourceConfig(TestResource.class)).build();
}
Expand Down

0 comments on commit ada3071

Please sign in to comment.