Search in sources :

Example 1 with FusekiModule

use of org.apache.jena.fuseki.main.sys.FusekiModule in project jena by apache.

the class ExFusekiMain_3_FusekiModule method main.

public static void main(String... a) throws Exception {
    JenaSystem.init();
    FusekiLogging.setLogging();
    // Normally done with ServiceLoader
    // A file /META-INF/services/org.apache.jena.fuseki.main.sys.FusekiModule
    // in the jar file with contents:
    // org.apache.jena.fuseki.main.examples.ExampleModule
    // 
    // The file is typically put into the jar by having
    // src/main/resources/META-INF/services/org.apache.jena.fuseki.main.sys.FusekiModule
    FusekiModule module = new FMod_ProvidePATCH();
    FusekiModules.add(module);
    // Create server.
    FusekiServer server = FusekiServer.create().port(0).build().start();
    int port = server.getPort();
    // Client HTTP request: "PATCH /extra"
    HttpRequest request = HttpRequest.newBuilder().uri(URI.create("http://localhost:" + port + "/extra")).method("PATCH", BodyPublishers.ofString("hello world!")).build();
    HttpResponse<Void> response = HttpEnv.getDftHttpClient().send(request, BodyHandlers.discarding());
    server.stop();
}
Also used : HttpRequest(java.net.http.HttpRequest) FusekiModule(org.apache.jena.fuseki.main.sys.FusekiModule) FusekiServer(org.apache.jena.fuseki.main.FusekiServer)

Aggregations

HttpRequest (java.net.http.HttpRequest)1 FusekiServer (org.apache.jena.fuseki.main.FusekiServer)1 FusekiModule (org.apache.jena.fuseki.main.sys.FusekiModule)1