svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.downloader / org.gvsig.downloader.lib / org.gvsig.downloader.lib.impl / src / main / java / org / gvsig / downloader / lib / impl / types / httpbasic / DownloaderHTTPBasicAuthenticationFactory.java @ 47821
History | View | Annotate | Download (1.43 KB)
1 |
package org.gvsig.downloader.lib.impl.types.httpbasic; |
---|---|
2 |
|
3 |
import org.gvsig.compat.CompatLocator; |
4 |
import org.gvsig.downloader.DownloaderAuthenticationFactory; |
5 |
import org.gvsig.downloader.DownloaderManager; |
6 |
import org.gvsig.downloader.spi.AbstractDownloaderAuthenticationFactory; |
7 |
import static org.gvsig.tools.util.CachedValue.LOGGER; |
8 |
|
9 |
|
10 |
/**
|
11 |
*
|
12 |
* @author jjdelcerro
|
13 |
*/
|
14 |
@SuppressWarnings("UseSpecificCatch") |
15 |
public class DownloaderHTTPBasicAuthenticationFactory |
16 |
extends
|
17 |
AbstractDownloaderAuthenticationFactory |
18 |
implements
|
19 |
DownloaderAuthenticationFactory |
20 |
{ |
21 |
public static final String HTTPBASIC_AUTHENTICATION_NAME = "HTTP Basic"; |
22 |
|
23 |
public DownloaderHTTPBasicAuthenticationFactory() {
|
24 |
super(HTTPBASIC_AUTHENTICATION_NAME);
|
25 |
} |
26 |
|
27 |
@Override
|
28 |
public DownloaderHTTPBasicAuthenticationConfig create(Object... parameters) { |
29 |
return new DownloaderHTTPBasicAuthenticationConfig(this, (String)parameters[0]); |
30 |
} |
31 |
|
32 |
@Override
|
33 |
public String toString() { |
34 |
return this.getProviderName(); |
35 |
} |
36 |
|
37 |
public static void selfRegister() { |
38 |
try {
|
39 |
DownloaderManager downloader = (DownloaderManager) CompatLocator.getDownloader(); |
40 |
downloader.registerAuthenticationType(new DownloaderHTTPBasicAuthenticationFactory());
|
41 |
} catch(Throwable t) { |
42 |
LOGGER.warn("Can't register http-basic downloader authentication factory ",t);
|
43 |
} |
44 |
} |
45 |
|
46 |
} |