示例#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;
        }
    }
示例#2
0
 public AbstractBeamService(BeamAPI beam)
 {
     this.beam = beam;
 }
示例#3
0
 public BeamHttpClient(BeamAPI beam, String oauthToken) : this(beam, null, null, oauthToken)
 {
 }
示例#4
0
 public BeamHttpClient(BeamAPI beam, String httpUsername, String httpPassword) : this(beam, httpUsername, httpPassword, null)
 {
 }
示例#5
0
 public BeamHttpClient(BeamAPI beam) : this(beam, null, null)
 {
 }