Code example for BasicHttpContext

Methods: setAttribute

0
                new AuthScope(Preferences.getServerAddress(),
                    Preferences.getServerPort(), 
                    "muckebox"), 
                new UsernamePasswordCredentials("muckebox", password));
             
            mContext = new BasicHttpContext();
             
            BasicScheme basicAuth = new BasicScheme();
            mContext.setAttribute("preemptive-auth", basicAuth);
 
            mHttpClient.addRequestInterceptor(new PreemptiveAuth(), 0);
        } 
    } 
     
    public HttpResponse execute(HttpUriRequest request) throws ClientProtocolException, IOException {
        if (mContext != null)
            return mHttpClient.execute(request, mContext);
        else 
            return mHttpClient.execute(request);
    }