I have created a custom JavaScript interpreter because I want to avoid creating a dependency on Rhino. I have created implementations of Interpreter and InterpreterFactory interfaces. I am trying to determine the best way of registering my InterpreterFactory with Batik. My current approach is to subclass BridgeContext and hard-code it to return my custom interpreter-
public class CustomBridgeContext extends BridgeContext { public Interpreter getInterpreter(String language) { if (language.equalsIgnoreCase("ecmascript")) { return new MyJavaScriptInterpreter(); } return super.getInterpreter(language); } } I have subclassed JSVGCanvas to return an instance of my CustomBridgeContext - public class CustomJSVGCanvas extends JSVGCanvas { /** * Creates a new bridge context. */ protected BridgeContext createBridgeContext(SVGOMDocument doc) { super.createBridgeContext(doc); return new CustomBridgeContext(userAgent, loader); } } I have read about using Service provider to register InterpreterFactory with batik. However, I could not determine how to use it correctly. Can someone point me to an example of how to register my interpreterfactory with batik script engine. Thanks, Jyoti