本文整理汇总了Java中org.apache.cxf.message.Message.getInterceptorChain方法的典型用法代码示例。如果您正苦于以下问题:Java Message.getInterceptorChain方法的具体用法?Java Message.getInterceptorChain怎么用?Java Message.getInterceptorChain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.message.Message
的用法示例。
在下文中一共展示了Message.getInterceptorChain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleMessage
import org.apache.cxf.message.Message; //导入方法依赖的package包/类
/**
* This is the actual implementation for our interceptor - we define the necessary properties for doing the authentication
* and then iterate over the rest of the interceptor chain to find the WSS4J interceptor and configure it properly.
*/
public void handleMessage(Message message) throws Fault {
/*
* Define the configuration properties
*/
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put("action", "UsernameToken");
outProps.put("passwordType", "PasswordText");
/*
* The username ('admin') is provided as a literal, the corresponding password will be determined by the client
* password callback object.
*/
outProps.put("user", "admin");
outProps.put("passwordCallbackClass", ClientPasswordCallback.class.getName());
/*
* Find the WSS4J interceptor in the interceptor chain and set the configuration properties
*/
for (Interceptor interceptor : message.getInterceptorChain()) {
//set properties for WSS4JOutInterceptor
if (interceptor.getClass().getName().equals("org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor")) {
((WSS4JOutInterceptor) interceptor).setProperties(outProps);
}
}
}