Skip to main content

DOMService Plugability

1 reply [Last post]
xian594
Offline
Joined: 2007-07-15
Points: 0

In the "DOMService Plugability" section of this help page for Java 1.5:

http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/java_js...

It states that you can set the system property "com.sun.browser.dom.DOMServiceProvider" to a fully-qualified class name for an implementation of DOMServiceProvider, and when "DOMService.getService(obj)" is called, it will query canHandle(Object) on the specified implementation to see if the implementation can provide a DOMService. If canHandle(Object) returns true, that implementation should be returned by DOMService.getService(Object).

Has anyone gotten this to work on 1.6.0_10-beta (aka 1.6u10)? The class specified in the system property seems to be ignored. I noticed the package name in the system property name given in the URL above does not match the true package name of DOMServiceProvider (it's missing a ".java" in the doc--it should be "com.sun.java.browser.dom.DOMServiceProvider") and I tried that system property name as well, but that did not work either.

My DOMServiceProvider and DOMService classes are in the same JAR as the code that is executing "DOMService.getService(this)", so I know this is not a classpath issue. The behavior I am seeing is that the 2 system property names I tried (the one with and the one without the ".java." in it) are both ignored, and DOMService.getService(Object) always returns DOMService from the sun.plugin.dom package, not the one I specify in the system property.

So my question is: has this changed since Java 1.5/5.0? If yes, what's the new preferred method for swapping out the implementation of DOMService?

Thanks!
xian594

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kbr
Offline
Joined: 2003-06-16
Points: 0

As far as I have been able to tell the DOMServiceProvider hook was never implemented properly. In fact the old com.sun.java.browser.dom interfaces were overly complicated and their implementation has been poor for a number of years.

In 6u10 I rewrote the DOM implementation in the new Java Plug-In. The new implementation is much simpler, more regular and should be more correct.

There is a new entry point to gain access to the DOM. It is described here:

http://developers.sun.com/learning/javaoneonline/j1sessn.jsp?sessn=TS-62...

It will be documented in the release notes at http://jdk6.dev.java.net/plugin2/ soon.

What was your primary motivation for swapping out the DOMService implementation? If this wasn't supported any more, would it affect your application? It seems to me that there isn't much use for being able to interpose at this level as long as the underlying Common DOM implementation actually works.