/** * Creates an authenticated JIRA client. * * @param uri Base URI of the JIRA server * @param creds Credentials to authenticate with */ public JiraClient(String uri, ICredentials creds) { DefaultHttpClient httpclient = new DefaultHttpClient(); restclient = new RestClient(httpclient, creds, URI.create(uri)); if (creds != null) username = creds.getLogonName(); }
/** * Creates an authenticated JIRA client with custom HttpClient. * * @param httpClient Custom HttpClient to be used * @param uri Base URI of the JIRA server * @param creds Credentials to authenticate with * @throws JiraException */ public JiraClient(HttpClient httpClient, String uri, ICredentials creds) throws JiraException { if (httpClient == null) { PoolingClientConnectionManager connManager = new PoolingClientConnectionManager(); connManager.setDefaultMaxPerRoute(20); connManager.setMaxTotal(40); httpClient = new DefaultHttpClient(connManager); } restclient = new RestClient(httpClient, creds, URI.create(uri)); if (creds != null) { username = creds.getLogonName(); //intialize connection if required creds.initialize(restclient); } }