io.github.fallwizard.rabbitmq.httpclient.BasicAuthHttpClientProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rabbitmq-mgmt Show documentation
Show all versions of rabbitmq-mgmt Show documentation
Manage your RabbitMQ services programmatically
The newest version!
package io.github.fallwizard.rabbitmq.httpclient;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
public class BasicAuthHttpClientProvider implements HttpClientProvider {
private String username;
private String password;
public BasicAuthHttpClientProvider(String username, String password) {
this.username = username;
this.password = password;
}
@Override
public boolean useSsl() {
return false;
}
@Override
public Client getClient() {
ClientConfig clientConf = new DefaultClientConfig();
clientConf.getClasses().add(GsonMessageBodyHandler.class);
Client client = Client.create(clientConf);
client.addFilter(new HTTPBasicAuthFilter(this.username, this.password));
return client;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy