/** * Set if redirection should be performed or not. * * This method is the functional equivalent to setting the property * {@link ClientConfig#PROPERTY_FOLLOW_REDIRECTS} on the property bag * returned from {@link #getProperties} * * @param redirect if true then the client will automatically redirect * to the URI declared in 3xx responses. */ public void setFollowRedirects(Boolean redirect) { getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, redirect); }
/** * Set the connect timeout interval, in milliseconds. * * This method is the functional equivalent to setting the property * {@link ClientConfig#PROPERTY_CONNECT_TIMEOUT} on the property bag * returned from {@link #getProperties} * * @param interval the connect timeout interval. If null or 0 then * an interval of infinity is declared. */ public void setConnectTimeout(Integer interval) { getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, interval); }
/** * Set the read timeout interval, in milliseconds. * * This method is the functional equivalent to setting the property * {@link ClientConfig#PROPERTY_READ_TIMEOUT} on the property bag * returned from {@link #getProperties} * * @param interval the read timeout interval. If null or 0 then * an interval of infinity is declared. */ public void setReadTimeout(Integer interval) { getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT, interval); }
/** * Set the connect timeout interval, in milliseconds. * * This method is the functional equivalent to setting the property * {@link ClientConfig#PROPERTY_CONNECT_TIMEOUT} on the property bag * returned from {@link #getProperties} * * @param interval the connect timeout interval. If null or 0 then * an interval of infinity is declared. */ public void setConnectTimeout(Integer interval) { getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, interval); }
/** * Set the client to send request entities using chunked encoding * with a particular chunk size. * * This method is the functional equivalent to setting the property * {@link ClientConfig#PROPERTY_CHUNKED_ENCODING_SIZE} on the property bag * returned from {@link #getProperties} * * @param chunkSize the chunked encoding size. If <= 0 then the default * size will be used. If null then chunked encoding will not be * utilized. */ public void setChunkedEncodingSize(Integer chunkSize) { getProperties().put(ClientConfig.PROPERTY_CHUNKED_ENCODING_SIZE, chunkSize); }
/** * Set if redirection should be performed or not. * * This method is the functional equivalent to setting the property * {@link ClientConfig#PROPERTY_FOLLOW_REDIRECTS} on the property bag * returned from {@link #getProperties} * * @param redirect if true then the client will automatically redirect * to the URI declared in 3xx responses. */ public void setFollowRedirects(Boolean redirect) { getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, redirect); }
/** * Set the read timeout interval, in milliseconds. * * This method is the functional equivalent to setting the property * {@link ClientConfig#PROPERTY_READ_TIMEOUT} on the property bag * returned from {@link #getProperties} * * @param interval the read timeout interval. If null or 0 then * an interval of infinity is declared. */ public void setReadTimeout(Integer interval) { getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT, interval); }
/** * Set the client to send request entities using chunked encoding * with a particular chunk size. * * This method is the functional equivalent to setting the property * {@link ClientConfig#PROPERTY_CHUNKED_ENCODING_SIZE} on the property bag * returned from {@link #getProperties} * * @param chunkSize the chunked encoding size. If <= 0 then the default * size will be used. If null then chunked encoding will not be * utilized. */ public void setChunkedEncodingSize(Integer chunkSize) { getProperties().put(ClientConfig.PROPERTY_CHUNKED_ENCODING_SIZE, chunkSize); }
public WebServicesClient() { this(new DefaultClientConfig()); client.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, true); client.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, DEFAULT_CONNECT_TIMEOUT); client.getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT, DEFAULT_READ_TIMEOUT); }
public static Client createSmartClient(SmartConfig smartConfig, ClientHandler clientHandler) { Client client = createStandardClient(smartConfig, clientHandler); // inject SmartFilter (this is the Jersey integration point of the load balancer) client.addFilter(new SmartFilter(smartConfig)); // set up polling for updated host list (if polling is disabled in smartConfig or there's no host list provider, // nothing will happen) PollingDaemon pollingDaemon = new PollingDaemon(smartConfig); pollingDaemon.start(); // attach the daemon thread to the client so users can stop it when finished with the client client.getProperties().put(PollingDaemon.PROPERTY_KEY, pollingDaemon); return client; }
client.getProperties().put(PROPERTY_BUFFER_RESPONSE_ENTITY_ON_EXCEPTION, true); LOGGER.info("Properties of the sun jersey client used by the application: {}", client.getProperties().toString());
client.getProperties().put(PROPERTY_BUFFER_RESPONSE_ENTITY_ON_EXCEPTION, true); LOGGER.info("Properties of the sun jersey client used by the application: {}", client.getProperties().toString());
/** * Destroy this client. Any system resources associated with the client * will be cleaned up. * <p> * This method must be called when there are not responses pending otherwise * undefined behavior will occur. * <p> * The client must not be reused after this method is called otherwise * undefined behavior will occur. */ public static void destroy(Client client) { PollingDaemon pollingDaemon = (PollingDaemon) client.getProperties().get(PollingDaemon.PROPERTY_KEY); if (pollingDaemon != null) { log.debug("terminating polling daemon"); pollingDaemon.terminate(); if (pollingDaemon.getSmartConfig().getHostListProvider() != null) { log.debug("destroying host list provider"); pollingDaemon.getSmartConfig().getHostListProvider().destroy(); } } log.debug("destroying Jersey client"); client.destroy(); }
client.getProperties().toString());
client.getProperties().toString());
getProperties().putAll(config.getProperties());
getProperties().putAll(config.getProperties());