本文整理汇总了Java中org.apache.cxf.phase.PhaseInterceptorChain.getCurrentMessage方法的典型用法代码示例。如果您正苦于以下问题:Java PhaseInterceptorChain.getCurrentMessage方法的具体用法?Java PhaseInterceptorChain.getCurrentMessage怎么用?Java PhaseInterceptorChain.getCurrentMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.phase.PhaseInterceptorChain
的用法示例。
在下文中一共展示了PhaseInterceptorChain.getCurrentMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLoggedInInfo
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
/**
* Gets the login information associated with the current request.
*
* @return
* Returns the login information
*
* @throws IllegalStateException
* IllegalStateException is thrown in case authentication info is not available
*/
protected LoggedInInfo getLoggedInInfo() {
Message message = PhaseInterceptorChain.getCurrentMessage();
HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
LoggedInInfo info = LoggedInInfo.getLoggedInInfoFromSession(request);
if (info != null && info.getLoggedInProvider() == null) {
// It's possible in the OAuth situation that the session is empty, but we have a valid LoggedInInfo on the request.
info = LoggedInInfo.getLoggedInInfoFromRequest(request);
}
if (info == null) {
throw new IllegalStateException("Authentication info is not available.");
}
return info;
}
示例2: saveHomeScreen
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
@Transactional
@Override
public Long saveHomeScreen(HomeScreen homeScreen) {
HttpServletRequest request = null;
if (getMessageContext() != null) {
request = (HttpServletRequest) getMessageContext()
.getHttpServletRequest();
} else {
if (PhaseInterceptorChain.getCurrentMessage() != null) {
request = (HttpServletRequest) PhaseInterceptorChain
.getCurrentMessage().get("HTTP.REQUEST");
}
}
if (null == request || null == request.getSession()) {
LOG.error("request==null, quit!");
return getAdminDao().saveHomeScreen(homeScreen);
} else {
HttpSession session = request.getSession();
User user = (User) session.getAttribute(AuthenticationConstants.KME_USER_KEY);
if (user.isMember("KME-ADMINISTRATORS")) {
return getAdminDao().saveHomeScreen(homeScreen);
}
}
// temporary setting -1 id if user is not authenticated
return null;
}
示例3: saveTool
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
@Transactional
@Override
public Long saveTool(Tool tool) {
HttpServletRequest request = null;
if (getMessageContext() != null) {
request = (HttpServletRequest) getMessageContext()
.getHttpServletRequest();
} else if (PhaseInterceptorChain.getCurrentMessage() != null) {
request = (HttpServletRequest) PhaseInterceptorChain
.getCurrentMessage().get("HTTP.REQUEST");
}
if (null == request || null == request.getSession()) {
LOG.error("request==null, quit!");
return getAdminDao().saveTool(tool);
} else {
HttpSession session = request.getSession();
User user = (User) session
.getAttribute(AuthenticationConstants.KME_USER_KEY);
if (user.isMember("KME-ADMINISTRATORS")) {
return getAdminDao().saveTool(tool);
}
}
return null;
}
示例4: get
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
@Override
public Optional<String> get() {
final Message message = PhaseInterceptorChain.getCurrentMessage();
final Map<String, List<String>> headers = CastUtils.cast((Map<?, ?>) message.get(Message.PROTOCOL_HEADERS));
return headers
.getOrDefault(StringUtils.leftPad(HEADER.PARTIJ_CODE.getNaam(), PARTIJ_CODE_LENGTE, '0'), Collections.emptyList())
.stream()
.findFirst();
}
示例5: get
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
@Override
public OIN get() {
final Message message = PhaseInterceptorChain.getCurrentMessage();
final HttpServletRequest httpRequest = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
final String oinWaardeOndertekenaar = httpRequest.getHeader(OIN.OIN_ONDERTEKENAAR);
final String oinWaardeTransporteur = httpRequest.getHeader(OIN.OIN_TRANSPORTEUR);
return new OIN(oinWaardeOndertekenaar, oinWaardeTransporteur);
}
示例6: logAccess
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
private void logAccess(String action) {
OscarLog log = new OscarLog();
log.setAction(action);
log.setProviderNo("N/A");
Message currentMessage = PhaseInterceptorChain.getCurrentMessage();
HttpServletRequest request = (HttpServletRequest) currentMessage.get("HTTP.REQUEST");
log.setIp(request.getRemoteAddr());
log.setContent(request.getRequestURL().toString());
log.setData(request.getParameterMap().toString());
LogAction.addLogSynchronous(log);
}
示例7: data
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
public ResponseBody data(String source, String interfaceName, String parameter) {
Message message = PhaseInterceptorChain.getCurrentMessage();
HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
String ip = RequestInfoHelper.getRemoteIp(request);
System.out.println("requstId:"+request.getAttribute(FrameConst.CLIENT_REQ_ID));
System.out.println("ip:"+ip);
ResponseBody res = new ResponseBody();
// 获取对应服务
InvocationDefine define = serviceFactoryManager.getInvocationDefine(interfaceName);
if (define == null) {
res.setCode(RtCodeConst.ERR_CODE);
res.setMessage("未找到服务");
logger.warn("未找到服务...");
return res;
}
// 接口参数验证
Map<String, String> sourceMap = JSONUtils.jsonString2Map(source);
if (sourceMap == null || sourceMap.get(FrameConst.CLIENT_FROM) == null) {
res.setCode(RtCodeConst.ERR_CODE);
res.setMessage("接口参数非法");
logger.warn("接口参数非法...");
return res;
}
sourceMap.put(FrameConst.CLIENT_IP, ip);
// 调用服务
ServiceContext serviceContext = new ServiceContext(sourceMap, interfaceName, parameter);
DataServiceProxy serviceProxy = new DataServiceProxy(define, serviceContext);
Object result = serviceProxy.execute();
res.setCode(RtCodeConst.SUCC_CODE);
res.setData(result);
return res;
}
示例8: createSecurityContext
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
protected SecurityContext createSecurityContext(final Principal p) {
Message msg = PhaseInterceptorChain.getCurrentMessage();
if (msg == null) {
throw new IllegalStateException("Current message is not available");
}
return doCreateSecurityContext(p, msg.get(Subject.class));
}
示例9: getMessage
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
protected Message getMessage() {
return PhaseInterceptorChain.getCurrentMessage();
}
示例10: getHttpServletRequest
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
protected HttpServletRequest getHttpServletRequest()
{
Message message = PhaseInterceptorChain.getCurrentMessage();
HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
return(request);
}
示例11: getOAuthContext
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
protected OAuthContext getOAuthContext() {
Message m = PhaseInterceptorChain.getCurrentMessage();
OAuthContext oac = m.getContent(OAuthContext.class);
return oac;
}
示例12: getSecurityContext
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
protected SecurityContext getSecurityContext() {
Message m = PhaseInterceptorChain.getCurrentMessage();
org.apache.cxf.security.SecurityContext sc = m.getContent(org.apache.cxf.security.SecurityContext.class);
return sc;
}
示例13: getOAuthContext
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
protected OAuthContext getOAuthContext() {
Message m = PhaseInterceptorChain.getCurrentMessage();
OAuthContext sc = m.getContent(OAuthContext.class);
return sc;
}
示例14: getUserIp
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
/**
* Get the IP related to this request
*
* @return the request remote address
*/
protected String getUserIp() {
Message message = PhaseInterceptorChain.getCurrentMessage();
HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
return request.getRemoteAddr();
}
示例15: login
import org.apache.cxf.phase.PhaseInterceptorChain; //导入方法依赖的package包/类
/**
* Actual login method
* @param id
* @param pw
* @return
*/
private java.lang.String login(java.lang.String id, java.lang.String pw) {
Message message = PhaseInterceptorChain.getCurrentMessage();
HttpServletRequest request = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
String ipAddress = request.getRemoteAddr();
boolean allowLogin = serverConfigurationService.getBoolean("webservices.allowlogin", false);
if (!allowLogin) {
throw new RuntimeException("Web Services Login Disabled");
}
try {
if ("GET".equals(request.getMethod())) {
log.info("This endpoint {} should use POST instead of GET, GET will be deprecated in a future release", request.getRequestURI());
}
Evidence e = new IdPwEvidence(id, pw, ipAddress);
Authentication a = authenticationManager.authenticate(e);
Session s = sessionManager.startSession();
sessionManager.setCurrentSession(s);
if (s == null) {
log.warn("Web Services Login failed to establish session for id=" + id + " ip=" + ipAddress);
throw new RuntimeException("Unable to establish session");
} else {
// We do not care too much on the off-chance that this fails - folks simply won't show up in presense
// and events won't be trackable back to people / IP Addresses - but if it fails - there is nothing
// we can do anyways.
usageSessionService.login(a.getUid(), id, ipAddress, "SakaiLogin", UsageSessionService.EVENT_LOGIN_WS);
if (log.isDebugEnabled()) {
log.debug("Sakai Web Services Login id=" + id + " ip=" + ipAddress + " session=" + s.getId());
}
return s.getId();
}
} catch (AuthenticationException ex) {
log.warn("Failed Web Services Login id=" + id + " ip=" + ipAddress + ": " + ex.getMessage());
}
throw new RuntimeException("Unable to login");
}