Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.lobobrowser.html.test.SimpleUserAgentContext
UserAgentContext
.
This class is provided for user convenience.
Normally this class should be extended in order to provide appropriate
user agent information and more robust content loading routines.
Method Summary | |
HttpRequest |
|
void |
|
void |
|
String |
|
String |
|
String |
|
String |
|
String |
|
String |
|
String |
|
String | |
protected java.net.Proxy |
|
int |
|
Policy |
|
String |
|
String | |
boolean |
|
boolean |
|
boolean |
|
void |
|
void |
|
void |
|
public HttpRequest createHttpRequest()
Creates aSimpleHttpRequest
instance. TheHttpRequest
object returned by this method is used to load images, scripts, style sheets, and to implement the Javascript XMLHttpRequest class. Override if a custom mechanism to make requests is needed.
- Specified by:
- createHttpRequest in interface UserAgentContext
public void error(String message)
public void error(String message, Throwable throwable)
public String getAppCodeName()
Override to provide the application "code name."
- Specified by:
- getAppCodeName in interface UserAgentContext
public String getAppMinorVersion()
Override to provide the application's minor version.
- Specified by:
- getAppMinorVersion in interface UserAgentContext
public String getAppName()
Override to provide the application name.
- Specified by:
- getAppName in interface UserAgentContext
public String getAppVersion()
Override to provide the application version.
- Specified by:
- getAppVersion in interface UserAgentContext
public String getBrowserLanguage()
Override to provide the browser language. This implementation returns EN.
- Specified by:
- getBrowserLanguage in interface UserAgentContext
public String getCookie(java.net.URL url)
This implementation returns blank. Override if a cookie store is implemented.
- Specified by:
- getCookie in interface UserAgentContext
public String getPlatform()
Returns the value of Java propertyos.name
.
- Specified by:
- getPlatform in interface UserAgentContext
protected java.net.Proxy getProxy()
Gets the connection proxy used in requests created bycreateHttpRequest()
by default. This implementation returnsProxy.NO_PROXY
, but it may be overridden.
public int getScriptingOptimizationLevel()
Returns -1. Override to provide a different Rhino optimization level.
- Specified by:
- getScriptingOptimizationLevel in interface UserAgentContext
public Policy getSecurityPolicy()
Returnsnull
. This method must be overridden if JavaScript code is untrusted.
- Specified by:
- getSecurityPolicy in interface UserAgentContext
public String getUserAgent()
Returns a simple user-agent string.
- Specified by:
- getUserAgent in interface UserAgentContext
public boolean isCookieEnabled()
This implementation returns false. Override to give a different value.
- Specified by:
- isCookieEnabled in interface UserAgentContext
public boolean isMedia(String mediaName)
This implementation returns true for certain media names, such asscreen
.
- Specified by:
- isMedia in interface UserAgentContext
public boolean isScriptingEnabled()
Returnstrue
. Implementations wishing to disable JavaScript may override this method.
- Specified by:
- isScriptingEnabled in interface UserAgentContext
public void setCookie(java.net.URL url, String cookieSpec)
This implementation does nothing. Override if a cookie store is implemented.
- Specified by:
- setCookie in interface UserAgentContext
public void warn(String message)
public void warn(String message, Throwable throwable)