Sending login information to an HTTP server

A Destination object can supply login information, such as a user name and password, when a web server requests it. Login information is stored in the Context object that you supply when you create a Destination using the DestinationFactory class.

Code sample

context = new Context("DemoContext", new CredentialsCollector() {
    public UsernamePasswordCredentials getBasicAuthenticationCredentials
        (String aeID, Hashtable properties) {
            // Provide or retrieve authentication credentials here.
            // For example, you could display a dialog box to ask your user 
            // to enter a username and password, then return them from 
            // this method.
            return new UsernamePasswordCredentials("username", "password");
    }
});

Was this information helpful? Send us your comments.