本文整理汇总了Java中org.apache.cxf.phase.PhaseInterceptorChain类的典型用法代码示例。如果您正苦于以下问题:Java PhaseInterceptorChain类的具体用法?Java PhaseInterceptorChain怎么用?Java PhaseInterceptorChain使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PhaseInterceptorChain类属于org.apache.cxf.phase包,在下文中一共展示了PhaseInterceptorChain类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import org.apache.cxf.phase.PhaseInterceptorChain; //导入依赖的package包/类
@Override
public DOMSource invoke(final DOMSource bericht) {
LOGGER.debug("BijhoudingWebService aangeroepen");
valideer(bericht);
final BijhoudingVerzoekBericht verzoekBericht =
berichtAuthenticatieInfoService.vulBerichtAanMetOinGegevensUitHttpHeader(PhaseInterceptorChain.getCurrentMessage(), parse(bericht));
BijhoudingAntwoordBericht bijhoudingAntwoordBericht;
try {
bijhoudingAntwoordBericht = bijhoudingService.verwerkBrpBericht(verzoekBericht);
} catch (Exception e) {
LOGGER.error("Algemene fout bij verwerking van bijhoudingsbericht.", e);
bijhoudingAntwoordBericht =
bijhoudingAntwoordBerichtService.maakAntwoordBericht(
verzoekBericht,
Collections.singletonList(MeldingElement.getInstance(Regel.ALG0001, verzoekBericht.getAdministratieveHandeling())),
null,
null);
}
return transformeerNaarDOMSource(bijhoudingAntwoordBericht);
}
示例2: 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;
}
示例3: deleteToolById
import org.apache.cxf.phase.PhaseInterceptorChain; //导入依赖的package包/类
@GET
@Path("/deleteToolById/{toolId}")
@Transactional
@Override
public void deleteToolById(@PathParam(value = "toolId") Long toolId) {
HttpServletRequest request;
if (getMessageContext() != null) {
request = (HttpServletRequest) getMessageContext().getHttpServletRequest();
} else {
request = (HttpServletRequest) PhaseInterceptorChain.getCurrentMessage().get("HTTP.REQUEST");
}
if (null == request || null == request.getSession()) {
LOG.error("request==null, quit!");
} else {
HttpSession session = request.getSession();
User user = (User) session.getAttribute(AuthenticationConstants.KME_USER_KEY);
if (user.isMember("KME-ADMINISTRATORS")) {
getAdminDao().deleteToolById(toolId);
}
}
}
示例4: 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;
}
示例5: deleteHomeScreenById
import org.apache.cxf.phase.PhaseInterceptorChain; //导入依赖的package包/类
@Transactional
@Override
public void deleteHomeScreenById(long homeScreenId) {
HttpServletRequest request;
if (getMessageContext() != null) {
request = (HttpServletRequest) getMessageContext().getHttpServletRequest();
} else {
request = (HttpServletRequest) PhaseInterceptorChain.getCurrentMessage().get("HTTP.REQUEST");
}
if (null == request || null == request.getSession()) {
LOG.error("request==null, quit!");
} else {
HttpSession session = request.getSession();
User user = (User) session
.getAttribute(AuthenticationConstants.KME_USER_KEY);
if (user.isMember("KME-ADMINISTRATORS")) {
getAdminDao().deleteHomeScreenById(homeScreenId);
}
}
}
示例6: 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;
}
示例7: deleteToolById
import org.apache.cxf.phase.PhaseInterceptorChain; //导入依赖的package包/类
@Transactional
@Override
public void deleteToolById(long toolId) {
HttpServletRequest request;
if (getMessageContext() != null) {
request = (HttpServletRequest) getMessageContext()
.getHttpServletRequest();
} else {
request = (HttpServletRequest) PhaseInterceptorChain
.getCurrentMessage().get("HTTP.REQUEST");
}
if (null == request || null == request.getSession()) {
LOG.error("request==null, quit!");
} else {
HttpSession session = request.getSession();
User user = (User) session
.getAttribute(AuthenticationConstants.KME_USER_KEY);
if (user.isMember("KME-ADMINISTRATORS")) {
getAdminDao().deleteToolById(toolId);
}
}
}
示例8: authenticate
import org.apache.cxf.phase.PhaseInterceptorChain; //导入依赖的package包/类
@Override
@POST
@Path("/login")
public AuthResponse authenticate(@FormParam("loginName") String loginName,
@FormParam("password") String password) {
AuthResponse response = getDao().authenticate(loginName, password);
if (response.didAuthenticate()) {
HttpServletRequest request;
if (getMessageContext() != null) {
request = (HttpServletRequest) getMessageContext().getHttpServletRequest();
} else {
request = (HttpServletRequest) PhaseInterceptorChain.getCurrentMessage().get("HTTP.REQUEST");
}
HttpSession session = request.getSession();
session.setAttribute(AuthenticationConstants.KME_USER_KEY, response.getUser());
}
response.setUser(null);
return response;
}
示例9: setupInterceptorChain
import org.apache.cxf.phase.PhaseInterceptorChain; //导入依赖的package包/类
protected InterceptorChain setupInterceptorChain(Exchange exchange) {
if (outgoingInterceptorChain != null) {
return outgoingInterceptorChain;
}
Endpoint endpoint = getEndpoint(exchange);
PhaseManager pm = bus.getExtension(PhaseManager.class);
@SuppressWarnings("unchecked")
List<Interceptor<? extends org.apache.cxf.message.Message>> i1 = bus.getOutInterceptors();
@SuppressWarnings("unchecked")
List<Interceptor<? extends org.apache.cxf.message.Message>> i2 = endpoint.getOutInterceptors();
@SuppressWarnings("unchecked")
List<Interceptor<? extends org.apache.cxf.message.Message>> i3 = getOutInterceptors();
@SuppressWarnings("unchecked")
List<Interceptor<? extends org.apache.cxf.message.Message>> i4 = endpoint.getBinding().getOutInterceptors();
PhaseInterceptorChain phaseInterceptorChain = outboundChainCache.get(pm
.getOutPhases(), i1, i2, i3, i4);
return phaseInterceptorChain;
}
示例10: handleAspect
import org.apache.cxf.phase.PhaseInterceptorChain; //导入依赖的package包/类
/**
* Run the handle the authorization.
*
* @param joinPoint
* @param role
* @return
* @throws Throwable
*/
private Object handleAspect(ProceedingJoinPoint joinPoint, String role) throws Throwable {
Object result = null;
HttpServletRequest request = (HttpServletRequest) PhaseInterceptorChain.getCurrentMessage().get("HTTP.REQUEST");
String uid = request.getRemoteUser();
LOG.debug("Running Authorizor.checkRole for uid=" + uid + ", role=" + role);
if (authorizor == null || authorizor.checkRole(uid, role)) {
LOG.info("Authorizor.checkRole for uid=" + uid + ", role=" + role + ": OK");
result = joinPoint.proceed();
} else {
LOG.info("Authorizor.checkRole for uid=" + uid + ", role=" + role + ": DENIED");
HttpServletResponse response = (HttpServletResponse) PhaseInterceptorChain.getCurrentMessage().get("HTTP.RESPONSE");
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "You do not have the the required role '" + role + "'");
PhaseInterceptorChain.getCurrentMessage().getInterceptorChain().abort();
}
return result;
}
示例11: 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();
}
示例12: 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);
}
示例13: 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);
}
示例14: 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;
}
示例15: getAll
import org.apache.cxf.phase.PhaseInterceptorChain; //导入依赖的package包/类
/**
* @see org.kuali.rice.ksb.messaging.remotedservices.BaseballCardCollectionService#getAll()
*/
public List<BaseballCard> getAll() {
// excuse me while we exploit this service to test service call version headers
// annotations on impl not supported by RESTServiceExporter/RestServiceDefinition
ServiceCallInformationHolder.multiValues = (Map<String, List<String>>)PhaseInterceptorChain.getCurrentMessage().get(Message.PROTOCOL_HEADERS);
return new ArrayList<BaseballCard>(cards.values());
}