本文整理汇总了Java中javax.xml.ws.handler.MessageContext.get方法的典型用法代码示例。如果您正苦于以下问题:Java MessageContext.get方法的具体用法?Java MessageContext.get怎么用?Java MessageContext.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.ws.handler.MessageContext
的用法示例。
在下文中一共展示了MessageContext.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCaller
import javax.xml.ws.handler.MessageContext; //导入方法依赖的package包/类
/**
* @return a token which contains a random Unique ID per caller and the caller IP as well
*/
private String getCaller() {
MessageContext msgx = wsContext.getMessageContext();
HttpServletRequest request = ((HttpServletRequest) msgx.get(MessageContext.SERVLET_REQUEST));
String uid = "";
try {
Map<String, List<String>> headers = (Map<String, List<String>>) msgx.get(MessageContext.HTTP_REQUEST_HEADERS);
uid = headers.get(ApplicationContext.ATS_UID_SESSION_TOKEN).get(0);
} catch (Exception e) {
if (!alreadyLoggedErrorAboutSessionUid) {
log.warn("Could not get ATS UID for call from " + request.getRemoteAddr()
+ ". This error will not be logged again before Agent restart.", e);
alreadyLoggedErrorAboutSessionUid = true;
}
}
return "<Caller: " + request.getRemoteAddr() + "; ATS UID: " + uid + ">";
}
示例2: getRequest
import javax.xml.ws.handler.MessageContext; //导入方法依赖的package包/类
private HttpServletRequest getRequest() {
MessageContext messageContext = context == null ? null : context.getMessageContext();
// See org.apache.cxf.transport.http.AbstractHTTPDestination#HTTP_REQUEST
return messageContext == null ? null : (HttpServletRequest) messageContext.get("HTTP.REQUEST");
}
示例3: getIPFromContext
import javax.xml.ws.handler.MessageContext; //导入方法依赖的package包/类
private String getIPFromContext(WebServiceContext wsc) {
MessageContext mc = wsc.getMessageContext();
HttpServletRequest hsr = (HttpServletRequest) mc.get(MessageContext.SERVLET_REQUEST);
return hsr.getRemoteAddr();
}
示例4: getEndPoint
import javax.xml.ws.handler.MessageContext; //导入方法依赖的package包/类
/**
* @param context
* @return
*/
public static String getEndPoint(MessageContext context) {
HttpServletRequest req = (HttpServletRequest) context.get(MessageContext.SERVLET_REQUEST);
return req != null ? req.getRequestURI().substring(req.getRequestURI().lastIndexOf("/") + 1) : null;
}