Commit 7348bb4f authored by j.hoerdt's avatar j.hoerdt
Browse files

start implementing session creation

parent 023db77c
package sensor2graph.handle;
import java.net.*;
import java.net.http.HttpResponse;
import java.net.http.HttpRequest.BodyPublishers;
public class Session {
public static String create() {
private static solve_challenge
public static String create(URI registry_uri, ) {
private static HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(20)).build();
var challenge_request = HttpRequest.newBuilder(registry_uri))
.header("Accept", "application/json")
.method("POST", BodyPublishers.noBody()).build();
var challenge = client.send(challenge_request, BodyHandlers.ofString());
if (challenge.statusCode() != 201) {
throw new Exception("server send status code " + challenge.statusCode() " instead of 201");
}
solve_challenge
new Gson().fromJson(response_body, JsonObject.class).get("epic-pid").getAsString();
return "";
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment