Java Code Examples for org.apache.cxf.Bus.setProperty()

The following are Jave code examples for showing how to use setProperty() of the org.apache.cxf.Bus class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: jbossws-cxf   File: AsyncClientTestCase.java   View Source Code Vote up 6 votes
@Test
@RunAsClient
public void testAysncClientWithPolicy () throws Exception 
{
   Bus bus = BusFactory.newInstance().createBus();
   AsyncEnabledInfoInterceptor asyncInfo = new AsyncEnabledInfoInterceptor();
   try
   {
      bus.setProperty("use.async.http.conduit", "ASYNC_ONLY");
      bus.getOutInterceptors().add(asyncInfo);
      BusFactory.setThreadDefaultBus(bus);
      Endpoint proxy = initPort();
      assertEquals("Echo:1000", proxy.echo(1000));
      assertFalse("Async client is expected disabled", asyncInfo.isAsyncEnabled());
      assertEquals("Echo:1000", proxy.echoAsync(1000).get());
      assertTrue("Async client is expected enabled", asyncInfo.isAsyncEnabled());
   }
   finally
   {
      bus.shutdown(true);
   }
}
 
Example 2
Project: Equella   File: CXFHandler.java   View Source Code Vote up 5 votes
@Override
protected void loadBus(ServletConfig sc)
{
	Thread currentThread = Thread.currentThread();
	ClassLoader oldLoader = currentThread.getContextClassLoader();
	try
	{
		currentThread.setContextClassLoader(getClass().getClassLoader());
		Bus bus = new ExtensionManagerBus();
		setBus(bus);
		List<Extension> exts = interceptorTracker.getExtensions();
		List<Interceptor<? extends Message>> inInterceptors = bus.getInInterceptors();
		for( Extension extension : exts )
		{
			Collection<Parameter> inParams = extension.getParameters("inBean");
			for( Parameter inParam : inParams )
			{
				inInterceptors.add(interceptorTracker.getBeanByParameter(extension, inParam));
			}
			Collection<Parameter> outParams = extension.getParameters("outBean");
			for( Parameter outParam : outParams )
			{
				bus.getOutInterceptors().add(interceptorTracker.getBeanByParameter(extension, outParam));
			}
		}
		inInterceptors.add(new WebServiceContextIntercept());
		bus.setProperty("org.apache.cxf.logging.FaultListener", new SoapFaultListener());
	}
	finally
	{
		currentThread.setContextClassLoader(oldLoader);
	}
}
 
Example 3
Project: base   File: ServerBusListener.java   View Source Code Vote up 5 votes
public void busRegistered( Bus bus )
{
    LOG.info( "Adding LoggingFeature interceptor on bus: " + bus.getId() );

    //********Set BUS Message Size to 500 KB ************************
    bus.setProperty( "bus.io.CachedOutputStream.Threshold", "500000" );
    System.setProperty( "org.apache.cxf.io.CachedOutputStream.Threshold", "500000" );
    LOG.info( "Setting CXF CachedOutputStream.Threshold size to: 500Kb " );
    //***************************************************************
    bus.setProperty( AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE );
    //***************************************************************

    // initialise the feature on the bus, which will add the interceptors

    //***** RECEIVE    **********************************
    bus.getInInterceptors().add( new AccessControlInterceptor( identityManager ) );

    //***** PRE_STREAM **********************************
    bus.getOutInterceptors().add( new ClientOutInterceptor( securityManager, peerManager ) );

    //***** POST_LOGICAL **********************************
    bus.getOutInterceptors().add( new ClientHeaderInterceptor( peerManager ) );

    //***** RECEIVE    **********************************
    bus.getInInterceptors().add( new ServerInInterceptor( securityManager, peerManager ) );

    //***** PRE_STREAM **********************************
    bus.getOutInterceptors().add( new ServerOutInterceptor( securityManager, peerManager ) );

    //***** RECEIVE    **********************************
    bus.getInInterceptors().add( new ClientInInterceptor( securityManager, peerManager ) );


    LOG.info( "Successfully added LoggingFeature interceptor on bus: " + bus.getId() );
}