Java 类com.sun.jersey.api.client.filter.HTTPDigestAuthFilter 实例源码

项目:tr069-simulator    文件:CPEClientSession.java   
public CPEClientSession (CpeActions cpeActions, String username, String passwd, String authtype) {
    this.cpeActions = cpeActions;       
    this.authtype   = authtype;
    this.username   = username;
    this.passwd     = passwd;       
    String urlstr   = ((ConfParameter)this.cpeActions.confdb.confs.get(this.cpeActions.confdb.props.getProperty("MgmtServer_URL"))).value;  //"http://192.168.1.50:8085/ws?wsdl";
    System.out.println("ACS MGMT URL -------> " + urlstr);
    service = ResourceAPI.getInstance().getResourceAPI(urlstr);     
    if (username != null && passwd != null) {
        if (authtype.equalsIgnoreCase("digest")) {
            service.addFilter(new HTTPDigestAuthFilter(username, passwd));
        } else {
            service.addFilter(new HTTPBasicAuthFilter(username, passwd));
        }
        //System.out.println("==========================> " + username + " " + passwd);
    }
    //System.out.println(" 2nd time ==============> " + username + " " + passwd);
}
项目:springboot-marklogic-sample    文件:MarkLogicSampleApplication.java   
@Bean
public Client getJerseyClient() {
    Client client = Client.create();  // thread-safe
    client.addFilter(new LoggingFilter());
    client.addFilter(new HTTPDigestAuthFilter(username, password));
    return client;
}