Java Code Examples for org.apache.cxf.jaxrs.JAXRSServerFactoryBean#setTransportId()

The following examples show how to use org.apache.cxf.jaxrs.JAXRSServerFactoryBean#setTransportId() . 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: JAXRSLocalTransportTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(BookStore.class, BookStoreSpring.class);
    sf.setResourceProvider(BookStore.class,
                           new SingletonResourceProvider(new BookStore(), true));
    sf.setResourceProvider(BookStoreSpring.class,
                           new SingletonResourceProvider(new BookStoreSpring(), true));
    sf.setProvider(new JacksonJsonProvider());
    List<Interceptor<? extends Message>> outInts = new ArrayList<>();
    outInts.add(new CustomOutInterceptor());
    sf.setOutInterceptors(outInts);

    List<Interceptor<? extends Message>> inInts = new ArrayList<>();
    inInts.add(new CustomInFaultyInterceptor());
    sf.setInInterceptors(inInts);

    sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    sf.setAddress("local://books");
    localServer = sf.create();
}
 
Example 2
Source File: AbstractSpringConfigurationFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected Server createJaxRsServer() {

        JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
        factory.setAddress(getAddress());
        factory.setTransportId(getTransportId());
        factory.setBus(getBus());

        setJaxrsResources(factory);

        factory.setInInterceptors(getInInterceptors());
        factory.setOutInterceptors(getOutInterceptors());
        factory.setOutFaultInterceptors(getOutFaultInterceptors());
        factory.setFeatures(getFeatures());
        if (!StringUtils.isEmpty(jaxrsExtensions)) {
            factory.setExtensionMappings(CastUtils.cast((Map<?, ?>)parseMapSequence(jaxrsExtensions)));
        }
        finalizeFactorySetup(factory);
        return factory.create();
    }
 
Example 3
Source File: RESTLoggingTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private Server createService(String serviceURI, Object serviceImpl, LoggingFeature loggingFeature) {
    JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
    factory.setAddress(serviceURI);
    factory.setFeatures(Collections.singletonList(loggingFeature));
    factory.setServiceBean(serviceImpl);
    factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    return factory.create();
}
 
Example 4
Source File: ClientResponseFilterTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    final JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(TestEndpoint.class);
    sf.setResourceProvider(TestEndpoint.class, new SingletonResourceProvider(new TestEndpoint(), false));
    sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    sf.setAddress(ADDRESS);
    server = sf.create();
}
 
Example 5
Source File: ClientCacheTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void bind() throws Exception {
    final JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(TheServer.class);
    sf.setResourceProvider(TheServer.class, new SingletonResourceProvider(new TheServer(), false));
    sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    sf.setAddress(ADDRESS);
    server = sf.create();
}