public Client createWithValues(Object... varValues) {
        serviceFactory.setBus(getBus());
        checkResources(false);
        ClassResourceInfo cri = null;
        try {
            Endpoint ep = createEndpoint();
            if (getServiceClass() != null) {
                for (ClassResourceInfo info : serviceFactory.getClassResourceInfo()) {
                    if (info.getServiceClass().isAssignableFrom(getServiceClass())
                        || getServiceClass().isAssignableFrom(info.getServiceClass())) {
                        cri = info;
                        break;
                    }
                }
                if (cri == null) {
                    // can not happen in the reality
                    throw new RuntimeException("Service class " + getServiceClass().getName()
                                               + " is not recognized");
                }
            } else {
                cri = serviceFactory.getClassResourceInfo().get(0);
            }

            boolean isRoot = cri.getURITemplate() != null;
            ClientProxyImpl proxyImpl = null;
            ClientState actualState = getActualState();
            proxyImpl = createClientProxy(cri, isRoot, actualState, varValues);
            initClient(proxyImpl, ep, actualState == null);

            final Class<?> serviceClass = cri.getServiceClass();
            ClassLoader theLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {

                @Override
                public ClassLoader run() {
                    return proxyLoader == null ? serviceClass.getClassLoader() : proxyLoader;
                }
            });
            Class<?>[] ifaces = new Class[]{Client.class, InvocationHandlerAware.class, cri.getServiceClass()};
            Client actualClient = (Client)ProxyHelper.getProxy(theLoader, ifaces, proxyImpl);
            proxyImpl.setProxyClient(actualClient);
            notifyLifecycleManager(actualClient);
            this.getServiceFactory().sendEvent(FactoryBeanListener.Event.CLIENT_CREATED, actualClient, ep);
            return actualClient;
        } catch (IllegalArgumentException ex) {
            String message = ex.getLocalizedMessage();
            if (cri != null) {
                String expected = cri.getServiceClass().getSimpleName();
                if ((expected + " is not an interface").equals(message)) {
                    message += "; make sure CGLIB is on the classpath";
                }
            }
            LOG.severe(ex.getClass().getName() + " : " + message);
            throw ex;
        } catch (Exception ex) {
            LOG.severe(ex.getClass().getName() + " : " + ex.getLocalizedMessage());
            throw new RuntimeException(ex);
        }

    }
public Client createWithValues ( Object ... varValues ) { serviceFactory . setBus ( getBus ( ) ) ; checkResources ( false ) ; ClassResourceInfo cri = null ; try { Endpoint ep = createEndpoint ( ) ; if ( getServiceClass ( ) != null ) { for ( ClassResourceInfo info : serviceFactory . getClassResourceInfo ( ) ) { if ( info . getServiceClass ( ) . isAssignableFrom ( getServiceClass ( ) ) || getServiceClass ( ) . isAssignableFrom ( info . getServiceClass ( ) ) ) { cri = info ; break ; } } if ( cri == null ) { throw new RuntimeException ( "Service class " + getServiceClass ( ) . getName ( ) + " is not recognized" ) ; } } else { cri = serviceFactory . getClassResourceInfo ( ) . get ( 0 ) ; } boolean isRoot = cri . getURITemplate ( ) != null ; ClientProxyImpl proxyImpl = null ; ClientState actualState = getActualState ( ) ; proxyImpl = createClientProxy ( cri , isRoot , actualState , varValues ) ; initClient ( proxyImpl , ep , actualState == null ) ; final Class < ? > serviceClass = cri . getServiceClass ( ) ; ClassLoader theLoader = AccessController . doPrivileged ( new PrivilegedAction < ClassLoader > ( ) { @ Override public ClassLoader run ( ) { return proxyLoader == null ? serviceClass . getClassLoader ( ) : proxyLoader ; } } ) ; Class < ? > [ ] ifaces = new Class [ ] { Client . class , InvocationHandlerAware . class , cri . getServiceClass ( ) } ; Client actualClient = ( Client ) ProxyHelper . getProxy ( theLoader , ifaces , proxyImpl ) ; proxyImpl . setProxyClient ( actualClient ) ; notifyLifecycleManager ( actualClient ) ; this . getServiceFactory ( ) . sendEvent ( FactoryBeanListener . Event . CLIENT_CREATED , actualClient , ep ) ; return actualClient ; } catch ( IllegalArgumentException ex ) { String message = ex . getLocalizedMessage ( ) ; if ( cri != null ) { String expected = cri . getServiceClass ( ) . getSimpleName ( ) ; if ( ( expected + " is not an interface" ) . equals ( message ) ) { message += "; make sure CGLIB is on the classpath" ; } } LOG . severe ( ex . getClass ( ) . getName ( ) + " : " + message ) ; throw ex ; } catch ( Exception ex ) { LOG . severe ( ex . getClass ( ) . getName ( ) + " : " + ex . getLocalizedMessage ( ) ) ; throw new RuntimeException ( ex ) ; } }
Create a Client instance. Proxies and WebClients are Clients.
@param varValues optional list of values which will be used to substitute
template variables specified in the class-level JAX-RS Path annotations

@return the client