Search in sources :

Example 1 with ThrottlingFeature

use of org.apache.cxf.throttling.ThrottlingFeature in project cxf by apache.

the class BookServerThrottled method run.

protected void run() {
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(BookStore.class);
    List<Feature> features = new ArrayList<>();
    ThrottlingFeature tf = new ThrottlingFeature(new ThrottlingManagerImpl());
    features.add(tf);
    sf.setFeatures(features);
    sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStore(), true));
    sf.setAddress("http://localhost:" + PORT + "/");
    server = sf.create();
}
Also used : JAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean) ArrayList(java.util.ArrayList) ThrottlingFeature(org.apache.cxf.throttling.ThrottlingFeature) SingletonResourceProvider(org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider) Feature(org.apache.cxf.feature.Feature) ThrottlingFeature(org.apache.cxf.throttling.ThrottlingFeature)

Aggregations

ArrayList (java.util.ArrayList)1 Feature (org.apache.cxf.feature.Feature)1 JAXRSServerFactoryBean (org.apache.cxf.jaxrs.JAXRSServerFactoryBean)1 SingletonResourceProvider (org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)1 ThrottlingFeature (org.apache.cxf.throttling.ThrottlingFeature)1