Search in sources :

Example 1 with ClientJettyHttp2Module

use of org.apache.cayenne.configuration.rop.client.ClientJettyHttp2Module in project cayenne by apache.

the class Http2Client method main.

public static void main(String[] args) throws Exception {
    HttpsURLConnection.setDefaultHostnameVerifier((hostname, sslSession) -> hostname.equals("localhost"));
    System.setProperty("javax.net.ssl.trustStore", Http2Client.class.getResource("/keystore").getPath());
    // Setting Protostuff properties
    System.setProperty("protostuff.runtime.collection_schema_on_repeated_fields", "true");
    System.setProperty("protostuff.runtime.morph_collection_interfaces", "true");
    System.setProperty("protostuff.runtime.morph_map_interfaces", "true");
    System.setProperty("protostuff.runtime.pojo_schema_on_collection_fields", "true");
    System.setProperty("protostuff.runtime.pojo_schema_on_map_fields", "true");
    Map<String, String> properties = new HashMap<>();
    properties.put(ClientConstants.ROP_SERVICE_URL_PROPERTY, "https://localhost:8443/");
    properties.put(ClientConstants.ROP_SERVICE_USE_ALPN_PROPERTY, "false");
    properties.put(ClientConstants.ROP_SERVICE_USERNAME_PROPERTY, "cayenne-user");
    properties.put(ClientConstants.ROP_SERVICE_PASSWORD_PROPERTY, "secret");
    properties.put(ClientConstants.ROP_SERVICE_REALM_PROPERTY, "Cayenne Realm");
    ClientRuntime runtime = ClientRuntime.builder().properties(properties).addModule(new ClientJettyHttp2Module()).build();
    ObjectContext context = runtime.newContext();
    newObjectsTutorial(context);
    selectTutorial(context);
    deleteTutorial(context);
    runtime.shutdown();
}
Also used : ClientRuntime(org.apache.cayenne.configuration.rop.client.ClientRuntime) ClientJettyHttp2Module(org.apache.cayenne.configuration.rop.client.ClientJettyHttp2Module) HashMap(java.util.HashMap) ObjectContext(org.apache.cayenne.ObjectContext)

Aggregations

HashMap (java.util.HashMap)1 ObjectContext (org.apache.cayenne.ObjectContext)1 ClientJettyHttp2Module (org.apache.cayenne.configuration.rop.client.ClientJettyHttp2Module)1 ClientRuntime (org.apache.cayenne.configuration.rop.client.ClientRuntime)1