Apache CXF API

org.apache.cxf.frontend
Class ServerFactoryBean

java.lang.Object
  extended by org.apache.cxf.interceptor.AbstractBasicInterceptorProvider
      extended by org.apache.cxf.endpoint.AbstractEndpointFactory
          extended by org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory
              extended by org.apache.cxf.frontend.ServerFactoryBean
All Implemented Interfaces:
InterceptorProvider
Direct Known Subclasses:
JaxWsServerFactoryBean, ServerFactoryBeanDefinitionParser.SpringServerFactoryBean

public class ServerFactoryBean
extends AbstractWSDLBasedEndpointFactory

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
ServerFactoryBean()
           
ServerFactoryBean(ReflectionServiceFactoryBean sbean)
           
 
Method Summary
protected  void applyFeatures()
           
 Server create()
           
protected  Invoker createInvoker()
           
 void destroy()
           
protected  String detectTransportIdFromAddress(String ad)
           
 String getBeanName()
           
 Invoker getInvoker()
           
 List<String> getSchemaLocations()
           
 Server getServer()
           
 Object getServiceBean()
           
 Class<?> getServiceBeanClass()
           
protected  WSDLEndpointFactory getWSDLEndpointFactory()
           
 String getWsdlLocation()
           
 void init()
           
protected  void initializeServiceFactory()
           
 boolean isStart()
          Whether or not the Server should be started upon creation.
 void setInvoker(Invoker invoker)
           
 void setSchemaLocations(List<String> schemaLocations)
           
 void setServer(Server server)
           
 void setServiceBean(Object serviceBean)
          Sets the bean implementing the service.
 void setStart(boolean start)
          Specifies if the Server should be started upon creation.
 void setWsdlLocation(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, setWsdlURL
 
Methods inherited from class org.apache.cxf.endpoint.AbstractEndpointFactory
checkPrivateEndpoint, getAddress, getBindingConfig, getBindingFactory, getBindingId, 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, setTransportId
 
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
 

Constructor Detail

ServerFactoryBean

public ServerFactoryBean()

ServerFactoryBean

public ServerFactoryBean(ReflectionServiceFactoryBean sbean)
Method Detail

getBeanName

public String getBeanName()

detectTransportIdFromAddress

protected String detectTransportIdFromAddress(String ad)
Specified by:
detectTransportIdFromAddress in class AbstractWSDLBasedEndpointFactory

getWSDLEndpointFactory

protected WSDLEndpointFactory getWSDLEndpointFactory()
Specified by:
getWSDLEndpointFactory in class AbstractWSDLBasedEndpointFactory

create

public Server create()

init

public void init()

destroy

public void destroy()

initializeServiceFactory

protected void initializeServiceFactory()
Overrides:
initializeServiceFactory in class AbstractWSDLBasedEndpointFactory

applyFeatures

protected void applyFeatures()

createInvoker

protected Invoker createInvoker()

getServer

public Server getServer()

setServer

public void setServer(Server server)

isStart

public boolean isStart()
Whether or not the Server should be started upon creation.

Returns:
false if 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. Passing false tells the factory that the Server will be started manually using the start method.

Parameters:
start - false specifies that the Server will not be started upon creation

getServiceBean

public Object getServiceBean()

getServiceBeanClass

public Class<?> getServiceBeanClass()

setServiceBean

public void setServiceBean(Object serviceBean)
Sets the bean implementing the service. If this is set a BeanInvoker is created for the provided bean.

Parameters:
serviceBean - an instantiated implementation object

getSchemaLocations

public List<String> getSchemaLocations()

setSchemaLocations

public void setSchemaLocations(List<String> schemaLocations)

getInvoker

public Invoker getInvoker()

setInvoker

public void setInvoker(Invoker invoker)

setWsdlLocation

public void setWsdlLocation(String location)
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:
locaiton - the URL of the WSDL defining the service interface

getWsdlLocation

public String getWsdlLocation()

Apache CXF API

Apache CXF