Revision 47824 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/SEAuthDownloaderTask.java
SEAuthDownloaderTask.java | ||
---|---|---|
7 | 7 |
import java.net.HttpURLConnection; |
8 | 8 |
import java.net.URL; |
9 | 9 |
import java.util.Objects; |
10 |
import java.util.concurrent.Executor; |
|
10 | 11 |
import org.apache.commons.io.IOUtils; |
11 | 12 |
import org.apache.commons.lang3.StringUtils; |
12 | 13 |
import org.apache.http.Header; |
... | ... | |
26 | 27 |
import org.apache.http.entity.StringEntity; |
27 | 28 |
import org.apache.http.impl.client.CloseableHttpClient; |
28 | 29 |
import org.apache.http.impl.client.HttpClientBuilder; |
29 |
import org.gvsig.compat.se.net.downloader.Downloader; |
|
30 | 30 |
import org.gvsig.compat.se.net.downloader.se.AbstractSEDownloaderTask; |
31 |
import org.gvsig.compat.se.net.downloader.se.SEDownloader; |
|
31 | 32 |
import org.gvsig.downloader.DownloaderAuthenticationConfig; |
32 | 33 |
import org.gvsig.downloader.DownloaderAuthenticationRequester; |
33 | 34 |
import org.gvsig.downloader.DownloaderCredentials; |
34 |
import org.gvsig.downloader.DownloaderManager; |
|
35 | 35 |
|
36 | 36 |
@SuppressWarnings("UseSpecificCatch") |
37 | 37 |
final class SEAuthDownloaderTask |
... | ... | |
78 | 78 |
private static final String METHOD_GET = "GET"; |
79 | 79 |
private static final String METHOD_DELETE = "DELETE"; |
80 | 80 |
|
81 |
public SEAuthDownloaderTask(Downloader downloader, URL url, String data, File dstFile, Object groupID) { |
|
81 |
public SEAuthDownloaderTask(SEDownloader downloader, URL url, String data, File dstFile, Object groupID) {
|
|
82 | 82 |
super(downloader, url, data, dstFile, groupID); |
83 | 83 |
} |
84 | 84 |
|
... | ... | |
113 | 113 |
throw new AuthenticationException("Can't configure service authentication for url '"+this.url+"'."); |
114 | 114 |
} |
115 | 115 |
LOGGER.info("AUTHORIZATION REQUESTER TYPE: "+authorizationRequester.getProviderName()); |
116 |
if( !authorizationRequester.requestAuthorization() ) { |
|
116 |
if( !authorizationRequester.requestAuthorization(this.getExecutorUI()) ) {
|
|
117 | 117 |
return; |
118 | 118 |
} |
119 | 119 |
DownloaderCredentials credentials = authorizationRequester.getCredentials(); |
... | ... | |
133 | 133 |
if( config!=null ) { |
134 | 134 |
DownloaderAuthenticationRequester authorizationRequester = config.create(); |
135 | 135 |
if( authorizationRequester!=null ) { |
136 |
if( authorizationRequester.requestAuthorization() ) { |
|
136 |
if( authorizationRequester.requestAuthorization(this.getExecutorUI()) ) {
|
|
137 | 137 |
credentials = authorizationRequester.getCredentials(); |
138 | 138 |
addOrReplaceCredentials(credentials); |
139 | 139 |
request.addHeader("Authorization", credentials.getAuthorizationToken()); |
... | ... | |
332 | 332 |
} |
333 | 333 |
} |
334 | 334 |
|
335 |
private Executor getExecutorUI() { |
|
336 |
return this.downloader.getExecutorUI(); |
|
337 |
} |
|
335 | 338 |
} |
Also available in: Unified diff