org.apache.cxf.phase.Phase Java Examples

The following examples show how to use org.apache.cxf.phase.Phase. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CryptoCoverageCheckerTest.java    From steady with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrder() throws Exception {
    //make sure the interceptors get ordered correctly
    SortedSet<Phase> phases = new TreeSet<Phase>();
    phases.add(new Phase(Phase.PRE_PROTOCOL, 1));
    
    List<Interceptor<? extends Message>> lst = 
        new ArrayList<Interceptor<? extends Message>>();
    lst.add(new MustUnderstandInterceptor());
    lst.add(new WSS4JInInterceptor());
    lst.add(new SAAJInInterceptor());
    lst.add(new CryptoCoverageChecker());
    PhaseInterceptorChain chain = new PhaseInterceptorChain(phases);
    chain.add(lst);
    String output = chain.toString();
    assertTrue(output.contains("MustUnderstandInterceptor, SAAJInInterceptor, "
            + "WSS4JInInterceptor, CryptoCoverageChecker"));
}
 
Example #2
Source File: StaxCryptoCoverageChecker.java    From cxf with Apache License 2.0 5 votes vote down vote up
public StaxCryptoCoverageChecker() {
    super(Phase.PRE_PROTOCOL);

    // Sign SOAP Body
    setSignBody(true);

    // Sign Timestamp
    setSignTimestamp(true);

    // Sign Addressing Headers
    setSignAddressingHeaders(true);

    // Encrypt UsernameToken
    setEncryptUsernameToken(true);
}
 
Example #3
Source File: WSS4JStaxOutInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
public WSS4JStaxOutInterceptor() {
    super();
    WSSec.init();
    setPhase(Phase.PRE_STREAM);
    getBefore().add(StaxOutInterceptor.class.getName());
    getAfter().add("org.apache.cxf.interceptor.LoggingOutInterceptor");
    getAfter().add("org.apache.cxf.ext.logging.LoggingOutInterceptor");
    ending = createEndingInterceptor();
}
 
Example #4
Source File: RedeliveryQueueImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void redeliver() throws Exception {
    LOG.log(Level.INFO, "Redelivering ... for " + (1 + retries));
    String restartingPhase;
    if (message.getContent(Exception.class) != null) {
        message.removeContent(Exception.class);
        message.getExchange().put(Exception.class, null);

        // clean-up message for redelivery
        closeStreamResources();
        message.removeContent(Node.class);
    }


    InputStream is = null;
    CachedOutputStream cos = (CachedOutputStream)message.get(RMMessageConstants.SAVED_CONTENT);
    is = cos.getInputStream();
    message.setContent(InputStream.class, is);
    message = message.getExchange().getEndpoint().getBinding().createMessage(message);
    restartingPhase = Phase.POST_STREAM;
    // skip some interceptor chain phases for redelivery
    InterceptorChain chain = getRedeliveryInterceptorChain(message, restartingPhase);
    ListIterator<Interceptor<? extends Message>> iterator = chain.getIterator();
    while (iterator.hasNext()) {
        Interceptor<? extends Message> incept = iterator.next();
        if (incept.getClass().getName().equals(RMCaptureInInterceptor.class.getName())) {
            chain.remove(incept);
        }
    }
    message.getExchange().setInMessage(message);
    message.setInterceptorChain(chain);
    chain.doIntercept(message);
    Exception ex = message.getContent(Exception.class);
    if (null != ex) {
        throw ex;
    }
}
 
Example #5
Source File: ChainInitiationObserverTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {

    control = EasyMock.createNiceControl();
    message = control.createMock(Message.class);

    Phase phase1 = new Phase("phase1", 1);
    SortedSet<Phase> phases = new TreeSet<>();
    phases.add(phase1);
    chain = new TestChain(phases);
    observer = new ChainInitiationObserver(null, null);
}
 
Example #6
Source File: WSS4JOutInterceptor.java    From steady with Apache License 2.0 5 votes vote down vote up
public WSS4JOutInterceptor() {
    super();
    setPhase(Phase.PRE_PROTOCOL);
    getAfter().add(SAAJOutInterceptor.class.getName());
    
    ending = createEndingInterceptor();
}
 
Example #7
Source File: ValidationInterceptor.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
public ValidationInterceptor() {
    super(Phase.PRE_INVOKE);
    ValidatorFactory defaultFactory = Validation.buildDefaultValidatorFactory();
    validator = defaultFactory.getValidator();
    if (validator == null) {
        log.warn("Bean Validation provider could not be found, no validation will be performed");
    } else {
        log.debug("Validation In-Interceptor initialized successfully");
    }
}
 
Example #8
Source File: OutgoingChainInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public OutgoingChainInterceptor() {
    super(Phase.POST_INVOKE);
}
 
Example #9
Source File: MessageLossSimulator.java    From servicemix with Apache License 2.0 4 votes vote down vote up
public MessageLossSimulator() {
    super(Phase.PREPARE_SEND);
    addBefore(MessageSenderInterceptor.class.getName());
}
 
Example #10
Source File: MAPVerifier.java    From cxf with Apache License 2.0 4 votes vote down vote up
public MAPVerifier() {
    super(Phase.POST_LOGICAL);
}
 
Example #11
Source File: SecurityVerificationOutInterceptor.java    From steady with Apache License 2.0 4 votes vote down vote up
public SecurityVerificationOutInterceptor() {
    super(Phase.PRE_LOGICAL);
}
 
Example #12
Source File: ResponseTimeMessageInvokerInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public ResponseTimeMessageInvokerInterceptor() {
    super(Phase.INVOKE);
    // this interceptor should be add before the serviceInvokerInterceptor
    addBefore(ServiceInvokerInterceptor.class.getName());
}
 
Example #13
Source File: ResponseTimeMessageInInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public ResponseTimeMessageInInterceptor() {
    super(Phase.RECEIVE);
    addBefore(AttachmentInInterceptor.class.getName());
}
 
Example #14
Source File: MalformedResponseInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public MalformedResponseInterceptor() {
    super(Phase.RECEIVE);
    addAfter(LoggingInInterceptor.class.getName());
}
 
Example #15
Source File: OpenTracingClientStopInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public OpenTracingClientStopInterceptor(final Tracer tracer) {
    this(Phase.RECEIVE, tracer);
}
 
Example #16
Source File: HttpAuthenticationFaultHandler.java    From cxf with Apache License 2.0 4 votes vote down vote up
public HttpAuthenticationFaultHandler() {
    super(Phase.UNMARSHAL);
    this.authenticationType = "Basic";
    this.realm = "CXF service";
}
 
Example #17
Source File: SecurityVerificationOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public SecurityVerificationOutInterceptor() {
    super(Phase.PRE_LOGICAL);
}
 
Example #18
Source File: OutFaultChainInitiatorObserver.java    From cxf with Apache License 2.0 4 votes vote down vote up
protected SortedSet<Phase> getPhases() {
    return getBus().getExtension(PhaseManager.class).getOutPhases();
}
 
Example #19
Source File: ClearThreadLocalInterceptor.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
public ClearThreadLocalInterceptor() {
    super(Phase.PRE_INVOKE);
}
 
Example #20
Source File: CorbaStreamOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public CorbaStreamOutInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example #21
Source File: SamlTokenInterceptor.java    From steady with Apache License 2.0 4 votes vote down vote up
/**
 * @param p
 */
public SamlTokenInterceptor() {
    super(Phase.PRE_PROTOCOL);
    addAfter(PolicyBasedWSS4JOutInterceptor.class.getName());
    addAfter(PolicyBasedWSS4JInInterceptor.class.getName());
}
 
Example #22
Source File: LoggingOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public LoggingOutInterceptor(LogEventSender sender) {
    super(Phase.PRE_STREAM, sender);
    addBefore(StaxOutInterceptor.class.getName());
}
 
Example #23
Source File: ConnectionFactoryFeature.java    From cxf with Apache License 2.0 4 votes vote down vote up
JMSConduitConfigOutInterceptor() {
    super(Phase.PREPARE_SEND);
}
 
Example #24
Source File: OAuthRequestInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public String getPhase() {
    return Phase.PRE_INVOKE;
}
 
Example #25
Source File: ResolvingReferencesInterceptor.java    From olingo-odata4 with Apache License 2.0 4 votes vote down vote up
public ResolvingReferencesInterceptor() {
  super(Phase.PRE_PROTOCOL);
}
 
Example #26
Source File: ClientOutFaultObserver.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Override
protected SortedSet<Phase> getPhases() {
    return getBus().getExtension(PhaseManager.class).getOutPhases();
}
 
Example #27
Source File: LogicalHandlerInInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public LogicalHandlerInInterceptor(Binding binding) {
    super(binding, Phase.PRE_PROTOCOL_FRONTEND);
    addAfter(SOAPHandlerInterceptor.class.getName());
}
 
Example #28
Source File: PolicyBasedWSS4JOutInterceptor.java    From steady with Apache License 2.0 4 votes vote down vote up
public String getPhase() {
    return Phase.POST_PROTOCOL;
}
 
Example #29
Source File: XMLFaultInInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public XMLFaultInInterceptor() {
    this(Phase.UNMARSHAL);
}
 
Example #30
Source File: RMOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public RMOutInterceptor() {
    super(Phase.PRE_STREAM);
    addAfter(RMCaptureOutInterceptor.class.getName());
}