protected ClientState getActualState() { if (threadSafe) { initialState = new ThreadLocalClientState(getAddress(), timeToKeepState); } if (initialState != null) { return headers != null ? initialState.newState(URI.create(getAddress()), headers, null) : initialState; } return null; }
private ClientState getActualState() { if (threadSafe) { initialState = new ThreadLocalClientState(getAddress(), timeToKeepState); } if (initialState != null) { return headers != null ? initialState.newState(URI.create(getAddress()), headers, null) : initialState; } else { return null; } }
protected ClientState getActualState() { if (threadSafe) { initialState = new ThreadLocalClientState(getAddress(), timeToKeepState); } if (initialState != null) { return headers != null ? initialState.newState(URI.create(getAddress()), headers, null) : initialState; } return null; }
protected ClientProxyImpl createClientProxy(ClassResourceInfo cri, boolean isRoot, ClientState actualState, Object[] varValues) { if (actualState == null) { return new ClientProxyImpl(URI.create(getAddress()), proxyLoader, cri, isRoot, inheritHeaders, varValues); } else { return new ClientProxyImpl(actualState, proxyLoader, cri, isRoot, inheritHeaders, varValues); } }
protected ClientProxyImpl createClientProxy(ClassResourceInfo cri, boolean isRoot, ClientState actualState, Object[] varValues) { if (actualState == null) { return new ClientProxyImpl(URI.create(getAddress()), proxyLoader, cri, isRoot, inheritHeaders, varValues); } else { return new ClientProxyImpl(actualState, proxyLoader, cri, isRoot, inheritHeaders, varValues); } }
/** * Creates a WebClient instance * @return WebClient instance */ public WebClient createWebClient() { String serviceAddress = getAddress(); int queryIndex = serviceAddress != null ? serviceAddress.lastIndexOf('?') : -1; if (queryIndex != -1) { serviceAddress = serviceAddress.substring(0, queryIndex); } Service service = new JAXRSServiceImpl(serviceAddress, getServiceName()); getServiceFactory().setService(service); try { Endpoint ep = createEndpoint(); this.getServiceFactory().sendEvent(FactoryBeanListener.Event.PRE_CLIENT_CREATE, ep); ClientState actualState = getActualState(); WebClient client = actualState == null ? new WebClient(getAddress()) : new WebClient(actualState); initClient(client, ep, actualState == null); notifyLifecycleManager(client); this.getServiceFactory().sendEvent(FactoryBeanListener.Event.CLIENT_CREATED, client, ep); return client; } catch (Exception ex) { LOG.severe(ex.getClass().getName() + " : " + ex.getLocalizedMessage()); throw new RuntimeException(ex); } }
/** * Creates a WebClient instance * @return WebClient instance */ public WebClient createWebClient() { String serviceAddress = getAddress(); int queryIndex = serviceAddress != null ? serviceAddress.lastIndexOf('?') : -1; if (queryIndex != -1) { serviceAddress = serviceAddress.substring(0, queryIndex); } Service service = new JAXRSServiceImpl(serviceAddress, getServiceName()); getServiceFactory().setService(service); try { Endpoint ep = createEndpoint(); this.getServiceFactory().sendEvent(FactoryBeanListener.Event.PRE_CLIENT_CREATE, ep); ClientState actualState = getActualState(); WebClient client = actualState == null ? new WebClient(getAddress()) : new WebClient(actualState); initClient(client, ep, actualState == null); notifyLifecycleManager(client); this.getServiceFactory().sendEvent(FactoryBeanListener.Event.CLIENT_CREATED, client, ep); return client; } catch (Exception ex) { LOG.severe(ex.getClass().getName() + " : " + ex.getLocalizedMessage()); throw new RuntimeException(ex); } }
/** * Initiates a new Batch request. * * The typical operation flow is: * <pre> * BatchRequest batchRequest = syncopeClient.batch(); * batchRequest.getService(UserService.class).create(...); * batchRequest.getService(UserService.class).update(...); * batchRequest.getService(GroupService.class).update(...); * batchRequest.getService(GroupService.class).delete(...); * ... * BatchResponse batchResponse = batchRequest().commit(); * List<BatchResponseItem> items = batchResponse.getItems() * </pre> * * @return empty Batch request */ public BatchRequest batch() { return new BatchRequest( mediaType, restClientFactory.getAddress(), restClientFactory.getProviders(), getJWT()); } }
/** * Initiates a new Batch request. * * The typical operation flow is: * <pre> * BatchRequest batchRequest = syncopeClient.batch(); * batchRequest.getService(UserService.class).create(...); * batchRequest.getService(UserService.class).update(...); * batchRequest.getService(GroupService.class).update(...); * batchRequest.getService(GroupService.class).delete(...); * ... * BatchResponse batchResponse = batchRequest().commit(); * List<BatchResponseItem> items = batchResponse.getItems() * </pre> * * @return empty Batch request */ public BatchRequest batch() { return new BatchRequest( mediaType, restClientFactory.getAddress(), restClientFactory.getProviders(), getJWT()); } }
/** * Creates a WebClient instance * @return WebClient instance */ public WebClient createWebClient() { Service service = new JAXRSServiceImpl(getAddress(), getServiceName()); getServiceFactory().setService(service); try { Endpoint ep = createEndpoint(); this.getServiceFactory().sendEvent(FactoryBeanListener.Event.PRE_CLIENT_CREATE, ep); ClientState actualState = getActualState(); WebClient client = actualState == null ? new WebClient(getAddress()) : new WebClient(actualState); initClient(client, ep, actualState == null); notifyLifecycleManager(client); this.getServiceFactory().sendEvent(FactoryBeanListener.Event.CLIENT_CREATED, client, ep); return client; } catch (Exception ex) { LOG.severe(ex.getClass().getName() + " : " + ex.getLocalizedMessage()); throw new RuntimeException(ex); } }
if (actualState == null) { proxyImpl = new ClientProxyImpl(URI.create(getAddress()), proxyLoader, cri, isRoot, inheritHeaders, varValues); } else {