Package org.ektorp.http.StdHttpClient

Examples of org.ektorp.http.StdHttpClient.Builder


     * @return a DataContext object that matches the request
     */
    public static UpdateableDataContext createCouchDbDataContext(String hostname, Integer port, String username,
            String password, SimpleTableDef[] tableDefs) {

        Builder httpClientBuilder = new Builder();
        httpClientBuilder.host(hostname);
        if (port != null) {
            httpClientBuilder.port(port);
        }
        if (username != null) {
            httpClientBuilder.username(username);
        }
        if (password != null) {
            httpClientBuilder.password(password);
        }

        // increased timeouts (20 sec) - metamodel typically does quite some
        // batching so it might take a bit of time to provide a connection.
        httpClientBuilder.connectionTimeout(20000);
        httpClientBuilder.socketTimeout(20000);

        if (tableDefs == null || tableDefs.length == 0) {
            return new CouchDbDataContext(httpClientBuilder);
        }
        return new CouchDbDataContext(httpClientBuilder, tableDefs);
View Full Code Here


     * @return a DataContext object that matches the request
     */
    public static UpdateableDataContext createCouchDbDataContext(String hostname, Integer port, String username,
            String password, SimpleTableDef[] tableDefs) {

        Builder httpClientBuilder = new Builder();
        httpClientBuilder.host(hostname);
        if (port != null) {
            httpClientBuilder.port(port);
        }
        if (username != null) {
            httpClientBuilder.username(username);
        }
        if (password != null) {
            httpClientBuilder.password(password);
        }

        // increased timeouts (20 sec) - metamodel typically does quite some
        // batching so it might take a bit of time to provide a connection.
        httpClientBuilder.connectionTimeout(20000);
        httpClientBuilder.socketTimeout(20000);

        if (tableDefs == null || tableDefs.length == 0) {
            return new CouchDbDataContext(httpClientBuilder);
        }
        return new CouchDbDataContext(httpClientBuilder, tableDefs);
View Full Code Here

     * @return a DataContext object that matches the request
     */
    public static UpdateableDataContext createCouchDbDataContext(String hostname, Integer port, String username,
            String password) {

        Builder httpClientBuilder = new Builder();
        httpClientBuilder.host(hostname);
        if (port != null) {
            httpClientBuilder.port(port);
        }
        if (username != null) {
            httpClientBuilder.username(username);
        }
        if (password != null) {
            httpClientBuilder.password(password);
        }

        // increased timeouts (20 sec) - metamodel typically does quite some
        // batching so it might take a bit of time to provide a connection.
        httpClientBuilder.connectionTimeout(20000);
        httpClientBuilder.socketTimeout(20000);

        return new CouchDbDataContext(httpClientBuilder);
    }
View Full Code Here

    if (sdb == null) {
      sdb = "eve";
    }
   
    try {
      final Builder builder = new StdHttpClient.Builder().url(url);
     
      if (username != null && !username.isEmpty()) {
        builder.username(username);
      }
     
      if (password != null && !password.isEmpty()) {
        builder.password(password);
      }
     
      final HttpClient httpClient = builder.build();
      final CouchDbInstance dbInstance = new StdCouchDbInstance(
          httpClient);
      // if the second parameter is true, the database will be created if
      // it doesn't exists
      db = dbInstance.createConnector(sdb, true);
View Full Code Here

        final String url = config.getUrl();
        final String username = config.getUsername();
        final String password = config.getPassword();
        final String database = config.getDatabase();
       
        final Builder builder = new StdHttpClient.Builder().url(url);
        if (username != null && !username.isEmpty()) {
          builder.username(username);
        }
       
        if (password != null && !password.isEmpty()) {
          builder.password(password);
        }
       
        final HttpClient httpClient = builder.build();
        final CouchDbInstance dbInstance = new StdCouchDbInstance(
            httpClient);
        // if the second parameter is true, the database will be created
        // if
        // it doesn't exists
View Full Code Here

TOP

Related Classes of org.ektorp.http.StdHttpClient.Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.