FileDocCategorySizeDatePackage
PortCreationCallbackImpl.javaAPI DocGlassfish v2 API4455Tue Jul 24 05:01:36 BST 2007com.sun.enterprise.webservice

PortCreationCallbackImpl

public class PortCreationCallbackImpl extends com.sun.xml.ws.api.client.ServiceInterceptor
This is way port creation calls are going to be intercepted in JAXWS2.1

Fields Summary
private com.sun.enterprise.deployment.ServiceReferenceDescriptor
ref
Constructors Summary
public PortCreationCallbackImpl(com.sun.enterprise.deployment.ServiceReferenceDescriptor svcRef)

        ref = svcRef;
    
Methods Summary
public voidpostCreateDispatch(com.sun.xml.ws.developer.WSBindingProvider bp)

public voidpostCreateProxy(com.sun.xml.ws.developer.WSBindingProvider bp, java.lang.Class serviceEndpointInterface)

        
        ServiceRefPortInfo portInfo = ref.getPortInfoBySEI(serviceEndpointInterface.getName());
        if (portInfo!=null) {          
            // Set MTOM for this port
            boolean mtomEnabled = false;
            if(portInfo.getMtomEnabled() != null &&
                (new Boolean(portInfo.getMtomEnabled())).booleanValue()) {
                mtomEnabled = true;
            }
            if (mtomEnabled) {
                Binding bType = bp.getBinding();
                // enable mtom valid only for SOAPBindings
                if(SOAPBinding.class.isAssignableFrom(bType.getClass())) {
                    ((SOAPBinding)bType).setMTOMEnabled(true);
                } else {
                    WsUtil.getDefaultLogger().log(Level.SEVERE,
                            WsUtil.getDefaultStringManager().getLocalString("serviceref.invalidmtom",
                            "MTOM is valid only for SOAP Bindings; Ignoring Enable-MTOM for port {0}",
                            new Object[] {serviceEndpointInterface}));
                }
            }
            
            // Set stub properties
            Set properties = portInfo.getStubProperties();            
            for(Iterator iter = properties.iterator(); iter.hasNext();) {
                NameValuePairDescriptor next = (NameValuePairDescriptor) 
                    iter.next();
                bp.getRequestContext().put(next.getName(), next.getValue());
                
            }
        }