![]()
HTTP Examples
HTTP Browser Example
The HTTP browser example (MyBrowser.java) demonstrates authentication, cookie management, and proxy management. The example files are:
http/MyBrowser.java http/AuthenticationValidator.java http/CookieValidator.java http/ProxyValidator.javaThis example has support for HTTP authentication. It has an additional window called AuthenticationValidator. When an authentication is sent to the server that requires it, the authentication is displayed in this window.
For example, if authentication is required for a certain site, the Requires Authentication window is displayed, requesting the user's name and password. When the user clicks OK, the authentication is displayed in the AuthenticationValidator window. The user can click Save to avoid having to enter their name and password again. The user also can remove authentications from the list.
Cookie management is built in to the HTTP browser example. An additional window, called CookieValidator, allows the user to save, load, and remove cookies.
This example has support for proxies. The window called ProxyValidator allows the user to add a global proxy and specific proxies for specified domains. These proxies can be saved, loaded, and removed.
PAC Browser Example
The PAC browser example (pac/PACBrowser.java) demonstrates the ICEbrowser HTTP PAC (Proxy Auto-Configuration) functionality specified by Netscape. For more information on PAC, see: http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html
Before trying this example, modify the proxy.pac file as needed and move it to the desired location. Update the location in the source code as well:
PacManager pacManager = new PacManager(new URL("file:///e:/proxy.pac"));After you make these modifications, you can start the PAC browser example. The browser pops up the appropriate query dialogs as follows:
- If all proxies are down (this can be simulated by detaching the network cable, for example), and no DIRECT option is specified, the browser will ask if proxies should be temporarily ignored and if direct connections should be attempted.
- If the user chooses to attempt direct connections, a second dialog is displayed every minute to ask the user if the proxies should be retried (the specification states 20 minutes, but for this example one minute is used).
|
Copyright 2005. ICEsoft Technologies, Inc. http://www.icesoft.com |