Merge branch 'main' of https://gitlab.naaturel.be/Naaturel/masi-3ds-cypher
This commit is contained in:
@@ -49,7 +49,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(),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
import common.common.src.html.HtmlManager;
|
import common.common.src.html.HtmlManager;
|
||||||
|
import common.common.src.json.JsonManager;
|
||||||
import common.common.src.logger.Logger;
|
import common.common.src.logger.Logger;
|
||||||
import common.common.src.json.JsonManager;
|
import common.common.src.json.JsonManager;
|
||||||
import httpServer.httpServer.src.annotations.AllowedVerb;
|
import httpServer.httpServer.src.annotations.AllowedVerb;
|
||||||
@@ -11,13 +12,19 @@ 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;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
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) {
|
||||||
@@ -73,8 +80,7 @@ public class RequestHandler implements IRequestHandler {
|
|||||||
.lines()
|
.lines()
|
||||||
.reduce("", (acc, line) -> acc + line + "\n");
|
.reduce("", (acc, line) -> acc + line + "\n");
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
Client client = JsonManager.deserialize(body, Client.class);
|
||||||
Client client = mapper.readValue(body, Client.class);
|
|
||||||
|
|
||||||
System.out.println("Received POST data:\n" + body);
|
System.out.println("Received POST data:\n" + body);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user