public static void copyInterceptorsFromProvider( InterceptorProvider source, InterceptorProvider target) { if (source != null) { copyInterceptorsFromList(source.getInInterceptors(), target.getInInterceptors()); copyInterceptorsFromList(source.getInFaultInterceptors(), target.getInFaultInterceptors()); copyInterceptorsFromList(source.getOutInterceptors(), target.getOutInterceptors()); copyInterceptorsFromList(source.getOutFaultInterceptors(), target.getOutFaultInterceptors()); } }
/** * Called to configure any interceptors of the service. * @param svrFactory * the server factory. */ protected void configureInterceptors(ServerFactoryBean svrFactory) { svrFactory.getInInterceptors().add(new Cxf3791WorkaroundInterceptor()); InterceptorUtils.copyInterceptorsFromProvider(customInterceptors, svrFactory); if (rejectionHandlingStrategy != null) { svrFactory.getInInterceptors().add(new InPayloadExtractorInterceptor(HTTP)); RejectionHandlerInterceptor rejectionHandlerInterceptor = new RejectionHandlerInterceptor(rejectionHandlingStrategy); svrFactory.getOutInterceptors().add(rejectionHandlerInterceptor); svrFactory.getOutFaultInterceptors().add(rejectionHandlerInterceptor); } }
/** * Returns an audit dataset instance which corresponds to the given message. * <p> * When no such instance is currently associated with the message, a new one * will be created by means of the corresponding {@link AuditStrategy} * and registered in the message's exchange. * * @param message CXF message currently handled by this interceptor. * @return an audit dataset instance, or <code>null</code> when this instance * could be neither obtained nor created from scratch. */ protected T getAuditDataset(SoapMessage message) { T auditDataset = InterceptorUtils.findContextualProperty(message, DATASET_CONTEXT_KEY); if (auditDataset == null) { auditDataset = getAuditStrategy().createAuditDataset(); if (auditDataset == null) { LOG.warn("Cannot obtain audit dataset instance, NPE is pending"); return null; } message.getExchange().put(DATASET_CONTEXT_KEY, auditDataset); } return auditDataset; }
InterceptorUtils.copyInterceptorsFromProvider(customInterceptors, client);
public void logPayload(Message message) { Long sequenceId = InterceptorUtils.findContextualProperty(message, SEQUENCE_ID_PROPERTY_NAME); if (sequenceId == null) { sequenceId = getNextSequenceId(); message.getExchange().put(SEQUENCE_ID_PROPERTY_NAME, sequenceId); } WsPayloadLoggingContext spelContext = new WsPayloadLoggingContext( sequenceId, Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE))); boolean isOutbound = MessageUtils.isOutbound(message); doLogPayload( spelContext, (String) message.get(Message.ENCODING), isOutbound ? getOutboundMetadataPayload(message) : getInboundMetadataPayload(message), getHeadersPayload(message), isOutbound ? getOutboundBodyPayload(message) : getInboundBodyPayload(message)); }