public List<Interceptor<? extends Message>> getOutFaultInterceptors() { if (bus != null) { return bus.getOutFaultInterceptors(); } return super.getOutFaultInterceptors(); }
public void setOutFaultInterceptors(List<Interceptor<? extends Message>> interceptors) { if (bus != null) { bus.getOutFaultInterceptors().addAll(interceptors); } else { super.setOutFaultInterceptors(interceptors); } }
public void setOutFaultInterceptors(List<Interceptor<? extends Message>> interceptors) { if (bus != null) { bus.getOutFaultInterceptors().addAll(interceptors); } else { super.setOutFaultInterceptors(interceptors); } }
public List<Interceptor<? extends Message>> getOutFaultInterceptors() { if (bus != null) { return bus.getOutFaultInterceptors(); } return super.getOutFaultInterceptors(); }
public synchronized void removeBusInterceptors() { bus.getInInterceptors().remove(PolicyInInterceptor.INSTANCE); bus.getOutInterceptors().remove(PolicyOutInterceptor.INSTANCE); bus.getInFaultInterceptors().remove(ClientPolicyInFaultInterceptor.INSTANCE); bus.getOutFaultInterceptors().remove(ServerPolicyOutFaultInterceptor.INSTANCE); bus.getInFaultInterceptors().remove(PolicyVerificationInFaultInterceptor.INSTANCE); addedBusInterceptors = false; }
public synchronized void removeBusInterceptors() { bus.getInInterceptors().remove(PolicyInInterceptor.INSTANCE); bus.getOutInterceptors().remove(PolicyOutInterceptor.INSTANCE); bus.getInFaultInterceptors().remove(ClientPolicyInFaultInterceptor.INSTANCE); bus.getOutFaultInterceptors().remove(ServerPolicyOutFaultInterceptor.INSTANCE); bus.getInFaultInterceptors().remove(PolicyVerificationInFaultInterceptor.INSTANCE); addedBusInterceptors = false; }
void registerInterceptorsToBus() { ResponseTimeMessageInInterceptor in = new ResponseTimeMessageInInterceptor(); ResponseTimeMessageInvokerInterceptor invoker = new ResponseTimeMessageInvokerInterceptor(); ResponseTimeMessageOutInterceptor out = new ResponseTimeMessageOutInterceptor(); bus.getInInterceptors().add(in); bus.getInInterceptors().add(invoker); bus.getOutInterceptors().add(out); bus.getOutFaultInterceptors().add(out); bus.setExtension(this, CounterRepository.class); //create CounterRepositroyMoniter to writer the counter log //if the service is stopped or removed, the counters should remove itself }
protected ByteArrayOutputStream setupOutLogging() { PayloadLogEventSender sender = new PayloadLogEventSender(); LoggingOutInterceptor out = new LoggingOutInterceptor(sender); this.bus.getOutInterceptors().add(out); this.bus.getOutFaultInterceptors().add(out); return sender.bos; }
@Test public void testExceptionPropertyOrder() throws Throwable { ((Bus)applicationContext.getBean("cxf")).getOutFaultInterceptors().add(new LoggingOutInterceptor(fault)); TestService testClient = getTestClient(); ((BindingProvider)testClient).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/service/TestEndpoint"); try { testClient.echo("Exception"); } catch (PropertyOrderException e) { Assert.assertTrue("Expect <message> element is before <data> element :" + fault.getMessage(), fault.getMessage().indexOf("</message><data") > -1); } }
protected void run() { System.setProperty("temp.location", tmpDir); SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/rm.xml"); BusFactory.setDefaultBus(bus); setBus(bus); LoggingInInterceptor in = new LoggingInInterceptor(); bus.getInInterceptors().add(in); LoggingOutInterceptor out = new LoggingOutInterceptor(); bus.getOutInterceptors().add(out); bus.getOutFaultInterceptors().add(out); GreeterImpl implementor = new GreeterImpl(); String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort"; ep = Endpoint.publish(address, implementor); LOG.info("Published greeter endpoint."); } public void tearDown() {
protected void run() { SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/http-addr-server.xml"); setBus(bus); GreeterImpl implementor = new GreeterImpl(); implementor.setThrowAlways(true); Endpoint.publish("http://localhost:" + PORT + "/SoapContext/GreeterPort", implementor); LOG.info("Published greeter endpoint."); LoggingInInterceptor in = new LoggingInInterceptor(); LoggingOutInterceptor out = new LoggingOutInterceptor(); bus.getInInterceptors().add(in); bus.getOutInterceptors().add(out); bus.getOutFaultInterceptors().add(out); }
protected void run() { System.setProperty("temp.location", tmpDir); SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr-wsdl11.xml"); BusFactory.setDefaultBus(bus); setBus(bus); LoggingInInterceptor in = new LoggingInInterceptor(); bus.getInInterceptors().add(in); bus.getInFaultInterceptors().add(in); LoggingOutInterceptor out = new LoggingOutInterceptor(); bus.getOutInterceptors().add(out); bus.getOutFaultInterceptors().add(out); GreeterImpl implementor = new GreeterImpl(); String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort"; ep = Endpoint.publish(address, implementor); LOG.info("Published greeter endpoint."); } public void tearDown() {
protected void run() { System.setProperty("temp.location", tmpDir); SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr0705.xml"); BusFactory.setDefaultBus(bus); setBus(bus); LoggingInInterceptor in = new LoggingInInterceptor(); bus.getInInterceptors().add(in); bus.getInFaultInterceptors().add(in); LoggingOutInterceptor out = new LoggingOutInterceptor(); bus.getOutInterceptors().add(out); bus.getOutFaultInterceptors().add(out); GreeterImpl implementor = new GreeterImpl(); String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort"; ep = Endpoint.publish(address, implementor); LOG.info("Published greeter endpoint."); } public void tearDown() {
protected void run() { SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/http-server.xml"); setBus(bus); GreeterImpl implementor = new GreeterImpl(); implementor.setThrowAlways(true); ep = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/GreeterPort", implementor); LOG.info("Published greeter endpoint."); LoggingInInterceptor in = new LoggingInInterceptor(); LoggingOutInterceptor out = new LoggingOutInterceptor(); bus.getInInterceptors().add(in); bus.getOutInterceptors().add(out); bus.getOutFaultInterceptors().add(out); }
protected void run() { SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus(); setBus(bus); BusFactory.setDefaultBus(bus); LoggingInInterceptor in = new LoggingInInterceptor(); LoggingOutInterceptor out = new LoggingOutInterceptor(); bus.getInInterceptors().add(in); bus.getOutInterceptors().add(out); bus.getOutFaultInterceptors().add(out); HttpGreeterImpl implementor = new HttpGreeterImpl(); implementor.setThrowAlways(true); String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort"; ep = Endpoint.publish(address, implementor); LOG.info("Published greeter endpoint."); } public void tearDown() {
@After public void tearDown() throws Exception { Interceptor<?>[] interceptors = {mapVerifier, headerVerifier }; removeInterceptors(staticBus.getInInterceptors(), interceptors); removeInterceptors(staticBus.getOutInterceptors(), interceptors); removeInterceptors(staticBus.getOutFaultInterceptors(), interceptors); removeInterceptors(staticBus.getInFaultInterceptors(), interceptors); if (greeter instanceof Closeable) { ((Closeable)greeter).close(); } greeter = null; mapVerifier = null; headerVerifier = null; verified = null; messageIDs.clear(); }
protected void addVerifiers() { MAPVerifier mapVerifier = new MAPVerifier(); mapVerifier.verificationCache = this; HeaderVerifier headerVerifier = new HeaderVerifier(); headerVerifier.verificationCache = this; Interceptor<?>[] interceptors = {mapVerifier, headerVerifier}; addInterceptors(getBus().getInInterceptors(), interceptors); addInterceptors(getBus().getInFaultInterceptors(), interceptors); addInterceptors(getBus().getOutInterceptors(), interceptors); addInterceptors(getBus().getOutFaultInterceptors(), interceptors); }
protected void initializeInterceptors(Exchange ex, PhaseInterceptorChain chain) { Endpoint e = ex.getEndpoint(); Client c = ex.get(Client.class); chain.add(getBus().getOutFaultInterceptors()); if (c != null) { chain.add(c.getOutFaultInterceptors()); } chain.add(e.getService().getOutFaultInterceptors()); chain.add(e.getOutFaultInterceptors()); chain.add(e.getBinding().getOutFaultInterceptors()); if (e.getService().getDataBinding() instanceof InterceptorProvider) { chain.add(((InterceptorProvider)e.getService().getDataBinding()).getOutFaultInterceptors()); } addToChain(chain, ex.getInMessage()); addToChain(chain, ex.getOutFaultMessage()); } private void addToChain(PhaseInterceptorChain chain, Message m) {
protected void initializeInterceptors(Exchange ex, PhaseInterceptorChain chain) { Endpoint e = ex.getEndpoint(); Client c = ex.get(Client.class); chain.add(getBus().getOutFaultInterceptors()); if (c != null) { chain.add(c.getOutFaultInterceptors()); } chain.add(e.getService().getOutFaultInterceptors()); chain.add(e.getOutFaultInterceptors()); chain.add(e.getBinding().getOutFaultInterceptors()); if (e.getService().getDataBinding() instanceof InterceptorProvider) { chain.add(((InterceptorProvider)e.getService().getDataBinding()).getOutFaultInterceptors()); } addToChain(chain, ex.getInMessage()); addToChain(chain, ex.getOutFaultMessage()); } private void addToChain(PhaseInterceptorChain chain, Message m) {
protected void initializeInterceptors(Exchange ex, PhaseInterceptorChain chain) { Endpoint e = ex.get(Endpoint.class); Client c = ex.get(Client.class); chain.add(getBus().getOutFaultInterceptors()); if (c != null) { chain.add(c.getOutFaultInterceptors()); } chain.add(e.getService().getOutFaultInterceptors()); chain.add(e.getOutFaultInterceptors()); chain.add(e.getBinding().getOutFaultInterceptors()); if (e.getService().getDataBinding() instanceof InterceptorProvider) { chain.add(((InterceptorProvider)e.getService().getDataBinding()).getOutFaultInterceptors()); } addToChain(chain, ex.getInMessage()); addToChain(chain, ex.getOutFaultMessage()); } private void addToChain(PhaseInterceptorChain chain, Message m) {