diff options
Diffstat (limited to 'src')
4 files changed, 17 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/service/ChromeCastController.java b/src/github/daneren2005/dsub/service/ChromeCastController.java index 21ee6e13..a729ed4e 100644 --- a/src/github/daneren2005/dsub/service/ChromeCastController.java +++ b/src/github/daneren2005/dsub/service/ChromeCastController.java @@ -288,7 +288,7 @@ public class ChromeCastController extends RemoteController { } if(proxy == null) { - proxy = new WebProxy(downloadService); + proxy = createWebProxy(); proxy.start(); } } else if(proxy != null) { diff --git a/src/github/daneren2005/dsub/service/DLNAController.java b/src/github/daneren2005/dsub/service/DLNAController.java index a2894a23..701034de 100644 --- a/src/github/daneren2005/dsub/service/DLNAController.java +++ b/src/github/daneren2005/dsub/service/DLNAController.java @@ -398,7 +398,7 @@ public class DLNAController extends RemoteController { }
if(proxy == null) {
- proxy = new WebProxy(downloadService);
+ proxy = createWebProxy();
proxy.start();
}
} else if(proxy != null) {
diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java index 341b1158..307afc9a 100644 --- a/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -39,6 +39,7 @@ import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpUriRequest; @@ -1878,4 +1879,8 @@ public class RESTMusicService implements MusicService { return Util.getRestUrl(context, method, instance, allowAltAddress); } } + + public HttpClient getHttpClient() { + return httpClient; + } } diff --git a/src/github/daneren2005/dsub/service/RemoteController.java b/src/github/daneren2005/dsub/service/RemoteController.java index 02deaf85..47730e8c 100644 --- a/src/github/daneren2005/dsub/service/RemoteController.java +++ b/src/github/daneren2005/dsub/service/RemoteController.java @@ -32,6 +32,7 @@ import java.util.concurrent.LinkedBlockingQueue; import github.daneren2005.dsub.R; import github.daneren2005.dsub.domain.RemoteStatus; +import github.daneren2005.serverproxy.WebProxy; public abstract class RemoteController { private static final String TAG = RemoteController.class.getSimpleName(); @@ -95,4 +96,13 @@ public abstract class RemoteController { queue.clear(); } } + + protected WebProxy createWebProxy() { + MusicService musicService = MusicServiceFactory.getMusicService(downloadService); + if(musicService instanceof RESTMusicService) { + return new WebProxy(downloadService, ((RESTMusicService)musicService).getHttpClient()); + } else { + return new WebProxy(downloadService); + } + } } |