How to configure @HandlerChain to point to a handl

2019-03-30 03:42发布

问题:

Is there a way to reference a handler configuration file (e.g.: handler.xml) that is distributed inside a JAR file?

Something like this: @HandlerChain(file="somefile.jar") or @HandlerChain(file="myhandler.xml"), assuming that myhandler.xml is stored in somefile.jar.

回答1:

For both server and client implementations of handlers using the @HandlerChain annotation, you must specify the location of the handler configuration as either a relative path from the annotated file or as an absolute URL. For example:

@HandlerChain(file="../../common/handlers/myhandlers.xml")

or

@HandlerChain(file="http://foo.com/myhandlers.xml")

Taken from this doc.



回答2:

handler-chain.xml file must be inside the same classpath or same jar. You need to specify the actual location of xml to load.