Android UsernamePasswordCredentials - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android UsernamePasswordCredentials class.

This code example shows how to use the following methods:
    } 
 
    private DefaultHttpClient createHttpClient(final URL webAppURL, final String userName, final String userPassword) {
        DefaultHttpClient httpClient = new DefaultHttpClient();
 
        UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(userName, userPassword);
 
        httpClient.getCredentialsProvider().setCredentials(new AuthScope(webAppURL.getHost(), webAppURL.getPort(), DEPLOYMENT_REALM_NAME), credentials);
 
        return httpClient;
    } 
 
    /** 
     * A {@link org.jboss.as.arquillian.api.ServerSetupTask} instance which creates security domains for this test case. 
     * 
     * @author Pedro Igor 
     */ 
    static class SecurityDomainsSetup extends AbstractSecurityDomainsServerSetupTask { 
 
        public static final String UNDERTOW_MODULE_NAME = "org.wildfly.extension.undertow";
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
            httpClient = HttpClientUtils.wrapHttpsClient(new DefaultHttpClient());
        } else { 
            httpClient = new DefaultHttpClient();
        } 
 
        ((DefaultHttpClient) httpClient).getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY),
                new UsernamePasswordCredentials(user, pass));
 
        HttpGet get = new HttpGet(url);
        HttpResponse hr;
        try { 
            hr = httpClient.execute(get);
        } catch (Exception e) {
            if (responseSubstring == null)
                return false; 
            else // in case substring is defined, rethrow exception so, we can easier analyze the cause 
                throw new Exception(e);
        } 
 
        int statusCode = hr.getStatusLine().getStatusCode();
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
     * @param password 
     * @param scope - an AuthScope object 
     * 
     */ 
    public void setBasicAuth( String user, String pass, AuthScope scope){
        UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(user,pass);
        this.httpClient.getCredentialsProvider().setCredentials(scope, credentials);
    } 
 
    /** 
     * Cancels any pending (or potentially active) requests associated with the 
     * passed Context. 
     * <p> 
     * <b>Note:</b> This will only affect requests which were created with a non-null 
     * android Context. This method is intended to be used in the onDestroy 
     * method of your android activities to destroy all requests which are no 
     * longer required. 
     * 
     * @param context the android Context instance associated to the request. 
     * @param mayInterruptIfRunning specifies if active requests should be cancelled along with pending requests. 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
This code example shows how to use the following methods:
						new HttpHost(proxy, proxyPort, protocol));
			} 
			DefaultHttpClient client = new DefaultHttpClient(
					configureConnectionManager(params), params);
			if (username != null && password != null) {
				client.getCredentialsProvider().setCredentials(
						new AuthScope(host, port, AuthScope.ANY_REALM),
						new UsernamePasswordCredentials(username, password));
				client.addRequestInterceptor(
						new PreemptiveAuthRequestInterceptor(), 0); 
			} 
 
 
 
			return client;
		} 
 
		public Builder port(int i) {
			port = i;
			return this;
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android UsernamePasswordCredentials Questions & Answers:

See Code Examples for Android UsernamePasswordCredentials Methods: