Мой сервер vertx находится на Java, и когда я хочу создать сеанс с Js, в моем браузере нет файла cookie с ключом. Но когда я создаю сеанс напрямую с URL-адресом, в моем браузере есть файл cookie. Мой сервер:vertx Session не создает файлы cookie в моем браузере
router.route().handler(CookieHandler.create());
router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx));
router.get("/log/:name/:password").handler(this::verifId);
public void verifId(RoutingContext routingContext) {
HttpServerRequest request = routingContext.request();
HttpServerResponse response = routingContext.response();
try {
Session s = routingContext.session();
DataBase.connect();
String name = request.getParam("name");
String password = request.getParam("password");
Boolean returnValue = DataBase.exist(name, password);
DataBase.disconnect();
if (returnValue) {
s.put("user", request.getParam("name"));
System.out.println(s.id());
response.end(Json.encodePrettily(s.id().toString()));
} else {
s.destroy();
response.end("null");
}
} catch (SQLException e) {
e.printStackTrace();
}
}
И мой Js код:
function tryToLogin(login, password){
var urlBuilder = 'https://localhost:8090/log/' + login + '/' + password;
$.ajax({
url : urlBuilder,
type: 'get',
dataType: 'json',
success : function(code_json, statut){
console.log(" il a repondu " + code_json);
}
});
}