* @param context Stores the Service, port QName and optionnaly a HandlerInfoChainFactory
* @return Returns a HandlerChain if one has been specified
*/
protected HandlerChain getJAXRPChandlerChain(MessageContext context) {
java.util.List chain = null;
HandlerInfoChainFactory hiChainFactory = null;
boolean clientSpecified = false;
Service service = (Service) context.getProperty(Call.WSDL_SERVICE);
if(service == null) {
return null;
}
QName portName = (QName) context.getProperty(Call.WSDL_PORT_NAME);
if(portName == null) {
return null;
}
javax.xml.rpc.handler.HandlerRegistry registry;
registry = service.getHandlerRegistry();
if(registry != null) {
chain = registry.getHandlerChain(portName);
if ((chain != null) && (!chain.isEmpty())) {
hiChainFactory = new HandlerInfoChainFactory(chain);
clientSpecified = true;
}
}
// Otherwise, use the container support
if (!clientSpecified) {
SOAPService soapService = context.getService();
if (soapService != null) {
// A client configuration exists for this service. Check
// to see if there is a HandlerInfoChain configured on it.
hiChainFactory = (HandlerInfoChainFactory)
soapService.getOption(Constants.ATTR_HANDLERINFOCHAIN);
}
}
if (hiChainFactory == null) {
return null;
}
return hiChainFactory.createHandlerChain();
}