Search in sources :

Example 46 with SingletonResourceProvider

use of org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider in project tika by apache.

the class TikaMimeTypesTest method setUpResources.

@Override
protected void setUpResources(JAXRSServerFactoryBean sf) {
    sf.setResourceClasses(TikaMimeTypes.class);
    sf.setResourceProvider(TikaMimeTypes.class, new SingletonResourceProvider(new TikaMimeTypes()));
}
Also used : TikaMimeTypes(org.apache.tika.server.resource.TikaMimeTypes) SingletonResourceProvider(org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)

Example 47 with SingletonResourceProvider

use of org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider in project tika by apache.

the class TikaResourceTest method setUpResources.

@Override
protected void setUpResources(JAXRSServerFactoryBean sf) {
    sf.setResourceClasses(TikaResource.class);
    sf.setResourceProvider(TikaResource.class, new SingletonResourceProvider(new TikaResource()));
}
Also used : TikaResource(org.apache.tika.server.resource.TikaResource) SingletonResourceProvider(org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)

Example 48 with SingletonResourceProvider

use of org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider in project tika by apache.

the class TikaVersionTest method setUpResources.

@Override
protected void setUpResources(JAXRSServerFactoryBean sf) {
    sf.setResourceClasses(TikaVersion.class);
    sf.setResourceProvider(TikaVersion.class, new SingletonResourceProvider(new TikaVersion()));
}
Also used : TikaVersion(org.apache.tika.server.resource.TikaVersion) SingletonResourceProvider(org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)

Example 49 with SingletonResourceProvider

use of org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider in project tika by apache.

the class StackTraceTest method setUpResources.

@Override
protected void setUpResources(JAXRSServerFactoryBean sf) {
    List<ResourceProvider> rCoreProviders = new ArrayList<ResourceProvider>();
    rCoreProviders.add(new SingletonResourceProvider(new MetadataResource()));
    rCoreProviders.add(new SingletonResourceProvider(new RecursiveMetadataResource()));
    rCoreProviders.add(new SingletonResourceProvider(new DetectorResource()));
    rCoreProviders.add(new SingletonResourceProvider(new TikaResource()));
    rCoreProviders.add(new SingletonResourceProvider(new UnpackerResource()));
    sf.setResourceProviders(rCoreProviders);
}
Also used : RecursiveMetadataResource(org.apache.tika.server.resource.RecursiveMetadataResource) MetadataResource(org.apache.tika.server.resource.MetadataResource) SingletonResourceProvider(org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider) ResourceProvider(org.apache.cxf.jaxrs.lifecycle.ResourceProvider) TikaResource(org.apache.tika.server.resource.TikaResource) ArrayList(java.util.ArrayList) DetectorResource(org.apache.tika.server.resource.DetectorResource) RecursiveMetadataResource(org.apache.tika.server.resource.RecursiveMetadataResource) UnpackerResource(org.apache.tika.server.resource.UnpackerResource) SingletonResourceProvider(org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)

Example 50 with SingletonResourceProvider

use of org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider in project cxf by apache.

the class MultipartServer method run.

protected void run() {
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(MultipartStore.class);
    Map<String, Object> props = new HashMap<>();
    props.put(AttachmentDeserializer.ATTACHMENT_MAX_SIZE, String.valueOf(1024 * 10));
    props.put(AttachmentDeserializer.ATTACHMENT_MEMORY_THRESHOLD, String.valueOf(1024 * 5));
    props.put(AttachmentDeserializer.ATTACHMENT_MAX_HEADER_SIZE, String.valueOf(400));
    sf.setProperties(props);
    // default lifecycle is per-request, change it to singleton
    sf.setResourceProvider(MultipartStore.class, new SingletonResourceProvider(new MultipartStore()));
    sf.setAddress("http://localhost:" + PORT + "/");
    server = sf.create();
}
Also used : HashMap(java.util.HashMap) JAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean) SingletonResourceProvider(org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)

Aggregations

SingletonResourceProvider (org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)84 JAXRSServerFactoryBean (org.apache.cxf.jaxrs.JAXRSServerFactoryBean)63 Bus (org.apache.cxf.Bus)17 JacksonJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider)15 ArrayList (java.util.ArrayList)14 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)14 ResourceProvider (org.apache.cxf.jaxrs.lifecycle.ResourceProvider)9 HashMap (java.util.HashMap)7 Before (org.junit.Before)7 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)5 ClassResourceInfo (org.apache.cxf.jaxrs.model.ClassResourceInfo)5 Map (java.util.Map)4 ReactiveIOCustomizer (org.apache.cxf.jaxrs.rx3.server.ReactiveIOCustomizer)4 DetectorResource (org.apache.tika.server.resource.DetectorResource)4 MetadataResource (org.apache.tika.server.resource.MetadataResource)4 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 HttpServletResponse (javax.servlet.http.HttpServletResponse)3 Feature (org.apache.cxf.feature.Feature)3 ReactiveIOCustomizer (org.apache.cxf.jaxrs.rx2.server.ReactiveIOCustomizer)3 Message (org.apache.cxf.message.Message)3