com.jniwrapper.win32.ie
Class Browsers

java.lang.Object
  extended by com.jniwrapper.win32.ie.Browsers

public class Browsers
extends java.lang.Object

This is a utility class for browser-related operations.


Field Summary
static InternetFeatures PROCESS_FEATURES
          The Internet features for the current process.
static InternetFeatures THREAD_FEATURES
          The Internet features for the current thread.
static InternetFeatures THREAD_INTERNET_FEATURES
          The Internet features for the Internet zone.
static InternetFeatures THREAD_INTRANET_FEATURES
          The Internet features for the intranet zone.
static InternetFeatures THREAD_LOCALMACHINE_FEATURES
          The Internet features for the local machine zone.
static InternetFeatures THREAD_RESTRICTED_FEATURES
          The Internet features for the restricted zone.
static InternetFeatures THREAD_TRUSTED_FEATURES
          The Internet features for the trusted zone.
 
Method Summary
static void clearCache(com.jniwrapper.win32.wininet.InternetCacheEntry cacheEntry)
          Clears the Internet Explorer cache.
static com.jniwrapper.win32.shdocvw.IWebBrowser2 getBrowserPeer(WebBrowser browser)
          Returns an instance of the native web browser peer IWebBrowser2 of the passed browser object.
static com.jniwrapper.win32.ui.Wnd getBrowserWindow(WebBrowser browser)
          Returns handle of the browser window.
static int getDisplayMixedContentSetting()
           
static java.lang.String getIEVersion()
          Returns a major version of system MS Internet Explorer application.
static com.jniwrapper.win32.automation.OleMessageLoop getOleMessageLoop(WebBrowser browser)
          Returns an instance of the message loop support OleMessageLoop of the passed browser object.
static ProxyConfiguration getProxy()
          Returns the system local area network (LAN) proxy settings.
static com.jniwrapper.win32.winhttp.ProxySettings getProxySettings()
          Deprecated. use the getProxy() method instead
static int getZoneActionPolicyValue(int urlZone, int urlAction, int urlZoneReg)
          Gets the policy associated with the specified URL action.
static boolean isBrowserSupported()
          Function that determines if the IE browser version is supported.
static boolean isSameBrowserPeer(WebBrowser webBrowser1, WebBrowser webBrowser2)
          Returns true if both object are web browsers for the same native browser.
static void setDisplayMixedContentSetting(int value)
          Updates the "Display Mixed Content" security setting.
static void setProxy(ProxyConfiguration conf)
          Updates the system local area network (LAN) proxy settings to the specified proxy server configuration.
static void setZoneActionPolicyValue(int urlZone, int urlAction, int urlZoneReg, int value)
          Sets the action policy associated with a zone.
static void turnOnCompatibilityMode(java.lang.String version)
          Configures browser compatibility mode to the passed version.
static void turnOnGPURendering()
          Enables GPU acceleration for all Browser instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THREAD_FEATURES

public static final InternetFeatures THREAD_FEATURES
The Internet features for the current thread.


PROCESS_FEATURES

public static final InternetFeatures PROCESS_FEATURES
The Internet features for the current process.


THREAD_LOCALMACHINE_FEATURES

public static final InternetFeatures THREAD_LOCALMACHINE_FEATURES
The Internet features for the local machine zone.


THREAD_INTRANET_FEATURES

public static final InternetFeatures THREAD_INTRANET_FEATURES
The Internet features for the intranet zone.


THREAD_TRUSTED_FEATURES

public static final InternetFeatures THREAD_TRUSTED_FEATURES
The Internet features for the trusted zone.


THREAD_INTERNET_FEATURES

public static final InternetFeatures THREAD_INTERNET_FEATURES
The Internet features for the Internet zone.


THREAD_RESTRICTED_FEATURES

public static final InternetFeatures THREAD_RESTRICTED_FEATURES
The Internet features for the restricted zone.

Method Detail

getBrowserPeer

public static com.jniwrapper.win32.shdocvw.IWebBrowser2 getBrowserPeer(WebBrowser browser)
Returns an instance of the native web browser peer IWebBrowser2 of the passed browser object.

Parameters:
browser - browser object.
Returns:
native peer object.

getOleMessageLoop

public static com.jniwrapper.win32.automation.OleMessageLoop getOleMessageLoop(WebBrowser browser)
Returns an instance of the message loop support OleMessageLoop of the passed browser object.

Parameters:
browser - browser object.
Returns:
message loop for the browser.

isSameBrowserPeer

public static boolean isSameBrowserPeer(WebBrowser webBrowser1,
                                        WebBrowser webBrowser2)
Returns true if both object are web browsers for the same native browser.

Parameters:
webBrowser1 - the first instance to compare
webBrowser2 - the second instance to compare
Returns:
true if both browsers use the same native browser

getBrowserWindow

public static com.jniwrapper.win32.ui.Wnd getBrowserWindow(WebBrowser browser)
Returns handle of the browser window.

Parameters:
browser - browser object
Returns:
browser's handle

isBrowserSupported

public static boolean isBrowserSupported()
Function that determines if the IE browser version is supported.

Returns:
true if browser version is 6.x and greater, false otherwise

getProxy

public static ProxyConfiguration getProxy()
Returns the system local area network (LAN) proxy settings.

Returns:
the system proxy settings.
See Also:
setProxy(ProxyConfiguration)

setProxy

public static void setProxy(ProxyConfiguration conf)
Updates the system local area network (LAN) proxy settings to the specified proxy server configuration. The new proxy configuration for LAN will not apply to dial-up or VPN connections, but it will apply to all processes that use global system LAN settings.

To receive information about proxy settings please use the getProxy() method.

Parameters:
conf - the proxy settings to apply.
Throws:
java.lang.IllegalArgumentException - when the conf parameter is null
See Also:
getProxy()

getProxySettings

public static com.jniwrapper.win32.winhttp.ProxySettings getProxySettings()
                                                                   throws com.jniwrapper.win32.winhttp.WinHttpException
Deprecated. use the getProxy() method instead

Returns Internet Explorer proxy settings.

Returns:
information about proxy settings of Internet Explorer
Throws:
com.jniwrapper.win32.winhttp.WinHttpException - when some errors occurs during receiving proxy settings
See Also:
getProxy()

getIEVersion

public static java.lang.String getIEVersion()
Returns a major version of system MS Internet Explorer application.

Returns:
a major version of system MS Internet Explorer application or null when some errors happen during version receiving.
Throws:
java.lang.RuntimeException - when cannot read MS IE version.

clearCache

public static void clearCache(com.jniwrapper.win32.wininet.InternetCacheEntry cacheEntry)
Clears the Internet Explorer cache.

To clear:

  • Internet Temporary files pass InternetCacheEntry.NORMAL_CACHE_ENTRY value.
  • All stored cookies pass InternetCacheEntry.COOKIE_CACHE_ENTRY value.
  • URL history pass InternetCacheEntry.URLHISTORY_CACHE_ENTRY value.
  • Parameters:
    cacheEntry - Internet cache entry type that will be cleared.

    turnOnGPURendering

    public static void turnOnGPURendering()
    Enables GPU acceleration for all Browser instances. GPU acceleration is available only for MS Internet Explorer 9+.


    turnOnCompatibilityMode

    public static void turnOnCompatibilityMode(java.lang.String version)
    Configures browser compatibility mode to the passed version. By default each Browser instance is configured to be compatible with MS IE 7 version.

    Parameters:
    version - a string that represents compatibility mode version. This string must represents a number in range: version >= 7.

    getDisplayMixedContentSetting

    public static int getDisplayMixedContentSetting()
    Returns:
    state of "Display Mixed Content" security setting. It should be one of the following:

    setDisplayMixedContentSetting

    public static void setDisplayMixedContentSetting(int value)
    Updates the "Display Mixed Content" security setting.

    Parameters:
    value - the new value of setting to apply.
    Throws:
    java.lang.RuntimeException - when cannot read security setting.
    See Also:
    getDisplayMixedContentSetting()

    getZoneActionPolicyValue

    public static int getZoneActionPolicyValue(int urlZone,
                                               int urlAction,
                                               int urlZoneReg)
    Gets the policy associated with the specified URL action.

    Parameters:
    urlZone - value of the zone. It should be one of the following:
      IInternetZoneManagerImpl.URLZONE_INTERNET IInternetZoneManagerImpl.URLZONE_INTRANET IInternetZoneManagerImpl.URLZONE_TRUSTED IInternetZoneManagerImpl.URLZONE_UNTRUSTED IInternetZoneManagerImpl.URLZONE_LOCAL_MACHINE
      urlAction - value of the action. Foe example,
        IInternetZoneManagerImpl.URLACTION_HTML_MIXED_CONTENT
        urlZoneReg - value that specifies the section in the registry. It should be one of the following:
          IInternetZoneManagerImpl.URLZONEREG_DEFAULT IInternetZoneManagerImpl.URLZONEREG_HKCU IInternetZoneManagerImpl.URLZONEREG_HKLM
          Returns:
          value of action.
          Throws:
          java.lang.RuntimeException - when cannot read security setting.
          See Also:
          setZoneActionPolicyValue(int, int, int, int)

    setZoneActionPolicyValue

    public static void setZoneActionPolicyValue(int urlZone,
                                                int urlAction,
                                                int urlZoneReg,
                                                int value)
    Sets the action policy associated with a zone.

    Parameters:
    urlZone - value of the zone. It should be one of the following:
      IInternetZoneManagerImpl.URLZONE_INTERNET IInternetZoneManagerImpl.URLZONE_INTRANET IInternetZoneManagerImpl.URLZONE_TRUSTED IInternetZoneManagerImpl.URLZONE_UNTRUSTED IInternetZoneManagerImpl.URLZONE_LOCAL_MACHINE
      urlAction - value of the action. Foe example,
        IInternetZoneManagerImpl.URLACTION_HTML_MIXED_CONTENT
        urlZoneReg - value that specifies the section in the registry. It should be one of the following:
          IInternetZoneManagerImpl.URLZONEREG_DEFAULT IInternetZoneManagerImpl.URLZONEREG_HKCU IInternetZoneManagerImpl.URLZONEREG_HKLM
          value - value of action
          Throws:
          java.lang.RuntimeException - when cannot read security setting.
          See Also:
          getZoneActionPolicyValue(int, int, int)