|
Java example source code file (ProviderImpl.java)
The ProviderImpl.java Java example source code/* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.xml.internal.ws.spi; import com.sun.xml.internal.ws.api.BindingID; import com.sun.xml.internal.ws.api.WSService; import com.sun.xml.internal.ws.api.ServiceSharedFeatureMarker; import com.sun.xml.internal.ws.api.addressing.AddressingVersion; import com.sun.xml.internal.ws.api.addressing.WSEndpointReference; import com.sun.xml.internal.ws.api.model.wsdl.WSDLModel; import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort; import com.sun.xml.internal.ws.api.model.wsdl.WSDLService; import com.sun.xml.internal.ws.api.server.BoundEndpoint; import com.sun.xml.internal.ws.api.server.Container; import com.sun.xml.internal.ws.api.server.ContainerResolver; import com.sun.xml.internal.ws.api.server.Module; import com.sun.xml.internal.ws.api.server.WSEndpoint; import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension; import com.sun.xml.internal.ws.client.WSServiceDelegate; import com.sun.xml.internal.ws.developer.MemberSubmissionEndpointReference; import com.sun.xml.internal.ws.resources.ProviderApiMessages; import com.sun.xml.internal.ws.transport.http.server.EndpointImpl; import com.sun.xml.internal.ws.util.ServiceFinder; import com.sun.xml.internal.ws.util.xml.XmlUtil; import com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser; import org.w3c.dom.Element; import org.xml.sax.EntityResolver; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import javax.xml.namespace.QName; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.ws.Endpoint; import javax.xml.ws.EndpointReference; import javax.xml.ws.Service; import javax.xml.ws.WebServiceException; import javax.xml.ws.WebServiceFeature; import javax.xml.ws.spi.Provider; import javax.xml.ws.spi.ServiceDelegate; import javax.xml.ws.spi.Invoker; import javax.xml.ws.wsaddressing.W3CEndpointReference; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.List; import java.util.Map; /** * The entry point to the JAX-WS RI from the JAX-WS API. * * @author WS Development Team */ public class ProviderImpl extends Provider { private final static JAXBContext eprjc = getEPRJaxbContext(); /** * Convenient singleton instance. */ public static final ProviderImpl INSTANCE = new ProviderImpl(); @Override public Endpoint createEndpoint(String bindingId, Object implementor) { return new EndpointImpl( (bindingId != null) ? BindingID.parse(bindingId) : BindingID.parse(implementor.getClass()), implementor); } @Override public ServiceDelegate createServiceDelegate( URL wsdlDocumentLocation, QName serviceName, Class serviceClass) { return new WSServiceDelegate(wsdlDocumentLocation, serviceName, serviceClass); } public ServiceDelegate createServiceDelegate( URL wsdlDocumentLocation, QName serviceName, Class serviceClass, WebServiceFeature ... features) { for (WebServiceFeature feature : features) { if (!(feature instanceof ServiceSharedFeatureMarker)) throw new WebServiceException("Doesn't support any Service specific features"); } return new WSServiceDelegate(wsdlDocumentLocation, serviceName, serviceClass, features); } public ServiceDelegate createServiceDelegate( Source wsdlSource, QName serviceName, Class serviceClass) { return new WSServiceDelegate(wsdlSource, serviceName, serviceClass); } @Override public Endpoint createAndPublishEndpoint(String address, Object implementor) { Endpoint endpoint = new EndpointImpl( BindingID.parse(implementor.getClass()), implementor); endpoint.publish(address); return endpoint; } public Endpoint createEndpoint(String bindingId, Object implementor, WebServiceFeature... features) { return new EndpointImpl( (bindingId != null) ? BindingID.parse(bindingId) : BindingID.parse(implementor.getClass()), implementor, features); } public Endpoint createAndPublishEndpoint(String address, Object implementor, WebServiceFeature... features) { Endpoint endpoint = new EndpointImpl( BindingID.parse(implementor.getClass()), implementor, features); endpoint.publish(address); return endpoint; } public Endpoint createEndpoint(String bindingId, Class implementorClass, Invoker invoker, WebServiceFeature... features) { return new EndpointImpl( (bindingId != null) ? BindingID.parse(bindingId) : BindingID.parse(implementorClass), implementorClass, invoker, features); } public EndpointReference readEndpointReference(final Source eprInfoset) { // EPR constructors are private, so we need privilege escalation. // this unmarshalling can only access instances of a fixed, known set of classes, // so doing that shouldn't introduce security vulnerability. return AccessController.doPrivileged(new PrivilegedAction<EndpointReference>() { public EndpointReference run() { try { Unmarshaller unmarshaller = eprjc.createUnmarshaller(); return (EndpointReference) unmarshaller.unmarshal(eprInfoset); } catch (JAXBException e) { throw new WebServiceException("Error creating Marshaller or marshalling.", e); } } }); } public <T> T getPort(EndpointReference endpointReference, Class Other Java examples (source code examples)Here is a short list of links related to this Java ProviderImpl.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.