Beispiel #1
0
    public BeamHttpClient(BeamAPI beam, String httpUsername, String httpPassword, String oauthToken)
    {
        this.beam        = beam;
        this.cookieStore = new BasicCookieStore();

        if (httpUsername != null && httpPassword != null)
        {
            this.context = HttpClientContext.create();

            AuthCache ac = new BasicAuthCache();
            ac.put(new HttpHost(this.beam.basePath.getHost()), new BasicScheme());
            this.context.setAuthCache(ac);

            CredentialsProvider cp = new BasicCredentialsProvider();
            cp.setCredentials(
                AuthScope.ANY,
                new UsernamePasswordCredentials(httpUsername, httpPassword)
                );
            this.context.setCredentialsProvider(cp);
        }
        else
        {
            this.context = null;
        }

        this.http = this.buildHttpClient();

        if (oauthToken != null)
        {
            this.oauthToken = oauthToken;
        }
    }
Beispiel #2
0
 public AbstractBeamService(BeamAPI beam)
 {
     this.beam = beam;
 }
Beispiel #3
0
 public BeamHttpClient(BeamAPI beam, String oauthToken) : this(beam, null, null, oauthToken)
 {
 }
Beispiel #4
0
 public BeamHttpClient(BeamAPI beam, String httpUsername, String httpPassword) : this(beam, httpUsername, httpPassword, null)
 {
 }
Beispiel #5
0
 public BeamHttpClient(BeamAPI beam) : this(beam, null, null)
 {
 }