|
Apache CXF API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cxf.interceptor.AbstractBasicInterceptorProvider org.apache.cxf.endpoint.AbstractEndpointFactory org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean org.apache.cxf.jaxrs.JAXRSServerFactoryBean
public class JAXRSServerFactoryBean
Bean to help easily create Server endpoints for JAX-RS. Example:
JAXRSServerFactoryBean sf = JAXRSServerFactoryBean(); sf.setResourceClasses(Book.class); sf.setBindingId(JAXRSBindingFactory.JAXRS_BINDING_ID); sf.setAddress("http://localhost:9080/"); Server myServer = sf.create();This will start a server for you and register it with the ServerManager. Note you should explicitly close the
Server
created
when finished with it:
myServer.close(); myServer.destroy(); // closes first if close() not previously called
Field Summary | |
---|---|
protected Map<Class<?>,ResourceProvider> |
resourceProviders
|
Fields inherited from class org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean |
---|
entityProviders, schemaLocations, serviceFactory |
Fields inherited from class org.apache.cxf.endpoint.AbstractEndpointFactory |
---|
address, bindingConfig, bindingFactory, bindingId, bus, conduitSelector, dataBinding, destinationFactory, endpointName, endpointReference, features, properties, publishedEndpointUrl, serviceName, transportId |
Constructor Summary | |
---|---|
JAXRSServerFactoryBean()
|
|
JAXRSServerFactoryBean(JAXRSServiceFactoryBean sf)
|
Method Summary | |
---|---|
protected void |
applyFeatures()
|
Server |
create()
Creates the JAX-RS Server instance |
protected Invoker |
createInvoker()
|
String |
getDocLocation()
Get the reference to the document (WADL, etc) describing the endpoint |
List<Class<?>> |
getResourceClasses()
|
Server |
getServer()
|
void |
init()
Creates the JAX-RS Server instance |
void |
setApplication(javax.ws.rs.core.Application app)
Saves the reference to the JAX-RS Application |
protected void |
setBeanInfo(ServerProviderFactory factory)
|
void |
setDocLocation(String docLocation)
Set the reference to the document (WADL, etc) describing the endpoint |
void |
setExtensionMappings(Map<Object,Object> extMaps)
Sets the extension mappings, example, 'xml' is the key and 'text/xml' is the value. |
void |
setInvoker(Invoker invoker)
Sets the custom Invoker which can be used to customize the way the default JAX-RS invoker calls on the service bean |
void |
setLanguageMappings(Map<Object,Object> lMaps)
Sets the language mappings, example, 'en' is the key and 'en-gb' is the value. |
void |
setResourceClasses(Class<?>... classes)
Sets one or more root resource classes |
void |
setResourceClasses(List<Class<?>> classes)
Sets one or more root resource classes |
void |
setResourceComparator(ResourceComparator rcomp)
Resource comparator which may be used to customize the way a root resource or resource method is selected |
void |
setResourceProvider(Class<?> c,
ResourceProvider rp)
Sets the provider managing the life-cycle of the given resource class |
void |
setResourceProvider(ResourceProvider rp)
Sets the provider managing the life-cycle of the resource class |
void |
setResourceProviders(List<ResourceProvider> rps)
Sets the list of providers managing the life-cycle of the resource classes |
void |
setServiceBean(Object bean)
Sets the single resource bean. |
void |
setServiceBeanObjects(Object... beans)
Sets the resource beans. |
void |
setServiceBeans(List<Object> beans)
Sets the resource beans. |
void |
setServiceClass(Class<?> clazz)
This method is used primarily by Spring handler processing the jaxrs:server/@serviceClass attribute. |
void |
setStart(boolean start)
Determines whether Services are automatically started during the create() call. |
void |
setStaticSubresourceResolution(boolean enableStatic)
By default the subresources are resolved dynamically, mainly due to the JAX-RS specification allowing Objects being returned from the subresource locators. |
protected ServerProviderFactory |
setupFactory(Endpoint ep)
|
Methods inherited from class org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean |
---|
checkResources, createBindingInfo, createEndpoint, createEndpointInfo, getBus, getProviders, getServiceFactory, setBus, setDataBindingProvider, setModelBeans, setModelBeans, setModelBeansWithServiceClass, setModelRef, setModelRefWithServiceClass, setProvider, setProviders, setSchemaLocation, setSchemaLocations, setServiceFactory, setServiceName, setupFactory |
Methods inherited from class org.apache.cxf.interceptor.AbstractBasicInterceptorProvider |
---|
getInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptors, setInFaultInterceptors, setInInterceptors, setOutFaultInterceptors, setOutInterceptors |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map<Class<?>,ResourceProvider> resourceProviders
Constructor Detail |
---|
public JAXRSServerFactoryBean()
public JAXRSServerFactoryBean(JAXRSServiceFactoryBean sf)
Method Detail |
---|
public void setApplication(javax.ws.rs.core.Application app)
Application
app
- public void setResourceComparator(ResourceComparator rcomp)
rcomp
- comparatorpublic void setStaticSubresourceResolution(boolean enableStatic)
enableStatic
- enabling the static resolution if set to truepublic void init()
public Server create()
public Server getServer()
protected ServerProviderFactory setupFactory(Endpoint ep)
protected void setBeanInfo(ServerProviderFactory factory)
protected void applyFeatures()
protected Invoker createInvoker()
public void setLanguageMappings(Map<Object,Object> lMaps)
lMaps
- the language mappingspublic void setExtensionMappings(Map<Object,Object> extMaps)
lMaps
- the extension mappingspublic List<Class<?>> getResourceClasses()
public void setServiceClass(Class<?> clazz)
clazz
- the service/resource classpublic void setResourceClasses(List<Class<?>> classes)
classes
- the list of resource classespublic void setResourceClasses(Class<?>... classes)
classes
- the array of resource classespublic void setServiceBeanObjects(Object... beans)
beans
- the array of resource instancespublic void setServiceBean(Object bean)
bean
- resource instancepublic void setServiceBeans(List<Object> beans)
beans
- the list of resource instancespublic void setResourceProvider(Class<?> c, ResourceProvider rp)
Example: setResourceProvider(BookStoreInterface.class, new SingletonResourceProvider(new BookStore()));
c
- resource classrp
- resource providerpublic void setResourceProvider(ResourceProvider rp)
Example: setResourceProvider(new SingletonResourceProvider(new BookStore()));
rp
- resource providerpublic void setResourceProviders(List<ResourceProvider> rps)
rps
- resource providerspublic void setInvoker(Invoker invoker)
invoker
- public void setStart(boolean start)
start
- Whether (true) or not (false) to start the Server during Server creation.public void setDocLocation(String docLocation)
documentLocation
- document locationpublic String getDocLocation()
|
Apache CXF API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |