How to Retrieve an User in OpenShift

import static java.lang.System.out;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.Response;

import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;

public final class OpenShiftSample {

  public static void main(final String[] args) {
    final Client client = ClientBuilder.newClient();

    client.register(HttpAuthenticationFeature.basic("sampleUsername", "samplePassword"));

    final Response res = client.target("https://host/broker/rest/user").request().get();

    out.println(res.readEntity(String.class));

    client.close();
  }

}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s