src/main/java/com/github/markusbernhardt/proxy/search/desktop/win/WinProxySearchStrategy.java
raw symbols SCIP| 1 | package com.github.markusbernhardt.proxy.search.desktop.win; |
| 2 | |
| 3 | import java.net.ProxySelector; |
| 4 | |
| 5 | import com.github.markusbernhardt.proxy.ProxySearchStrategy; |
| 6 | import com.github.markusbernhardt.proxy.search.browser.ie.IEProxySearchStrategy; |
| 7 | import com.github.markusbernhardt.proxy.util.ProxyException; |
| 8 | |
| 9 | /***************************************************************************** |
| 10 | * Extracts the proxy settings from the windows registry. This will read the |
| 11 | * windows system proxy settings. |
| 12 | * |
| 13 | * @author Markus Bernhardt, Copyright 2016 |
| 14 | * @author Bernd Rosstauscher, Copyright 2009 |
| 15 | ****************************************************************************/ |
| 16 | |
| 17 | public class WinProxySearchStrategy implements ProxySearchStrategy { |
| 18 | |
| 19 | /************************************************************************* |
| 20 | * Constructor |
| 21 | ************************************************************************/ |
| 22 | |
| 23 | public WinProxySearchStrategy() { |
| 24 | super(); |
| 25 | } |
| 26 | |
| 27 | /************************************************************************* |
| 28 | * getProxySelector |
| 29 | * |
| 30 | * @see com.github.markusbernhardt.proxy.ProxySearchStrategy#getProxySelector() |
| 31 | ************************************************************************/ |
| 32 | |
| 33 | @Override |
| 34 | public ProxySelector getProxySelector() throws ProxyException { |
| 35 | // TODO Rossi 08.05.2009 Implement this by using Win API calls. |
| 36 | // new Win32ProxyUtils().winHttpGetDefaultProxyConfiguration() |
| 37 | // Current fallback is to use the IE settings. This is better |
| 38 | // because the registry settings are most of the time not set. |
| 39 | // Some Windows server installations may use it though. |
| 40 | return new IEProxySearchStrategy().getProxySelector(); |
| 41 | } |
| 42 | |
| 43 | /************************************************************************* |
| 44 | * Gets the printable name of the search strategy. |
| 45 | * |
| 46 | * @return the printable name of the search strategy |
| 47 | ************************************************************************/ |
| 48 | |
| 49 | @Override |
| 50 | public String getName() { |
| 51 | return "windows"; |
| 52 | } |
| 53 | |
| 54 | } |