<%@ page import = "com.cyscape.browserhawk.*" %>

<%
  // This sample is provided under the terms of the BrowserHawk End User
  // License Agreement. Copyright (c) 2003-2010 cyScape, Inc. All rights
  // reserved.

	// This sample demonstrates how to accurately detect the user's operating
	// system name and version, and the hardware architecture (such as x64 vs.
	// PPC).  These properties are exposed through the ExtendedBrowserInfo class
	// OSName, OSVersion, and OSArch.

	// Note: The user must have Java installed to detect these properties.

	// YOU MUST HAVE THE JVMDetector.class FILE, DISTRIBUTED WITH YOUR
	// BROWSERHAWK INSTALLATION FILES, IN THE WEB DIRECTORY WHERE YOUR SCRIPT
	// THAT DETECTS THESE PROPERTIES RUNS FROM.

	// Although we have made this sample very verbose with comments for
	// educational purposes, note that it takes only a few lines of code to
	// detect the Broadband property -  1) the creation of the ExtendedOptions
	// class, 2) using ExtendedOptions to set testing preferences and options,
	// and 3) calling to getExtendedBrowserInfo() to obtain an
	// ExtendedBrowserInfo instance where the answers can be obtained via the
	// OSName, OSVersion, and OSArch properties.

  // First we make sure the system executing this example has an
  // Enterprise Edition license as required for this test.
  // Note: This is NOT needed in your pages, only for this sample.
  if (BrowserHawk.getVersion().indexOf("Ent") == -1) {
    out.println("Enterprise License Required.  ");
    out.println("You are using " + BrowserHawk.getVersion() + ".  ");
    out.println("See <a href='http://www.cyscape.com/order/'>http://www.cyscape.com/order/</a> for upgrade information.");
    return;
  }

	// To run the test we create the ExtendedOptions object.  This object is used
  // to set various preferences and options, such as which extended properties
  // we want tested and related testing parameters.
	ExtendedOptions options = new ExtendedOptions();

	// Now we tell BrowserHawk we want to test for OSName, OSVersion, and
	// OSArch.  If there are other settings you want to check as well, such as
	// disabled cookies/JavaScript, plugins, etc, you can do so concurrently
	// with these tests by adding the appropriate values to the statement below.
	// See the ExtendedOptions class in the BrowserHawk documentation for more
	// information.
	options.addProperties("OSName, OSVersion, OSArch");

	// OK, let's perform the check for Broadband. See the ExtendedOptions class
	// in the documentation for details on options available such as controlling
	// the background color of the screen and page messages i.e.  "Checking your
	// browser. Please wait...". TIP: Set the BGCOLOR parameter below to your
	// site's background color. Otherwise you may notice a color
	// flicker during the test.

  options.setPageMessage("BrowserHawk is checking your operating system. Please wait...");
  options.setBodyTag("BGCOLOR=#FFFFFF");
  options.setPageTitle("Please wait...");

  ExtendedBrowserInfo ebi =
    BrowserHawk.getExtendedBrowserInfo(request, response, options);

  // If ebi is null (undefined), we must end the current request here.  The
  // browser will now process the client side tests and call this page back a
  // second time, and this time ebi will not be null.
  if (ebi == null) return;
%>

<html>
<head><title>BrowserHawk Sample - Operating System information</title>
</head>
<body><font face="arial">
<blockquote>

<h2>BrowserHawk Operating System Information</h2>
<font size=3>

Operating system name: <%= ebi.getOSName() %>
<p>
Operating system version: <%= ebi.getOSVersion() %>
<p>
Operating system architecture: <%= ebi.getOSArch() %>
<p>

Note: If you do not see answers above it is because you do not have Java 
available. Detection of these properties requires Java.
<hr>

<P>
<b><a href="osinfo.jsp">Retry this test</a></b><P>
<b><a href="index.html">Return to list of other JSP samples</a></b><P>
<b><a href="http://www.cyscape.com/order/">BrowserHawk Pricing and Ordering</a></b><P>
<b><a href="http://www.cyscape.com/">cyScape home page</a></b><P>
</font></blockquote>
</body>
</html>
