Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

How to Get Around the Eolas Patent—Automatically : Page 3

Unless it's overturned, the Eolas ruling means tens of thousands of Web pages that use embedded plugins are infringing on the patent. Based on a procedure recommended by Microsoft, this filter will automatically update your HTML so you'll be in the free and clear.


advertisement
Transformation Script
While the Java source is the heart of the filter, the real power comes from the XSLT script (see Listing 2). This is where the logic that governs the transformation resides. This script transforms any OBJECT block in the page into three SCRIPT tag blocks: one for the inclusion of a data handling class, one for the inclusion of a script containing a rendering function, and the last being one a function call into the rendering function.

Here is the logical centerpiece of Microsoft's workaround: Because the call to the plugin is not sourced in a single page it legally circumvents the method patented by Eolas on a disputable technicality. The XSLT script will extract each of the OBJECT tag attributes and all of the subordinate PARAM tags and pass them to the JavaScript method as function arguments.

Using the canned code for this filter, the XSLT script will be drawn from your server's /WEB-INF/filters directory.



JavaScript
As discussed earlier, the page's OBJECT block is replaced with three SCRIPT blocks. The first block links to an external file that contains a data handling class, KeyedArray.js (see Listing 4). The KeyedArray class is a very simple implementation providing associative array functionality. Unless you are customizing this code you'll never have to deal directly with this class.

The second block that links to an external file, MicrosoftEolasFilter.js (see Listing 3), contains a render function called writeObjectBlock.

The third and last is a tag block, which is a call to the rendering function. The rendering function, writeObjectBlock, receives all the information that was previously provided to the browser in the OBJECT block, and its subordinate PARAM tags, as arguments. These are passed to the function with KeyedArray instances. It doesn't do anything special really except to string them all back together as an OBJECT block, writing it back out with a document.write—short and simple.

It is important that the external JavaScript files be placed in a published Web directory. Using the canned code for this filter, the script will be drawn from the same directory as the requested page. This can be changed by altering the value of the SCRIPT entries in the XSL:TEMPLATE block that matches for the HTML HEAD block early in the XSLT script.

Server Configuration
A quick snippet addition (see Listing 5) to your server's web.xml file is all that is needed to hook the filter into place, once all the files are copied into the correct directories. This snippet (two tag blocks) can technically be placed anywhere within the WEB-APP block.

Figure 1. Popup Clock: This JSP page launches the Flash Clock movie. Thanks to the filter, this page doesn't rely on Eolas' patented method.
The first block is the FILTER block, it names the filter, identifies its classes file, and sets the parameters that will be made available to the filter. The parameters are defined in the subordinate INIT-PARAM block. This is where the XSLT script is identified; if you have changed the location of the XSL file you will need to make certain that it is reflected here. The second block, the FILTER-MAPPING block identifies it as part of the filter chain.

Remember that if you have multiple filters installed you may need to carefully investigate the order that they make their appearance in the configuration file. Their order in the file is their order of execution by the server. You want to be careful you are not feeding processed content from one filter that is unreadable to another filter, such as would be the case if the file compression filter ran before the MicrosoftEolasFilter.

Action
So with everything in its place let's take a look. Using a simple JSP page that displays a Flash movie—the Clock example that is part of Flash's product packaging—we can see the filter in action. Copy the JSP page, the Flash movie, and the two JavaScript files into a Web published directory and call it from your browser.

You should see exactly what you'd expect, a page with a Flash movie (see Figure 1).

The real proof can be seen by viewing the page source with the browser.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap