Class UrlPacScriptSource
- java.lang.Object
-
- com.github.markusbernhardt.proxy.selector.pac.UrlPacScriptSource
-
- All Implemented Interfaces:
PacScriptSource
public class UrlPacScriptSource extends Object implements PacScriptSource
Script source that will load the content of a PAC file from an webserver. The script content is cached once it was downloaded.- Author:
- Markus Bernhardt, Copyright 2016, Bernd Rosstauscher, Copyright 2009
-
-
Field Summary
Fields Modifier and Type Field Description static StringOVERRIDE_CONNECT_TIMEOUTstatic StringOVERRIDE_READ_TIMEOUT
-
Constructor Summary
Constructors Constructor Description UrlPacScriptSource(String url)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetScriptContent()getScriptContentprotected intgetTimeOut(String overrideProperty, int defaultValue)Gets the timeout value from a property or uses the given default value if the property cannot be parsed.booleanisScriptValid()isScriptValidStringtoString()
-
-
-
Field Detail
-
OVERRIDE_CONNECT_TIMEOUT
public static final String OVERRIDE_CONNECT_TIMEOUT
- See Also:
- Constant Field Values
-
OVERRIDE_READ_TIMEOUT
public static final String OVERRIDE_READ_TIMEOUT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UrlPacScriptSource
public UrlPacScriptSource(String url)
Constructor- Parameters:
url- the URL to download the script from.
-
-
Method Detail
-
getScriptContent
public String getScriptContent() throws IOException
getScriptContent- Specified by:
getScriptContentin interfacePacScriptSource- Returns:
- a script.
- Throws:
IOException- on read error.- See Also:
PacScriptSource.getScriptContent()
-
getTimeOut
protected int getTimeOut(String overrideProperty, int defaultValue)
Gets the timeout value from a property or uses the given default value if the property cannot be parsed.- Parameters:
overrideProperty- the property to define the timeout value in millisecondsdefaultValue- the default timeout value in milliseconds.- Returns:
- the value to use.
-
toString
public String toString()
- Overrides:
toStringin classObject- See Also:
Object.toString()
-
isScriptValid
public boolean isScriptValid()
isScriptValid- Specified by:
isScriptValidin interfacePacScriptSource- Returns:
- true if everything is fine, else false.
- See Also:
PacScriptSource.isScriptValid()
-
-