Java Code Examples for org.apache.cxf.phase.Phase

The following examples show how to use org.apache.cxf.phase.Phase. These examples are extracted from open source projects. 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 Project: steady   Source File: CryptoCoverageCheckerTest.java    License: 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 Project: cxf   Source File: StaxCryptoCoverageChecker.java    License: 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 Project: carbon-device-mgt   Source File: ValidationInterceptor.java    License: 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 4
Source Project: cxf   Source File: WSS4JStaxOutInterceptor.java    License: 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 5
Source Project: cxf   Source File: RedeliveryQueueImpl.java    License: 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 6
Source Project: cxf   Source File: ChainInitiationObserverTest.java    License: 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 7
Source Project: steady   Source File: WSS4JOutInterceptor.java    License: 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 8
Source Project: tomee   Source File: CustomHandler.java    License: Apache License 2.0 4 votes vote down vote up
public CustomHandler() {
    super(Phase.MARSHAL);
    addBefore(JAXRSOutInterceptor.class.getName());
}
 
Example 9
Source Project: cxf   Source File: InFaultChainInitiatorObserver.java    License: Apache License 2.0 4 votes vote down vote up
protected SortedSet<Phase> getPhases() {
    return getBus().getExtension(PhaseManager.class).getInPhases();
}
 
Example 10
public ServerSpanTagInterceptor() {
  super(Phase.PRE_MARSHAL);
}
 
Example 11
public ClientSpanTagInterceptor() {
  super(Phase.RECEIVE);
}
 
Example 12
public TraceeResponseOutInterceptor(TraceeBackend backend, String profile) {
	super(Phase.USER_LOGICAL, OutgoingResponse, backend, profile);
}
 
Example 13
public CommonInterceptor() {
   super(Phase.MARSHAL);
}
 
Example 14
Source Project: steady   Source File: SecurityVerificationOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public SecurityVerificationOutInterceptor() {
    super(Phase.PRE_LOGICAL);
}
 
Example 15
Source Project: cxf   Source File: ResponseTimeMessageInvokerInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
ResponseTimeMessageInvokerEndingInteceptor() {
    super(Phase.INVOKE);
    addAfter(ServiceInvokerInterceptor.class.getName());
}
 
Example 16
Source Project: cxf   Source File: MustUnderstandInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
UltimateReceiverMustUnderstandInterceptor(Set<QName> knownHeaders) {
    super(Phase.INVOKE);
    this.knownHeaders = knownHeaders;
}
 
Example 17
Source Project: carbon-apimgt   Source File: URLValidationInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public URLValidationInterceptor() throws IOException, APIManagementException {
    super(Phase.RECEIVE);
}
 
Example 18
Source Project: cxf   Source File: AttachmentOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public AttachmentOutInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 19
Source Project: cxf   Source File: PersistInInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public PersistInInterceptor() {
    super(Phase.RECEIVE);
}
 
Example 20
Source Project: cxf   Source File: HttpsTokenInterceptorProvider.java    License: Apache License 2.0 4 votes vote down vote up
HttpsTokenInInterceptor() {
    super(Phase.PRE_STREAM);
    addBefore(WSS4JStaxInInterceptor.class.getName());
}
 
Example 21
Source Project: cxf   Source File: JAXRSSoapBookTest.java    License: Apache License 2.0 4 votes vote down vote up
public TestStreamDrainInterptor() {
    super(Phase.RECEIVE);
}
 
Example 22
Source Project: cxf   Source File: RMCaptureOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
CaptureStart() {
    super(Phase.PRE_PROTOCOL);
}
 
Example 23
Source Project: steady   Source File: IssuedTokenInterceptorProvider.java    License: Apache License 2.0 4 votes vote down vote up
public IssuedTokenOutInterceptor() {
    super(Phase.PREPARE_SEND);
}
 
Example 24
Source Project: attic-rave   Source File: JsonResponseWrapperInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public JsonResponseWrapperInterceptor() {
    super(Phase.WRITE);
}
 
Example 25
Source Project: carbon-apimgt   Source File: TokenMergeInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public TokenMergeInterceptor() {
    //We will use PRE_INVOKE phase as we need to process message before hit actual service
    super(Phase.PRE_INVOKE);
}
 
Example 26
public OAuthAuthenticationInterceptor() {
    //We will use PRE_INVOKE phase as we need to process message before hit actual service
    super(Phase.PRE_INVOKE);
}
 
Example 27
Source Project: steady   Source File: HttpsTokenInterceptorProvider.java    License: Apache License 2.0 4 votes vote down vote up
public HttpsTokenOutInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 28
Source Project: cxf   Source File: SAAJOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public SAAJOutEndingInterceptor() {
    super(SAAJOutEndingInterceptor.class.getName(), Phase.PRE_PROTOCOL_ENDING);
}
 
Example 29
Source Project: cxf   Source File: PolicyBasedWSS4JOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public String getPhase() {
    return Phase.POST_PROTOCOL;
}
 
Example 30
Source Project: cxf   Source File: KerberosTokenInterceptorProvider.java    License: Apache License 2.0 4 votes vote down vote up
KerberosTokenOutInterceptor() {
    super(Phase.PREPARE_SEND);
}