com.sun.xml.internal.ws.server.EndpointFactory Java Examples

The following examples show how to use com.sun.xml.internal.ws.server.EndpointFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EndpointImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void createEndpoint(String urlPattern) {
    // Checks permission for "publishEndpoint"
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(ENDPOINT_PUBLISH_PERMISSION);
    }

    // See if HttpServer implementation is available
    try {
        Class.forName("com.sun.net.httpserver.HttpServer");
    } catch (Exception e) {
        throw new UnsupportedOperationException("Couldn't load light weight http server", e);
    }
    container = getContainer();
    MetadataReader metadataReader = EndpointFactory.getExternalMetadatReader(implClass, binding);
    WSEndpoint wse = WSEndpoint.create(
            implClass, true,
            invoker,
            getProperty(QName.class, Endpoint.WSDL_SERVICE),
            getProperty(QName.class, Endpoint.WSDL_PORT),
            container,
            binding,
            getPrimaryWsdl(metadataReader),
            buildDocList(),
            (EntityResolver) null,
            false
    );
    // Don't load HttpEndpoint class before as it may load HttpServer classes
    actualEndpoint = new HttpEndpoint(executor, getAdapter(wse, urlPattern));
}
 
Example #2
Source File: EndpointImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets wsdl from @WebService or @WebServiceProvider
 */
private @Nullable SDDocumentSource getPrimaryWsdl(MetadataReader metadataReader) {
    // Takes care of @WebService, @WebServiceProvider's wsdlLocation
    EndpointFactory.verifyImplementorClass(implClass, metadataReader);
    String wsdlLocation = EndpointFactory.getWsdlLocation(implClass, metadataReader);
    if (wsdlLocation != null) {
        ClassLoader cl = implClass.getClassLoader();
        URL url = cl.getResource(wsdlLocation);
        if (url != null) {
            return SDDocumentSource.create(url);
        }
        throw new ServerRtException("cannot.load.wsdl", wsdlLocation);
    }
    return null;
}
 
Example #3
Source File: WSEndpoint.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static <T> WSEndpoint<T> create(
    @NotNull Class<T> implType,
    boolean processHandlerAnnotation,
    @Nullable Invoker invoker,
    @Nullable QName serviceName,
    @Nullable QName portName,
    @Nullable Container container,
    @Nullable WSBinding binding,
    @Nullable SDDocumentSource primaryWsdl,
    @Nullable Collection<? extends SDDocumentSource> metadata,
    @Nullable EntityResolver resolver,
    boolean isTransportSynchronous,
    boolean isStandard)
{
    final WSEndpoint<T> endpoint =
        EndpointFactory.createEndpoint(
            implType,processHandlerAnnotation, invoker,serviceName,portName,container,binding,primaryWsdl,metadata,resolver,isTransportSynchronous,isStandard);

    final Iterator<ManagedEndpointFactory> managementFactories = ServiceFinder.find(ManagedEndpointFactory.class).iterator();
    if (managementFactories.hasNext()) {
        final ManagedEndpointFactory managementFactory = managementFactories.next();
        final EndpointCreationAttributes attributes = new EndpointCreationAttributes(
                processHandlerAnnotation, invoker, resolver, isTransportSynchronous);

        WSEndpoint<T> managedEndpoint = managementFactory.createEndpoint(endpoint, attributes);

        if (endpoint.getAssemblerContext().getTerminalTube() instanceof EndpointAwareTube) {
            ((EndpointAwareTube)endpoint.getAssemblerContext().getTerminalTube()).setEndpoint(managedEndpoint);
        }

        return managedEndpoint;
    }


    return endpoint;
}
 
Example #4
Source File: EndpointImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void createEndpoint(String urlPattern) {
    // Checks permission for "publishEndpoint"
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(ENDPOINT_PUBLISH_PERMISSION);
    }

    // See if HttpServer implementation is available
    try {
        Class.forName("com.sun.net.httpserver.HttpServer");
    } catch (Exception e) {
        throw new UnsupportedOperationException("Couldn't load light weight http server", e);
    }
    container = getContainer();
    MetadataReader metadataReader = EndpointFactory.getExternalMetadatReader(implClass, binding);
    WSEndpoint wse = WSEndpoint.create(
            implClass, true,
            invoker,
            getProperty(QName.class, Endpoint.WSDL_SERVICE),
            getProperty(QName.class, Endpoint.WSDL_PORT),
            container,
            binding,
            getPrimaryWsdl(metadataReader),
            buildDocList(),
            (EntityResolver) null,
            false
    );
    // Don't load HttpEndpoint class before as it may load HttpServer classes
    actualEndpoint = new HttpEndpoint(executor, getAdapter(wse, urlPattern));
}
 
Example #5
Source File: EndpointImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets wsdl from @WebService or @WebServiceProvider
 */
private @Nullable SDDocumentSource getPrimaryWsdl(MetadataReader metadataReader) {
    // Takes care of @WebService, @WebServiceProvider's wsdlLocation
    EndpointFactory.verifyImplementorClass(implClass, metadataReader);
    String wsdlLocation = EndpointFactory.getWsdlLocation(implClass, metadataReader);
    if (wsdlLocation != null) {
        ClassLoader cl = implClass.getClassLoader();
        URL url = cl.getResource(wsdlLocation);
        if (url != null) {
            return SDDocumentSource.create(url);
        }
        throw new ServerRtException("cannot.load.wsdl", wsdlLocation);
    }
    return null;
}
 
Example #6
Source File: WSEndpoint.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static <T> WSEndpoint<T> create(
    @NotNull Class<T> implType,
    boolean processHandlerAnnotation,
    @Nullable Invoker invoker,
    @Nullable QName serviceName,
    @Nullable QName portName,
    @Nullable Container container,
    @Nullable WSBinding binding,
    @Nullable SDDocumentSource primaryWsdl,
    @Nullable Collection<? extends SDDocumentSource> metadata,
    @Nullable EntityResolver resolver,
    boolean isTransportSynchronous,
    boolean isStandard)
{
    final WSEndpoint<T> endpoint =
        EndpointFactory.createEndpoint(
            implType,processHandlerAnnotation, invoker,serviceName,portName,container,binding,primaryWsdl,metadata,resolver,isTransportSynchronous,isStandard);

    final Iterator<ManagedEndpointFactory> managementFactories = ServiceFinder.find(ManagedEndpointFactory.class).iterator();
    if (managementFactories.hasNext()) {
        final ManagedEndpointFactory managementFactory = managementFactories.next();
        final EndpointCreationAttributes attributes = new EndpointCreationAttributes(
                processHandlerAnnotation, invoker, resolver, isTransportSynchronous);

        WSEndpoint<T> managedEndpoint = managementFactory.createEndpoint(endpoint, attributes);

        if (endpoint.getAssemblerContext().getTerminalTube() instanceof EndpointAwareTube) {
            ((EndpointAwareTube)endpoint.getAssemblerContext().getTerminalTube()).setEndpoint(managedEndpoint);
        }

        return managedEndpoint;
    }


    return endpoint;
}
 
Example #7
Source File: EndpointImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void createEndpoint(String urlPattern) {
    // Checks permission for "publishEndpoint"
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(ENDPOINT_PUBLISH_PERMISSION);
    }

    // See if HttpServer implementation is available
    try {
        Class.forName("com.sun.net.httpserver.HttpServer");
    } catch (Exception e) {
        throw new UnsupportedOperationException("Couldn't load light weight http server", e);
    }
    container = getContainer();
    MetadataReader metadataReader = EndpointFactory.getExternalMetadatReader(implClass, binding);
    WSEndpoint wse = WSEndpoint.create(
            implClass, true,
            invoker,
            getProperty(QName.class, Endpoint.WSDL_SERVICE),
            getProperty(QName.class, Endpoint.WSDL_PORT),
            container,
            binding,
            getPrimaryWsdl(metadataReader),
            buildDocList(),
            (EntityResolver) null,
            false
    );
    // Don't load HttpEndpoint class before as it may load HttpServer classes
    actualEndpoint = new HttpEndpoint(executor, getAdapter(wse, urlPattern));
}
 
Example #8
Source File: EndpointImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets wsdl from @WebService or @WebServiceProvider
 */
private @Nullable SDDocumentSource getPrimaryWsdl(MetadataReader metadataReader) {
    // Takes care of @WebService, @WebServiceProvider's wsdlLocation
    EndpointFactory.verifyImplementorClass(implClass, metadataReader);
    String wsdlLocation = EndpointFactory.getWsdlLocation(implClass, metadataReader);
    if (wsdlLocation != null) {
        return SDDocumentSource.create(implClass, wsdlLocation);
    }
    return null;
}
 
Example #9
Source File: WSEndpoint.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static <T> WSEndpoint<T> create(
    @NotNull Class<T> implType,
    boolean processHandlerAnnotation,
    @Nullable Invoker invoker,
    @Nullable QName serviceName,
    @Nullable QName portName,
    @Nullable Container container,
    @Nullable WSBinding binding,
    @Nullable SDDocumentSource primaryWsdl,
    @Nullable Collection<? extends SDDocumentSource> metadata,
    @Nullable EntityResolver resolver,
    boolean isTransportSynchronous,
    boolean isStandard)
{
    final WSEndpoint<T> endpoint =
        EndpointFactory.createEndpoint(
            implType,processHandlerAnnotation, invoker,serviceName,portName,container,binding,primaryWsdl,metadata,resolver,isTransportSynchronous,isStandard);

    final Iterator<ManagedEndpointFactory> managementFactories = ServiceFinder.find(ManagedEndpointFactory.class).iterator();
    if (managementFactories.hasNext()) {
        final ManagedEndpointFactory managementFactory = managementFactories.next();
        final EndpointCreationAttributes attributes = new EndpointCreationAttributes(
                processHandlerAnnotation, invoker, resolver, isTransportSynchronous);

        WSEndpoint<T> managedEndpoint = managementFactory.createEndpoint(endpoint, attributes);

        if (endpoint.getAssemblerContext().getTerminalTube() instanceof EndpointAwareTube) {
            ((EndpointAwareTube)endpoint.getAssemblerContext().getTerminalTube()).setEndpoint(managedEndpoint);
        }

        return managedEndpoint;
    }


    return endpoint;
}
 
Example #10
Source File: WSEndpoint.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static <T> WSEndpoint<T> create(
    @NotNull Class<T> implType,
    boolean processHandlerAnnotation,
    @Nullable Invoker invoker,
    @Nullable QName serviceName,
    @Nullable QName portName,
    @Nullable Container container,
    @Nullable WSBinding binding,
    @Nullable SDDocumentSource primaryWsdl,
    @Nullable Collection<? extends SDDocumentSource> metadata,
    @Nullable EntityResolver resolver,
    boolean isTransportSynchronous,
    boolean isStandard)
{
    final WSEndpoint<T> endpoint =
        EndpointFactory.createEndpoint(
            implType,processHandlerAnnotation, invoker,serviceName,portName,container,binding,primaryWsdl,metadata,resolver,isTransportSynchronous,isStandard);

    final Iterator<ManagedEndpointFactory> managementFactories = ServiceFinder.find(ManagedEndpointFactory.class).iterator();
    if (managementFactories.hasNext()) {
        final ManagedEndpointFactory managementFactory = managementFactories.next();
        final EndpointCreationAttributes attributes = new EndpointCreationAttributes(
                processHandlerAnnotation, invoker, resolver, isTransportSynchronous);

        WSEndpoint<T> managedEndpoint = managementFactory.createEndpoint(endpoint, attributes);

        if (endpoint.getAssemblerContext().getTerminalTube() instanceof EndpointAwareTube) {
            ((EndpointAwareTube)endpoint.getAssemblerContext().getTerminalTube()).setEndpoint(managedEndpoint);
        }

        return managedEndpoint;
    }


    return endpoint;
}
 
Example #11
Source File: EndpointImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets wsdl from @WebService or @WebServiceProvider
 */
private @Nullable SDDocumentSource getPrimaryWsdl(MetadataReader metadataReader) {
    // Takes care of @WebService, @WebServiceProvider's wsdlLocation
    EndpointFactory.verifyImplementorClass(implClass, metadataReader);
    String wsdlLocation = EndpointFactory.getWsdlLocation(implClass, metadataReader);
    if (wsdlLocation != null) {
        ClassLoader cl = implClass.getClassLoader();
        URL url = cl.getResource(wsdlLocation);
        if (url != null) {
            return SDDocumentSource.create(url);
        }
        throw new ServerRtException("cannot.load.wsdl", wsdlLocation);
    }
    return null;
}
 
Example #12
Source File: WSEndpoint.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static <T> WSEndpoint<T> create(
    @NotNull Class<T> implType,
    boolean processHandlerAnnotation,
    @Nullable Invoker invoker,
    @Nullable QName serviceName,
    @Nullable QName portName,
    @Nullable Container container,
    @Nullable WSBinding binding,
    @Nullable SDDocumentSource primaryWsdl,
    @Nullable Collection<? extends SDDocumentSource> metadata,
    @Nullable EntityResolver resolver,
    boolean isTransportSynchronous,
    boolean isStandard)
{
    final WSEndpoint<T> endpoint =
        EndpointFactory.createEndpoint(
            implType,processHandlerAnnotation, invoker,serviceName,portName,container,binding,primaryWsdl,metadata,resolver,isTransportSynchronous,isStandard);

    final Iterator<ManagedEndpointFactory> managementFactories = ServiceFinder.find(ManagedEndpointFactory.class).iterator();
    if (managementFactories.hasNext()) {
        final ManagedEndpointFactory managementFactory = managementFactories.next();
        final EndpointCreationAttributes attributes = new EndpointCreationAttributes(
                processHandlerAnnotation, invoker, resolver, isTransportSynchronous);

        WSEndpoint<T> managedEndpoint = managementFactory.createEndpoint(endpoint, attributes);

        if (endpoint.getAssemblerContext().getTerminalTube() instanceof EndpointAwareTube) {
            ((EndpointAwareTube)endpoint.getAssemblerContext().getTerminalTube()).setEndpoint(managedEndpoint);
        }

        return managedEndpoint;
    }


    return endpoint;
}
 
Example #13
Source File: EndpointImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void createEndpoint(String urlPattern) {
    // Checks permission for "publishEndpoint"
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(ENDPOINT_PUBLISH_PERMISSION);
    }

    // See if HttpServer implementation is available
    try {
        Class.forName("com.sun.net.httpserver.HttpServer");
    } catch (Exception e) {
        throw new UnsupportedOperationException("Couldn't load light weight http server", e);
    }
    container = getContainer();
    MetadataReader metadataReader = EndpointFactory.getExternalMetadatReader(implClass, binding);
    WSEndpoint wse = WSEndpoint.create(
            implClass, true,
            invoker,
            getProperty(QName.class, Endpoint.WSDL_SERVICE),
            getProperty(QName.class, Endpoint.WSDL_PORT),
            container,
            binding,
            getPrimaryWsdl(metadataReader),
            buildDocList(),
            (EntityResolver) null,
            false
    );
    // Don't load HttpEndpoint class before as it may load HttpServer classes
    actualEndpoint = new HttpEndpoint(executor, getAdapter(wse, urlPattern));
}
 
Example #14
Source File: EndpointImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets wsdl from @WebService or @WebServiceProvider
 */
private @Nullable SDDocumentSource getPrimaryWsdl(MetadataReader metadataReader) {
    // Takes care of @WebService, @WebServiceProvider's wsdlLocation
    EndpointFactory.verifyImplementorClass(implClass, metadataReader);
    String wsdlLocation = EndpointFactory.getWsdlLocation(implClass, metadataReader);
    if (wsdlLocation != null) {
        ClassLoader cl = implClass.getClassLoader();
        URL url = cl.getResource(wsdlLocation);
        if (url != null) {
            return SDDocumentSource.create(url);
        }
        throw new ServerRtException("cannot.load.wsdl", wsdlLocation);
    }
    return null;
}
 
Example #15
Source File: WSEndpoint.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static <T> WSEndpoint<T> create(
    @NotNull Class<T> implType,
    boolean processHandlerAnnotation,
    @Nullable Invoker invoker,
    @Nullable QName serviceName,
    @Nullable QName portName,
    @Nullable Container container,
    @Nullable WSBinding binding,
    @Nullable SDDocumentSource primaryWsdl,
    @Nullable Collection<? extends SDDocumentSource> metadata,
    @Nullable EntityResolver resolver,
    boolean isTransportSynchronous,
    boolean isStandard)
{
    final WSEndpoint<T> endpoint =
        EndpointFactory.createEndpoint(
            implType,processHandlerAnnotation, invoker,serviceName,portName,container,binding,primaryWsdl,metadata,resolver,isTransportSynchronous,isStandard);

    final Iterator<ManagedEndpointFactory> managementFactories = ServiceFinder.find(ManagedEndpointFactory.class).iterator();
    if (managementFactories.hasNext()) {
        final ManagedEndpointFactory managementFactory = managementFactories.next();
        final EndpointCreationAttributes attributes = new EndpointCreationAttributes(
                processHandlerAnnotation, invoker, resolver, isTransportSynchronous);

        WSEndpoint<T> managedEndpoint = managementFactory.createEndpoint(endpoint, attributes);

        if (endpoint.getAssemblerContext().getTerminalTube() instanceof EndpointAwareTube) {
            ((EndpointAwareTube)endpoint.getAssemblerContext().getTerminalTube()).setEndpoint(managedEndpoint);
        }

        return managedEndpoint;
    }


    return endpoint;
}
 
Example #16
Source File: EndpointImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void createEndpoint(String urlPattern) {
    // Checks permission for "publishEndpoint"
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(ENDPOINT_PUBLISH_PERMISSION);
    }

    // See if HttpServer implementation is available
    try {
        Class.forName("com.sun.net.httpserver.HttpServer");
    } catch (Exception e) {
        throw new UnsupportedOperationException("Couldn't load light weight http server", e);
    }
    container = getContainer();
    MetadataReader metadataReader = EndpointFactory.getExternalMetadatReader(implClass, binding);
    WSEndpoint wse = WSEndpoint.create(
            implClass, true,
            invoker,
            getProperty(QName.class, Endpoint.WSDL_SERVICE),
            getProperty(QName.class, Endpoint.WSDL_PORT),
            container,
            binding,
            getPrimaryWsdl(metadataReader),
            buildDocList(),
            (EntityResolver) null,
            false
    );
    // Don't load HttpEndpoint class before as it may load HttpServer classes
    actualEndpoint = new HttpEndpoint(executor, getAdapter(wse, urlPattern));
}
 
Example #17
Source File: EndpointImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets wsdl from @WebService or @WebServiceProvider
 */
private @Nullable SDDocumentSource getPrimaryWsdl(MetadataReader metadataReader) {
    // Takes care of @WebService, @WebServiceProvider's wsdlLocation
    EndpointFactory.verifyImplementorClass(implClass, metadataReader);
    String wsdlLocation = EndpointFactory.getWsdlLocation(implClass, metadataReader);
    if (wsdlLocation != null) {
        ClassLoader cl = implClass.getClassLoader();
        URL url = cl.getResource(wsdlLocation);
        if (url != null) {
            return SDDocumentSource.create(url);
        }
        throw new ServerRtException("cannot.load.wsdl", wsdlLocation);
    }
    return null;
}
 
Example #18
Source File: WSEndpoint.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static <T> WSEndpoint<T> create(
    @NotNull Class<T> implType,
    boolean processHandlerAnnotation,
    @Nullable Invoker invoker,
    @Nullable QName serviceName,
    @Nullable QName portName,
    @Nullable Container container,
    @Nullable WSBinding binding,
    @Nullable SDDocumentSource primaryWsdl,
    @Nullable Collection<? extends SDDocumentSource> metadata,
    @Nullable EntityResolver resolver,
    boolean isTransportSynchronous,
    boolean isStandard)
{
    final WSEndpoint<T> endpoint =
        EndpointFactory.createEndpoint(
            implType,processHandlerAnnotation, invoker,serviceName,portName,container,binding,primaryWsdl,metadata,resolver,isTransportSynchronous,isStandard);

    final Iterator<ManagedEndpointFactory> managementFactories = ServiceFinder.find(ManagedEndpointFactory.class).iterator();
    if (managementFactories.hasNext()) {
        final ManagedEndpointFactory managementFactory = managementFactories.next();
        final EndpointCreationAttributes attributes = new EndpointCreationAttributes(
                processHandlerAnnotation, invoker, resolver, isTransportSynchronous);

        WSEndpoint<T> managedEndpoint = managementFactory.createEndpoint(endpoint, attributes);

        if (endpoint.getAssemblerContext().getTerminalTube() instanceof EndpointAwareTube) {
            ((EndpointAwareTube)endpoint.getAssemblerContext().getTerminalTube()).setEndpoint(managedEndpoint);
        }

        return managedEndpoint;
    }


    return endpoint;
}
 
Example #19
Source File: EndpointImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void createEndpoint(String urlPattern) {
    // Checks permission for "publishEndpoint"
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(ENDPOINT_PUBLISH_PERMISSION);
    }

    // See if HttpServer implementation is available
    try {
        Class.forName("com.sun.net.httpserver.HttpServer");
    } catch (Exception e) {
        throw new UnsupportedOperationException("Couldn't load light weight http server", e);
    }
    container = getContainer();
    MetadataReader metadataReader = EndpointFactory.getExternalMetadatReader(implClass, binding);
    WSEndpoint wse = WSEndpoint.create(
            implClass, true,
            invoker,
            getProperty(QName.class, Endpoint.WSDL_SERVICE),
            getProperty(QName.class, Endpoint.WSDL_PORT),
            container,
            binding,
            getPrimaryWsdl(metadataReader),
            buildDocList(),
            (EntityResolver) null,
            false
    );
    // Don't load HttpEndpoint class before as it may load HttpServer classes
    actualEndpoint = new HttpEndpoint(executor, getAdapter(wse, urlPattern));
}
 
Example #20
Source File: EndpointImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void createEndpoint(String urlPattern) {
    // Checks permission for "publishEndpoint"
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(ENDPOINT_PUBLISH_PERMISSION);
    }

    // See if HttpServer implementation is available
    try {
        Class.forName("com.sun.net.httpserver.HttpServer");
    } catch (Exception e) {
        throw new UnsupportedOperationException("Couldn't load light weight http server", e);
    }
    container = getContainer();
    MetadataReader metadataReader = EndpointFactory.getExternalMetadatReader(implClass, binding);
    WSEndpoint wse = WSEndpoint.create(
            implClass, true,
            invoker,
            getProperty(QName.class, Endpoint.WSDL_SERVICE),
            getProperty(QName.class, Endpoint.WSDL_PORT),
            container,
            binding,
            getPrimaryWsdl(metadataReader),
            buildDocList(),
            (EntityResolver) null,
            false
    );
    // Don't load HttpEndpoint class before as it may load HttpServer classes
    actualEndpoint = new HttpEndpoint(executor, getAdapter(wse, urlPattern));
}
 
Example #21
Source File: WSEndpoint.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static <T> WSEndpoint<T> create(
    @NotNull Class<T> implType,
    boolean processHandlerAnnotation,
    @Nullable Invoker invoker,
    @Nullable QName serviceName,
    @Nullable QName portName,
    @Nullable Container container,
    @Nullable WSBinding binding,
    @Nullable SDDocumentSource primaryWsdl,
    @Nullable Collection<? extends SDDocumentSource> metadata,
    @Nullable EntityResolver resolver,
    boolean isTransportSynchronous,
    boolean isStandard)
{
    final WSEndpoint<T> endpoint =
        EndpointFactory.createEndpoint(
            implType,processHandlerAnnotation, invoker,serviceName,portName,container,binding,primaryWsdl,metadata,resolver,isTransportSynchronous,isStandard);

    final Iterator<ManagedEndpointFactory> managementFactories = ServiceFinder.find(ManagedEndpointFactory.class).iterator();
    if (managementFactories.hasNext()) {
        final ManagedEndpointFactory managementFactory = managementFactories.next();
        final EndpointCreationAttributes attributes = new EndpointCreationAttributes(
                processHandlerAnnotation, invoker, resolver, isTransportSynchronous);

        WSEndpoint<T> managedEndpoint = managementFactory.createEndpoint(endpoint, attributes);

        if (endpoint.getAssemblerContext().getTerminalTube() instanceof EndpointAwareTube) {
            ((EndpointAwareTube)endpoint.getAssemblerContext().getTerminalTube()).setEndpoint(managedEndpoint);
        }

        return managedEndpoint;
    }


    return endpoint;
}
 
Example #22
Source File: EndpointImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void createEndpoint(String urlPattern) {
    // Checks permission for "publishEndpoint"
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(ENDPOINT_PUBLISH_PERMISSION);
    }

    // See if HttpServer implementation is available
    try {
        Class.forName("com.sun.net.httpserver.HttpServer");
    } catch (Exception e) {
        throw new UnsupportedOperationException("Couldn't load light weight http server", e);
    }
    container = getContainer();
    MetadataReader metadataReader = EndpointFactory.getExternalMetadatReader(implClass, binding);
    WSEndpoint wse = WSEndpoint.create(
            implClass, true,
            invoker,
            getProperty(QName.class, Endpoint.WSDL_SERVICE),
            getProperty(QName.class, Endpoint.WSDL_PORT),
            container,
            binding,
            getPrimaryWsdl(metadataReader),
            buildDocList(),
            (EntityResolver) null,
            false
    );
    // Don't load HttpEndpoint class before as it may load HttpServer classes
    actualEndpoint = new HttpEndpoint(executor, getAdapter(wse, urlPattern));
}
 
Example #23
Source File: EndpointImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets wsdl from @WebService or @WebServiceProvider
 */
private @Nullable SDDocumentSource getPrimaryWsdl(MetadataReader metadataReader) {
    // Takes care of @WebService, @WebServiceProvider's wsdlLocation
    EndpointFactory.verifyImplementorClass(implClass, metadataReader);
    String wsdlLocation = EndpointFactory.getWsdlLocation(implClass, metadataReader);
    if (wsdlLocation != null) {
        ClassLoader cl = implClass.getClassLoader();
        URL url = cl.getResource(wsdlLocation);
        if (url != null) {
            return SDDocumentSource.create(url);
        }
        throw new ServerRtException("cannot.load.wsdl", wsdlLocation);
    }
    return null;
}
 
Example #24
Source File: EndpointImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets wsdl from @WebService or @WebServiceProvider
 */
private @Nullable SDDocumentSource getPrimaryWsdl(MetadataReader metadataReader) {
    // Takes care of @WebService, @WebServiceProvider's wsdlLocation
    EndpointFactory.verifyImplementorClass(implClass, metadataReader);
    String wsdlLocation = EndpointFactory.getWsdlLocation(implClass, metadataReader);
    if (wsdlLocation != null) {
        ClassLoader cl = implClass.getClassLoader();
        URL url = cl.getResource(wsdlLocation);
        if (url != null) {
            return SDDocumentSource.create(url);
        }
        throw new ServerRtException("cannot.load.wsdl", wsdlLocation);
    }
    return null;
}
 
Example #25
Source File: WSEndpoint.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static @NotNull QName getDefaultServiceName(Class endpointClass, boolean isStandard, MetadataReader metadataReader){
    return EndpointFactory.getDefaultServiceName(endpointClass, isStandard, metadataReader);
}
 
Example #26
Source File: WSEndpoint.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static @NotNull QName getDefaultPortName(@NotNull QName serviceName, Class endpointClass, boolean isStandard, MetadataReader metadataReader){
    return EndpointFactory.getDefaultPortName(serviceName, endpointClass, isStandard, metadataReader);
}
 
Example #27
Source File: WSEndpoint.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static @NotNull QName getDefaultServiceName(Class endpointClass, boolean isStandard, MetadataReader metadataReader){
    return EndpointFactory.getDefaultServiceName(endpointClass, isStandard, metadataReader);
}
 
Example #28
Source File: WSEndpoint.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static @NotNull QName getDefaultPortName(@NotNull QName serviceName, Class endpointClass, boolean isStandard, MetadataReader metadataReader){
    return EndpointFactory.getDefaultPortName(serviceName, endpointClass, isStandard, metadataReader);
}
 
Example #29
Source File: DeploymentDescriptorParser.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private List<A> parseAdapters(XMLStreamReader reader) {
    if (!reader.getName().equals(QNAME_ENDPOINTS)) {
        failWithFullName("runtime.parser.invalidElement", reader);
    }

    List<A> adapters = new ArrayList<A>();

    Attributes attrs = XMLStreamReaderUtil.getAttributes(reader);
    String version = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_VERSION);
    if (!ATTRVALUE_SUPPORTED_VERSIONS.contains(version)) {
        failWithLocalName("runtime.parser.invalidVersionNumber", reader, version);
    }

    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {

        if (reader.getName().equals(QNAME_ENDPOINT)) {
            attrs = XMLStreamReaderUtil.getAttributes(reader);

            String name = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_NAME);
            if (!names.add(name)) {
                logger.warning(
                        WsservletMessages.SERVLET_WARNING_DUPLICATE_ENDPOINT_NAME(/*name*/));
            }

            String implementationName =
                    getMandatoryNonEmptyAttribute(reader, attrs, ATTR_IMPLEMENTATION);
            Class<?> implementorClass = getImplementorClass(implementationName, reader);

            MetadataReader metadataReader = null;
            ExternalMetadataFeature externalMetadataFeature = null;

            // parse subelements to instantiate externalMetadataReader, if necessary ...
            XMLStreamReaderUtil.nextElementContent(reader);
            if (reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
                externalMetadataFeature = configureExternalMetadataReader(reader);
                if (externalMetadataFeature != null) {
                    metadataReader = externalMetadataFeature.getMetadataReader(implementorClass.getClassLoader(), false);
                }
            }

            QName serviceName = getQNameAttribute(attrs, ATTR_SERVICE);
            if (serviceName == null) {
                serviceName = EndpointFactory.getDefaultServiceName(implementorClass, metadataReader);
            }

            QName portName = getQNameAttribute(attrs, ATTR_PORT);
            if (portName == null) {
                portName = EndpointFactory.getDefaultPortName(serviceName, implementorClass, metadataReader);
            }

            //get enable-mtom attribute value
            String enable_mtom = getAttribute(attrs, ATTR_ENABLE_MTOM);
            String mtomThreshold = getAttribute(attrs, ATTR_MTOM_THRESHOLD_VALUE);
            String dbMode = getAttribute(attrs, ATTR_DATABINDING);
            String bindingId = getAttribute(attrs, ATTR_BINDING);
            if (bindingId != null) {
                // Convert short-form tokens to API's binding ids
                bindingId = getBindingIdForToken(bindingId);
            }
            WSBinding binding = createBinding(bindingId, implementorClass, enable_mtom, mtomThreshold, dbMode);
            if (externalMetadataFeature != null) {
                    binding.getFeatures().mergeFeatures(new WebServiceFeature[]{externalMetadataFeature},
                    true);
            }

            String urlPattern = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_URL_PATTERN);

            // TODO use 'docs' as the metadata. If wsdl is non-null it's the primary.
            boolean handlersSetInDD = setHandlersAndRoles(binding, reader, serviceName, portName);

            EndpointFactory.verifyImplementorClass(implementorClass, metadataReader);
            SDDocumentSource primaryWSDL = getPrimaryWSDL(reader, attrs, implementorClass, metadataReader);

            WSEndpoint<?> endpoint = WSEndpoint.create(
                    implementorClass, !handlersSetInDD,
                    null,
                    serviceName, portName, container, binding,
                    primaryWSDL, docs.values(), createEntityResolver(), false
            );
            adapters.add(adapterFactory.createAdapter(name, urlPattern, endpoint));
        } else {
            failWithLocalName("runtime.parser.invalidElement", reader);
        }
    }
    return adapters;
}
 
Example #30
Source File: DeploymentDescriptorParser.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private List<A> parseAdapters(XMLStreamReader reader) {
    if (!reader.getName().equals(QNAME_ENDPOINTS)) {
        failWithFullName("runtime.parser.invalidElement", reader);
    }

    List<A> adapters = new ArrayList<A>();

    Attributes attrs = XMLStreamReaderUtil.getAttributes(reader);
    String version = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_VERSION);
    if (!ATTRVALUE_SUPPORTED_VERSIONS.contains(version)) {
        failWithLocalName("runtime.parser.invalidVersionNumber", reader, version);
    }

    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {

        if (reader.getName().equals(QNAME_ENDPOINT)) {
            attrs = XMLStreamReaderUtil.getAttributes(reader);

            String name = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_NAME);
            if (!names.add(name)) {
                logger.warning(
                        WsservletMessages.SERVLET_WARNING_DUPLICATE_ENDPOINT_NAME(/*name*/));
            }

            String implementationName =
                    getMandatoryNonEmptyAttribute(reader, attrs, ATTR_IMPLEMENTATION);
            Class<?> implementorClass = getImplementorClass(implementationName, reader);

            MetadataReader metadataReader = null;
            ExternalMetadataFeature externalMetadataFeature = null;

            // parse subelements to instantiate externalMetadataReader, if necessary ...
            XMLStreamReaderUtil.nextElementContent(reader);
            if (reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
                externalMetadataFeature = configureExternalMetadataReader(reader);
                if (externalMetadataFeature != null) {
                    metadataReader = externalMetadataFeature.getMetadataReader(implementorClass.getClassLoader(), false);
                }
            }

            QName serviceName = getQNameAttribute(attrs, ATTR_SERVICE);
            if (serviceName == null) {
                serviceName = EndpointFactory.getDefaultServiceName(implementorClass, metadataReader);
            }

            QName portName = getQNameAttribute(attrs, ATTR_PORT);
            if (portName == null) {
                portName = EndpointFactory.getDefaultPortName(serviceName, implementorClass, metadataReader);
            }

            //get enable-mtom attribute value
            String enable_mtom = getAttribute(attrs, ATTR_ENABLE_MTOM);
            String mtomThreshold = getAttribute(attrs, ATTR_MTOM_THRESHOLD_VALUE);
            String dbMode = getAttribute(attrs, ATTR_DATABINDING);
            String bindingId = getAttribute(attrs, ATTR_BINDING);
            if (bindingId != null) {
                // Convert short-form tokens to API's binding ids
                bindingId = getBindingIdForToken(bindingId);
            }
            WSBinding binding = createBinding(bindingId, implementorClass, enable_mtom, mtomThreshold, dbMode);
            if (externalMetadataFeature != null) {
                    binding.getFeatures().mergeFeatures(new WebServiceFeature[]{externalMetadataFeature},
                    true);
            }

            String urlPattern = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_URL_PATTERN);

            // TODO use 'docs' as the metadata. If wsdl is non-null it's the primary.
            boolean handlersSetInDD = setHandlersAndRoles(binding, reader, serviceName, portName);

            EndpointFactory.verifyImplementorClass(implementorClass, metadataReader);
            SDDocumentSource primaryWSDL = getPrimaryWSDL(reader, attrs, implementorClass, metadataReader);

            WSEndpoint<?> endpoint = WSEndpoint.create(
                    implementorClass, !handlersSetInDD,
                    null,
                    serviceName, portName, container, binding,
                    primaryWSDL, docs.values(), createEntityResolver(), false
            );
            adapters.add(adapterFactory.createAdapter(name, urlPattern, endpoint));
        } else {
            failWithLocalName("runtime.parser.invalidElement", reader);
        }
    }
    return adapters;
}