I have investiagted Alfresco media-viewers project and also read a lot of documentation on WebScripts.
My idea is to create a Java-backed viewer for the Alfresco Share.
The underlying Java code will be a bit complicated - it has to handle additional URLs to load own resources form the bundle to use them.
The ideal solution is to integrate Java code as Spring Controller and handle URL mapping with @RequestMapping annotation (or through servlet-mapping xml node).
If someone know how Programming with Surf can be used in this case it also would be very helpful.