Give SSLContext to request handler
This commit is contained in:
@@ -47,7 +47,7 @@ public class Main {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
IRequestHandler requestHandler = new RequestHandler();
|
IRequestHandler requestHandler = new RequestHandler(ctx);
|
||||||
|
|
||||||
IRequestHandler proxy = (IRequestHandler) Proxy.newProxyInstance(
|
IRequestHandler proxy = (IRequestHandler) Proxy.newProxyInstance(
|
||||||
requestHandler.getClass().getClassLoader(),
|
requestHandler.getClass().getClassLoader(),
|
||||||
|
|||||||
@@ -10,12 +10,18 @@ import httpServer.httpServer.src.annotations.OnlyAuthorizedClients;
|
|||||||
import httpServer.httpServer.src.authorization.AuthorizedClients;
|
import httpServer.httpServer.src.authorization.AuthorizedClients;
|
||||||
import httpServer.httpServer.src.authorization.Client;
|
import httpServer.httpServer.src.authorization.Client;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
public class RequestHandler implements IRequestHandler {
|
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")
|
@AllowedVerb(name = "GET")
|
||||||
public void handleRoot(HttpExchange exchange) {
|
public void handleRoot(HttpExchange exchange) {
|
||||||
|
|||||||
Reference in New Issue
Block a user