Package org.apache.cxf.frontend
Class ServerFactoryBean
java.lang.Object
org.apache.cxf.interceptor.AbstractBasicInterceptorProvider
org.apache.cxf.endpoint.AbstractEndpointFactory
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory
org.apache.cxf.frontend.ServerFactoryBean
- All Implemented Interfaces:
org.apache.cxf.interceptor.InterceptorProvider
- Direct Known Subclasses:
ServerFactoryBeanDefinitionParser.SpringServerFactoryBean
This class helps take a
Service and
expose as a server side endpoint.
If there is no Service, it can create one for you using a
ReflectionServiceFactoryBean.
For most scenarios you'll want to just have the ServerFactoryBean handle everything for you. In such a case, usage might look like this:
ServerFactoryBean sf = new ServerFactoryBean();
sf.setServiceClass(MyService.class);
sf.setAddress("http://localhost:8080/MyService");
sf.create();
You can also get more advanced and customize the service factory used:
ReflectionServiceFactory serviceFactory = new ReflectionServiceFactory();
serviceFactory.setServiceClass(MyService.class);
..
\/\/ Customize service factory here...
serviceFactory.setWrapped(false);
...
ServerFactoryBean sf = new ServerFactoryBean();
sf.setServiceFactory(serviceFactory);
sf.setAddress("http://localhost:8080/MyService");
sf.create();
-
Field Summary
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
ConstructorsConstructorDescriptionServerFactoryBean(org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean sbean) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyFeatures(org.apache.cxf.endpoint.Server server) org.apache.cxf.endpoint.Servercreate()protected org.apache.cxf.service.invoker.Invokerprotected Stringorg.apache.cxf.service.invoker.Invokerorg.apache.cxf.endpoint.ServerFor subclasses that hold onto the created Server, this will return the singleton server.Class<?>protected org.apache.cxf.wsdl11.WSDLEndpointFactoryprotected voidbooleanisStart()Whether or not the Server should be started upon creation.voidsetInvoker(org.apache.cxf.service.invoker.Invoker invoker) voidsetSchemaLocations(List<String> schemaLocations) voidsetServiceBean(Object serviceBean) Sets the bean implementing the service.voidsetStart(boolean start) Specifies if the Server should be started upon creation.voidsetWsdlLocation(String location) Specifies the location of the WSDL defining the service interface used by the factory to create services.Methods inherited from class org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory
createBindingInfo, createEndpoint, createEndpointInfo, createSoapBindingConfig, getServiceClass, getServiceFactory, getWsdlURL, setServiceClass, setServiceFactory, setWsdlURLMethods inherited from class org.apache.cxf.endpoint.AbstractEndpointFactory
addToBeans, checkPrivateEndpoint, getAddress, getBindingConfig, getBindingFactory, getBindingId, getBus, getBus, getConduitSelector, getDataBinding, getDestinationFactory, getEndpointName, getFeatures, getProperties, getProperties, getPublishedEndpointUrl, getServiceName, getTransportId, initializeAnnotationInterceptors, initializeAnnotationInterceptors, initializeAnnotationInterceptors, setAddress, setBindingConfig, setBindingFactory, setBindingId, setBus, setConduitSelector, setDataBinding, setDestinationFactory, setEndpointName, setEndpointReference, setFeatures, setProperties, setPublishedEndpointUrl, setServiceName, setTransportIdMethods inherited from class org.apache.cxf.interceptor.AbstractBasicInterceptorProvider
getInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptors, setInFaultInterceptors, setInInterceptors, setOutFaultInterceptors, setOutInterceptors
-
Constructor Details
-
ServerFactoryBean
public ServerFactoryBean() -
ServerFactoryBean
public ServerFactoryBean(org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean sbean)
-
-
Method Details
-
getBeanName
-
detectTransportIdFromAddress
- Specified by:
detectTransportIdFromAddressin classAbstractWSDLBasedEndpointFactory
-
getWSDLEndpointFactory
protected org.apache.cxf.wsdl11.WSDLEndpointFactory getWSDLEndpointFactory()- Specified by:
getWSDLEndpointFactoryin classAbstractWSDLBasedEndpointFactory
-
getServer
public org.apache.cxf.endpoint.Server getServer()For subclasses that hold onto the created Server, this will return the singleton server. Default returns null as the default factories do not hold onto the server and will create a new one for each call to create();- Returns:
-
create
public org.apache.cxf.endpoint.Server create() -
initializeServiceFactory
protected void initializeServiceFactory()- Overrides:
initializeServiceFactoryin classAbstractWSDLBasedEndpointFactory
-
applyFeatures
protected void applyFeatures(org.apache.cxf.endpoint.Server server) -
createInvoker
protected org.apache.cxf.service.invoker.Invoker createInvoker() -
isStart
public boolean isStart()Whether or not the Server should be started upon creation.- Returns:
falseif the server should not be started upon creation
-
setStart
public void setStart(boolean start) Specifies if the Server should be started upon creation. The default is for Servers to be started upon creation. Passingfalsetells the factory that the Server will be started manually using the start method.- Parameters:
start-falsespecifies that the Server will not be started upon creation
-
getServiceBean
-
getServiceBeanClass
-
setServiceBean
Sets the bean implementing the service. If this is set aBeanInvokeris created for the provided bean.- Parameters:
serviceBean- an instantiated implementation object
-
getSchemaLocations
-
setSchemaLocations
-
getInvoker
public org.apache.cxf.service.invoker.Invoker getInvoker() -
setInvoker
public void setInvoker(org.apache.cxf.service.invoker.Invoker invoker) -
setWsdlLocation
Specifies the location of the WSDL defining the service interface used by the factory to create services. Typically, the WSDL location is specified as a URL.- Parameters:
location- the URL of the WSDL defining the service interface
-
getWsdlLocation
-