Give SSLContext to request handler

This commit is contained in:
2025-12-07 20:51:30 +01:00
parent e4a554d578
commit a16b24d133
2 changed files with 8 additions and 2 deletions

View File

@@ -47,7 +47,7 @@ public class Main {
}
});
IRequestHandler requestHandler = new RequestHandler();
IRequestHandler requestHandler = new RequestHandler(ctx);
IRequestHandler proxy = (IRequestHandler) Proxy.newProxyInstance(
requestHandler.getClass().getClassLoader(),

View File

@@ -10,12 +10,18 @@ import httpServer.httpServer.src.annotations.OnlyAuthorizedClients;
import httpServer.httpServer.src.authorization.AuthorizedClients;
import httpServer.httpServer.src.authorization.Client;
import javax.net.ssl.SSLContext;
import java.io.*;
import java.nio.charset.StandardCharsets;
public class RequestHandler implements IRequestHandler {
final AuthorizedClients authorizedClients = new AuthorizedClients();
private final AuthorizedClients authorizedClients = new AuthorizedClients();
private final SSLContext sslCtx;
public RequestHandler(SSLContext ctx) {
this.sslCtx = ctx;
}
@AllowedVerb(name = "GET")
public void handleRoot(HttpExchange exchange) {