Search in sources :

Example 41 with CrawlerSystemException

use of org.codelibs.fess.crawler.exception.CrawlerSystemException in project fess by codelibs.

the class DataConfig method getCredentials.

private Credentials getCredentials(final String webAuthName, final String scheme, final Map<String, String> paramMap) {
    final String username = paramMap.get(CRAWLER_WEB_AUTH + "." + webAuthName + ".username");
    if (StringUtil.isEmpty(username)) {
        throw new CrawlerSystemException("username is empty. webAuth:" + webAuthName);
    }
    final String password = paramMap.get(CRAWLER_WEB_AUTH + "." + webAuthName + ".password");
    Credentials credentials;
    if (Constants.NTLM.equals(scheme)) {
        final String workstation = paramMap.get(CRAWLER_WEB_AUTH + "." + webAuthName + ".workstation");
        final String domain = paramMap.get(CRAWLER_WEB_AUTH + "." + webAuthName + ".domain");
        credentials = new NTCredentials(username, password == null ? StringUtil.EMPTY : password, workstation == null ? StringUtil.EMPTY : workstation, domain == null ? StringUtil.EMPTY : domain);
    } else {
        credentials = new UsernamePasswordCredentials(username, password == null ? StringUtil.EMPTY : password);
    }
    return credentials;
}
Also used : CrawlerSystemException(org.codelibs.fess.crawler.exception.CrawlerSystemException) NTCredentials(org.apache.http.auth.NTCredentials) Credentials(org.apache.http.auth.Credentials) UsernamePasswordCredentials(org.apache.http.auth.UsernamePasswordCredentials) NTCredentials(org.apache.http.auth.NTCredentials) UsernamePasswordCredentials(org.apache.http.auth.UsernamePasswordCredentials)

Aggregations

CrawlerSystemException (org.codelibs.fess.crawler.exception.CrawlerSystemException)41 IOException (java.io.IOException)16 CrawlingAccessException (org.codelibs.fess.crawler.exception.CrawlingAccessException)13 File (java.io.File)11 InputStream (java.io.InputStream)11 UnsupportedEncodingException (java.io.UnsupportedEncodingException)10 BufferedInputStream (java.io.BufferedInputStream)9 ExtractException (org.codelibs.fess.crawler.exception.ExtractException)9 ExtractData (org.codelibs.fess.crawler.entity.ExtractData)8 ResponseData (org.codelibs.fess.crawler.entity.ResponseData)8 Map (java.util.Map)7 MaxLengthExceededException (org.codelibs.fess.crawler.exception.MaxLengthExceededException)7 MalformedURLException (java.net.MalformedURLException)6 HashMap (java.util.HashMap)6 AccessResultDataImpl (org.codelibs.fess.crawler.entity.AccessResultDataImpl)6 RequestData (org.codelibs.fess.crawler.entity.RequestData)6 ResultData (org.codelibs.fess.crawler.entity.ResultData)6 ChildUrlsException (org.codelibs.fess.crawler.exception.ChildUrlsException)6 HashSet (java.util.HashSet)5 TransformerException (javax.xml.transform.TransformerException)5