Java源码示例:com.sun.xml.internal.ws.binding.BindingImpl
示例1
public <T> Dispatch<T> createDispatch(QName portName, WSEndpointReference wsepr, Class<T> aClass, Service.Mode mode, WebServiceFeatureList features) {
PortInfo port = safeGetPort(portName);
ComponentFeature cf = features.get(ComponentFeature.class);
if (cf != null && !Target.STUB.equals(cf.getTarget())) {
throw new IllegalArgumentException();
}
ComponentsFeature csf = features.get(ComponentsFeature.class);
if (csf != null) {
for (ComponentFeature cfi : csf.getComponentFeatures()) {
if (!Target.STUB.equals(cfi.getTarget()))
throw new IllegalArgumentException();
}
}
features.addAll(this.features);
BindingImpl binding = port.createBinding(features, null, null);
binding.setMode(mode);
Dispatch<T> dispatch = Stubs.createDispatch(port, this, binding, aClass, mode, wsepr);
serviceInterceptor.postCreateDispatch((WSBindingProvider) dispatch);
return dispatch;
}
示例2
protected Dispatch<Object> createDispatch(QName portName, WSEndpointReference wsepr, JAXBContext jaxbContext, Service.Mode mode, WebServiceFeatureList features) {
PortInfo port = safeGetPort(portName);
ComponentFeature cf = features.get(ComponentFeature.class);
if (cf != null && !Target.STUB.equals(cf.getTarget())) {
throw new IllegalArgumentException();
}
ComponentsFeature csf = features.get(ComponentsFeature.class);
if (csf != null) {
for (ComponentFeature cfi : csf.getComponentFeatures()) {
if (!Target.STUB.equals(cfi.getTarget()))
throw new IllegalArgumentException();
}
}
features.addAll(this.features);
BindingImpl binding = port.createBinding(features, null, null);
binding.setMode(mode);
Dispatch<Object> dispatch = Stubs.createJAXBDispatch(
port, binding, jaxbContext, mode,wsepr);
serviceInterceptor.postCreateDispatch((WSBindingProvider)dispatch);
return dispatch;
}
示例3
void setUpProcessor() {
if (handlers == null) {
// Take a snapshot, User may change chain after invocation, Same chain
// should be used for the entire MEP
handlers = new ArrayList<Handler>();
WSBinding binding = getBinding();
List<LogicalHandler> logicalSnapShot= ((BindingImpl) binding).getHandlerConfig().getLogicalHandlers();
if (!logicalSnapShot.isEmpty()) {
handlers.addAll(logicalSnapShot);
if (binding.getSOAPVersion() == null) {
processor = new XMLHandlerProcessor(this, binding,
handlers);
} else {
processor = new SOAPHandlerProcessor(true, this, binding,
handlers);
}
}
}
}
示例4
protected Dispatch<Object> createDispatch(QName portName, WSEndpointReference wsepr, JAXBContext jaxbContext, Service.Mode mode, WebServiceFeatureList features) {
PortInfo port = safeGetPort(portName);
ComponentFeature cf = features.get(ComponentFeature.class);
if (cf != null && !Target.STUB.equals(cf.getTarget())) {
throw new IllegalArgumentException();
}
ComponentsFeature csf = features.get(ComponentsFeature.class);
if (csf != null) {
for (ComponentFeature cfi : csf.getComponentFeatures()) {
if (!Target.STUB.equals(cfi.getTarget()))
throw new IllegalArgumentException();
}
}
features.addAll(this.features);
BindingImpl binding = port.createBinding(features, null, null);
binding.setMode(mode);
Dispatch<Object> dispatch = Stubs.createJAXBDispatch(
port, binding, jaxbContext, mode,wsepr);
serviceInterceptor.postCreateDispatch((WSBindingProvider)dispatch);
return dispatch;
}
示例5
private <T> T createEndpointIFBaseProxy(@Nullable WSEndpointReference epr, QName portName, Class<T> portInterface,
WebServiceFeatureList webServiceFeatures, SEIPortInfo eif) {
//fail if service doesnt have WSDL
if (wsdlService == null) {
throw new WebServiceException(ClientMessages.INVALID_SERVICE_NO_WSDL(serviceName));
}
if (wsdlService.get(portName)==null) {
throw new WebServiceException(
ClientMessages.INVALID_PORT_NAME(portName,buildWsdlPortNames()));
}
BindingImpl binding = eif.createBinding(webServiceFeatures, portInterface);
InvocationHandler pis = getStubHandler(binding, eif, epr);
T proxy = createProxy(portInterface, pis);
if (serviceInterceptor != null) {
serviceInterceptor.postCreateProxy((WSBindingProvider)proxy, portInterface);
}
return proxy;
}
示例6
/**
* Creates a new pipeline for the given port name.
*/
private Tube createPipeline(WSPortInfo portInfo, WSBinding binding) {
//Check all required WSDL extensions are understood
checkAllWSDLExtensionsUnderstood(portInfo, binding);
SEIModel seiModel = null;
Class sei = null;
if (portInfo instanceof SEIPortInfo) {
SEIPortInfo sp = (SEIPortInfo) portInfo;
seiModel = sp.model;
sei = sp.sei;
}
BindingID bindingId = portInfo.getBindingId();
TubelineAssembler assembler = TubelineAssemblerFactory.create(
Thread.currentThread().getContextClassLoader(), bindingId, owner.getContainer());
if (assembler == null) {
throw new WebServiceException("Unable to process bindingID=" + bindingId); // TODO: i18n
}
return assembler.createClient(
new ClientTubeAssemblerContext(
portInfo.getEndpointAddress(),
portInfo.getPort(),
this, binding, owner.getContainer(), ((BindingImpl) binding).createCodec(), seiModel, sei));
}
示例7
private <T> T createEndpointIFBaseProxy(@Nullable WSEndpointReference epr, QName portName, Class<T> portInterface,
WebServiceFeatureList webServiceFeatures, SEIPortInfo eif) {
//fail if service doesnt have WSDL
if (wsdlService == null) {
throw new WebServiceException(ClientMessages.INVALID_SERVICE_NO_WSDL(serviceName));
}
if (wsdlService.get(portName)==null) {
throw new WebServiceException(
ClientMessages.INVALID_PORT_NAME(portName,buildWsdlPortNames()));
}
BindingImpl binding = eif.createBinding(webServiceFeatures, portInterface);
InvocationHandler pis = getStubHandler(binding, eif, epr);
T proxy = createProxy(portInterface, pis);
if (serviceInterceptor != null) {
serviceInterceptor.postCreateProxy((WSBindingProvider)proxy, portInterface);
}
return proxy;
}
示例8
@Deprecated
public SEIStub(WSServiceDelegate owner, BindingImpl binding, SOAPSEIModel seiModel, Tube master, WSEndpointReference epr) {
super(owner, master, binding, seiModel.getPort(), seiModel.getPort().getAddress(), epr);
this.seiModel = seiModel;
this.soapVersion = binding.getSOAPVersion();
databinding = seiModel.getDatabinding();
initMethodHandlers();
}
示例9
@Deprecated
public static Dispatch<Source> createSourceDispatch(QName port, Mode mode, WSServiceDelegate owner, Tube pipe, BindingImpl binding, WSEndpointReference epr) {
if(isXMLHttp(binding))
return new RESTSourceDispatch(port,mode,owner,pipe,binding,epr);
else
return new SOAPSourceDispatch(port,mode,owner,pipe,binding,epr);
}
示例10
public SEIStub(WSPortInfo portInfo, BindingImpl binding, SOAPSEIModel seiModel, WSEndpointReference epr) {
super(portInfo, binding, seiModel.getPort().getAddress(),epr);
this.seiModel = seiModel;
this.soapVersion = binding.getSOAPVersion();
databinding = seiModel.getDatabinding();
initMethodHandlers();
}
示例11
private void setUpProcessorInternal() {
HandlerConfiguration hc = ((BindingImpl) binding).getHandlerConfig();
if (hc != this.hc)
resetProcessor();
this.hc = hc;
setUpProcessor();
}
示例12
public SEIStub(WSPortInfo portInfo, BindingImpl binding, SOAPSEIModel seiModel, WSEndpointReference epr) {
super(portInfo, binding, seiModel.getPort().getAddress(),epr);
this.seiModel = seiModel;
this.soapVersion = binding.getSOAPVersion();
databinding = seiModel.getDatabinding();
initMethodHandlers();
}
示例13
/**
* This constructor should be used only by JAX-WS Runtime and is not meant for external consumption.
* @deprecated
* Use {@link #ClientTubeAssemblerContext(EndpointAddress, WSDLPort, WSService, WSBindingProvider, WSBinding, Container, Codec, SEIModel, Class)}
*/
public ClientTubeAssemblerContext(@NotNull EndpointAddress address, @Nullable WSDLPort wsdlModel,
@NotNull WSService rootOwner, @NotNull WSBinding binding,
@NotNull Container container) {
// WSBinding is actually BindingImpl
this(address, wsdlModel, rootOwner, binding, container, ((BindingImpl)binding).createCodec() );
}
示例14
void setUpProcessor() {
if (handlers == null) {
// Take a snapshot, User may change chain after invocation, Same chain
// should be used for the entire MEP
handlers = new ArrayList<Handler>();
HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
List<MessageHandler> msgHandlersSnapShot= handlerConfig.getMessageHandlers();
if (!msgHandlersSnapShot.isEmpty()) {
handlers.addAll(msgHandlersSnapShot);
roles = new HashSet<String>();
roles.addAll(handlerConfig.getRoles());
processor = new SOAPHandlerProcessor(true, this, getBinding(), handlers);
}
}
}
示例15
private void setUpHandlersOnce() {
handlers = new ArrayList<Handler>();
HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
if (!soapSnapShot.isEmpty()) {
handlers.addAll(soapSnapShot);
roles = new HashSet<String>();
roles.addAll(handlerConfig.getRoles());
}
}
示例16
protected WSEndpointImpl(@NotNull QName serviceName, @NotNull QName portName, WSBinding binding, Container container,
SEIModel seiModel, WSDLPort port,
Tube masterTubeline) {
this.serviceName = serviceName;
this.portName = portName;
this.binding = binding;
this.soapVersion = binding.getSOAPVersion();
this.container = container;
this.endpointPolicy = null;
this.port = port;
this.seiModel = seiModel;
this.serviceDef = null;
this.implementationClass = null;
this.masterTubeline = masterTubeline;
this.masterCodec = ((BindingImpl) this.binding).createCodec();
LazyMOMProvider.INSTANCE.registerEndpoint(this);
initManagedObjectManager();
this.operationDispatcher = (port == null) ? null : new OperationDispatcher(port, binding, seiModel);
this.context = new ServerPipeAssemblerContext(
seiModel, port, this, null /* not known */, false);
tubePool = new TubePool(masterTubeline);
engine = new Engine(toString(), container);
wsdlProperties = (port == null) ? new WSDLDirectProperties(serviceName, portName, seiModel) : new WSDLPortProperties(port, seiModel);
}
示例17
public BindingImpl createBinding(WebServiceFeatureList webServiceFeatures, Class<?> portInterface,
BindingImpl existingBinding) {
if (existingBinding != null) {
webServiceFeatures.addAll(existingBinding.getFeatures());
}
Iterable<WebServiceFeature> configFeatures;
//TODO incase of Dispatch, provide a way to User for complete control of the message processing by giving
// ability to turn off the WSDL/Policy based features and its associated tubes.
//Even in case of Dispatch, merge all features configured via WSDL/Policy or deployment configuration
if (portModel != null) {
// could have merged features from this.policyMap, but some features are set in WSDLModel which are not there in PolicyMap
// for ex: <wsaw:UsingAddressing> wsdl extn., and since the policyMap features are merged into WSDLModel anyway during postFinished(),
// So, using here WsdlModel for merging is right.
// merge features from WSDL
configFeatures = portModel.getFeatures();
} else {
configFeatures = PolicyUtil.getPortScopedFeatures(policyMap, owner.getServiceName(),portName);
}
webServiceFeatures.mergeFeatures(configFeatures, false);
// merge features from interceptor
webServiceFeatures.mergeFeatures(owner.serviceInterceptor.preCreateBinding(this, portInterface, webServiceFeatures), false);
BindingImpl bindingImpl = BindingImpl.create(bindingId, webServiceFeatures.toArray());
owner.getHandlerConfigurator().configureHandlers(this,bindingImpl);
return bindingImpl;
}
示例18
/**
* This constructor should be used only by JAX-WS Runtime and is not meant for external consumption.
* @deprecated
* Use {@link #ClientTubeAssemblerContext(EndpointAddress, WSDLPort, WSService, WSBindingProvider, WSBinding, Container, Codec, SEIModel, Class)}
*/
public ClientTubeAssemblerContext(@NotNull EndpointAddress address, @Nullable WSDLPort wsdlModel,
@NotNull WSService rootOwner, @NotNull WSBinding binding,
@NotNull Container container) {
// WSBinding is actually BindingImpl
this(address, wsdlModel, rootOwner, binding, container, ((BindingImpl)binding).createCodec() );
}
示例19
void setUpProcessor() {
if (handlers == null) {
// Take a snapshot, User may change chain after invocation, Same chain
// should be used for the entire MEP
handlers = new ArrayList<Handler>();
HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
List<MessageHandler> msgHandlersSnapShot= handlerConfig.getMessageHandlers();
if (!msgHandlersSnapShot.isEmpty()) {
handlers.addAll(msgHandlersSnapShot);
roles = new HashSet<String>();
roles.addAll(handlerConfig.getRoles());
processor = new SOAPHandlerProcessor(true, this, getBinding(), handlers);
}
}
}
示例20
void setUpProcessor() {
if (handlers == null) {
// Take a snapshot, User may change chain after invocation, Same chain
// should be used for the entire MEP
handlers = new ArrayList<Handler>();
HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
List<MessageHandler> msgHandlersSnapShot= handlerConfig.getMessageHandlers();
if (!msgHandlersSnapShot.isEmpty()) {
handlers.addAll(msgHandlersSnapShot);
roles = new HashSet<String>();
roles.addAll(handlerConfig.getRoles());
processor = new SOAPHandlerProcessor(true, this, getBinding(), handlers);
}
}
}
示例21
@Deprecated
public static Dispatch<Source> createSourceDispatch(QName port, Mode mode, WSServiceDelegate owner, Tube pipe, BindingImpl binding, WSEndpointReference epr) {
if(isXMLHttp(binding))
return new RESTSourceDispatch(port,mode,owner,pipe,binding,epr);
else
return new SOAPSourceDispatch(port,mode,owner,pipe,binding,epr);
}
示例22
private void setUpHandlersOnce() {
handlers = new ArrayList<Handler>();
List<LogicalHandler> logicalSnapShot= ((BindingImpl) getBinding()).getHandlerConfig().getLogicalHandlers();
if (!logicalSnapShot.isEmpty()) {
handlers.addAll(logicalSnapShot);
}
}
示例23
public SEIStub(WSPortInfo portInfo, BindingImpl binding, SOAPSEIModel seiModel, WSEndpointReference epr) {
super(portInfo, binding, seiModel.getPort().getAddress(),epr);
this.seiModel = seiModel;
this.soapVersion = binding.getSOAPVersion();
databinding = seiModel.getDatabinding();
initMethodHandlers();
}
示例24
public static Dispatch<Source> createSourceDispatch(WSPortInfo portInfo, Mode mode, BindingImpl binding, WSEndpointReference epr) {
if (isXMLHttp(binding))
return new RESTSourceDispatch(portInfo, mode, binding, epr);
else
return new SOAPSourceDispatch(portInfo, mode, binding, epr);
}
示例25
Codec getCodec() {
if (codec == null) {
codec = ((BindingImpl) seiModel.getWSBinding()).createCodec();
}
return codec;
}
示例26
@Deprecated
public SOAPSourceDispatch(QName port, Mode mode, WSServiceDelegate owner, Tube pipe, BindingImpl binding, WSEndpointReference epr) {
super(port, mode, owner, pipe, binding, epr);
assert !isXMLHttp(binding);
}
示例27
@Deprecated
public JAXBDispatch(QName port, JAXBContext jc, Service.Mode mode, WSServiceDelegate service, Tube pipe, BindingImpl binding, WSEndpointReference epr) {
super(port, mode, service, pipe, binding, epr);
this.jaxbcontext = jc;
this.isContextSupported = BindingContextFactory.isContextSupported(jc);
}
示例28
@Deprecated
public MessageDispatch(QName port, WSServiceDelegate service, Tube pipe, BindingImpl binding, WSEndpointReference epr) {
super(port, Mode.MESSAGE, service, pipe, binding, epr);
}
示例29
@Deprecated
public SOAPSourceDispatch(QName port, Mode mode, WSServiceDelegate owner, Tube pipe, BindingImpl binding, WSEndpointReference epr) {
super(port, mode, owner, pipe, binding, epr);
assert !isXMLHttp(binding);
}
示例30
private BindingImpl setKnownHeaders(BindingImpl binding) {
if (binding instanceof SOAPBindingImpl) {
((SOAPBindingImpl) binding).setPortKnownHeaders(model.getKnownHeaders());
}
return binding;
}