Sunday, August 31, 2008

Monkeygrease says now Java's cool too

We have all heard of Greasemonkey but what s Monkeygrease now...(something still evolving not enrolled in wiki).Well Monkeygrease is a proxy-based server-side solution. That means a servlet filter that will allow a web developer to inject JavaScript, CSSor other elements within a web page. It will enable you to move your web application to the Web 2.0 world.

Monkeygrease helps in:
  • Changing the look and feel of a web application
  • Adding DHTML/AJAX features/effects on your site
  • Adding WYSIWYG editing to any textarea field on your site
  • Enhance pages by contextually adding content from external providers
  • Fix usability issues on any page
A typical request from the browser is handled by a web application on a server. Once a request is received by a server, an appropriate response is sent back to the browser. This is how all websites work. Monkeygrease is akin to a proxy. When a web application is enhanced with Monkeygrease, the request is passed through Monkeygrease and if the URL of that request matches a Monkeygrease rule, Monkeygrease applies the rule by modifying the response back to the browser. In the end, you get a page that’s been “enhanced” by Monkeygrease.

How do we get this working...

1. You must have Apache Tomcat 5.x. A web application whose WEB-INF directory is accessible.
2. You can download monkeygrease from here (This will include the jars, monkeygrease.xml file containing rules)
3. Installation
  • 1.Extract the monkeygrease_xxx.zip file you downloaded
  • 2.Upload the monkeygrease.jar file to your web application’s WEB-INF/lib directory. Depending on your application server, you might be able to do this through an administration console, however, if you have access to the web application’s directory, it’s probably easier to do it manually.
  • 3.Upload the monkeygrease.xml file to your web application’s WEB-INF directory.
  • 4.Modify your web application’s web.xml file and add the following lines that define rules. Click here to take the snippet of code. mentioned under point 4 in the linked page.

4. Restart your app server in order to enable the filter.
5. Output of a simple html file before and after can be seen as illustrated in view-example


Hope this start will take Monkeygrease much further...

1 comment:

vijay said...

Great way to start on the server side of Greasemonkey. Kudos to all the Greasemonkey and monkeygrease team. Open Source remains unbeaten