p.setMaxRetransmits(Integer.parseInt(v.trim())); } else if ("AllowChunking".equals(k)) { p.setAllowChunking(Boolean.parseBoolean(v.trim())); } else if ("ChunkingThreshold".equals(k)) { p.setChunkingThreshold(Integer.parseInt(v.trim()));
public void connect(TokenHolder tokenHolder) { for (Class<? extends PublicInterface> interface1 : interfaces) { JaxWsProxyFactoryBean cpfb = new JaxWsProxyFactoryBean(); cpfb.setServiceClass(interface1); cpfb.setAddress(address + "/" + interface1.getSimpleName()); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("mtom-enabled", Boolean.TRUE); cpfb.setProperties(properties); PublicInterface serviceInterface = (PublicInterface) cpfb.create(); client = ClientProxy.getClient(serviceInterface); HTTPConduit http = (HTTPConduit) client.getConduit(); http.getClient().setConnectionTimeout(360000); http.getClient().setAllowChunking(false); http.getClient().setReceiveTimeout(320000); if (!useSoapHeaderSessions) { ((BindingProvider) serviceInterface).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE); } add(interface1.getName(), serviceInterface); } tokenHolder.registerTokenChangeListener(this); notifyOfConnect(); }
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setAllowChunking(false);
Client client = ClientProxy.getClient(XYZSOAPEndPoint); HTTPConduit http = (HTTPConduit) client.getConduit(); HTTPClientPolicy policy = new HTTPClientPolicy(); policy.setAllowChunking(false); http.setClient(policy); ((BindingProvider)XYZSOAPEndPoint).getRequestContext().put("schema-validation-enabled",true);
... HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setAllowChunking(false); httpClientPolicy.setAutoRedirect(true); httpClientPolicy.setConnection(ConnectionType.KEEP_ALIVE); String proxyUrl = "http://proxy.com"; String proxyPortString = "8080"; HTTPConduit http = (HTTPConduit)client.getConduit(); SSLContext sslContext = SSLContext.getInstance("TLSv1"); sslContext.init(null, null, null); HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); TLSClientParameters tlsClientParameters = new TLSClientParameters(); tlsClientParameters.setUseHttpsURLConnectionDefaultSslSocketFactory(true); http.setTlsClientParameters(tlsClientParameters); http.setClient(httpClientPolicy);
/** * Initialization of authentication for NTLM which is needed for the Exchange web service. */ @PostConstruct public void init() { LOGGER.info("Initializing authentication."); // Make NTLM work Authenticator.setDefault(new Authenticator() { public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(ewsUser, ewsPassword.toCharArray()); } }); Client clientProxy = ClientProxy.getClient(exchangeServicePort); HTTPConduit conduit = (HTTPConduit) clientProxy.getConduit(); HTTPClientPolicy client = new HTTPClientPolicy(); // client.setProxyServerPort(8888); // client.setProxyServer("localhost"); // These are needed to make NTLM authentication work. client.setAllowChunking(false); client.setAutoRedirect(true); conduit.setClient(client); }
/** * Factory method for create a new {@link HTTPClientPolicy} object from the given parameters. * * @param connectionTimeout * the connection timeout * @param allowChunking * the allow chunking * @param receiveTimeout * the receive timeout * @return the new {@link HTTPClientPolicy}. */ public static HTTPClientPolicy newHTTPClientPolicy(Long connectionTimeout, boolean allowChunking, Long receiveTimeout) { final HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setConnectionTimeout(connectionTimeout); httpClientPolicy.setAllowChunking(allowChunking); httpClientPolicy.setReceiveTimeout(receiveTimeout); return httpClientPolicy; }
public TelegramServiceRestBotAPIAdapter() { this.api = JAXRSClientFactory.create(RestBotAPI.BOT_API_DEFAULT_URL, RestBotAPI.class, Collections.singletonList(providerByCustomObjectMapper())); WebClient.getConfig(this.api).getHttpConduit().getClient().setAllowChunking(false); }
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setConnectionTimeout(36000); httpClientPolicy.setAllowChunking(false); http.setClient(httpClientPolicy);
private void configureTimeouts(P port) { Client client = getClient(port); HTTPConduit conduit = (HTTPConduit) client.getConduit(); HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setConnectionTimeout(connectionTimeoutMs); httpClientPolicy.setReceiveTimeout(receiveTimeoutMs); httpClientPolicy.setAutoRedirect(true); httpClientPolicy.setAllowChunking(true); conduit.setClient(httpClientPolicy); }
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(ExchangeServicePortType.class); factory.setAddress(url); port = (ExchangeServicePortType) factory.create(); Client client = ClientProxy.getClient(port); HTTPConduit http = (HTTPConduit) client.getConduit(); HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setAllowChunking(false); http.setClient(httpClientPolicy);
p.setAcceptLanguage(StringUtils.combine(p1.getAcceptLanguage(), p2.getAcceptLanguage())); if (p1.isSetAllowChunking()) { p.setAllowChunking(p1.isAllowChunking()); } else if (p2.isSetAllowChunking()) { p.setAllowChunking(p2.isAllowChunking());
public static JaxWsProxyFactoryBean getServiceProxy(BindingProvider servicePort, String serviceAddr) { JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean(); if(serviceAddr != null) proxyFactory.setAddress(serviceAddr); proxyFactory.setServiceClass(servicePort.getClass()); proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor()); SoapBindingConfiguration config = new SoapBindingConfiguration(); config.setVersion(Soap12.getInstance()); proxyFactory.setBindingConfig(config); Client deviceClient = ClientProxy.getClient(servicePort); HTTPConduit http = (HTTPConduit) deviceClient.getConduit(); // AuthorizationPolicy authPolicy = new AuthorizationPolicy(); // authPolicy.setUserName(username); // authPolicy.setPassword(password); // authPolicy.setAuthorizationType("Basic"); // http.setAuthorization(authPolicy); HTTPClientPolicy httpClientPolicy = http.getClient(); httpClientPolicy.setConnectionTimeout(36000); httpClientPolicy.setReceiveTimeout(32000); httpClientPolicy.setAllowChunking(false); return proxyFactory; }
@Test public void testPostAnd401WithText() throws Exception { String endpointAddress = "http://localhost:" + PORT + "/bookstore/post401"; WebClient wc = WebClient.create(endpointAddress); WebClient.getConfig(wc).getHttpConduit().getClient().setAllowChunking(false); Response r = wc.post(null); assertEquals(401, r.getStatus()); assertEquals("This is 401", getStringFromInputStream((InputStream)r.getEntity())); }
httpClientPolicy.setAllowChunking(false);
client.setAllowChunking(false); return cond;
protected void prepare(Object client) { final Client cl = ClientProxy.getClient(client); if (isLogging()) { cl.getInInterceptors().add(new LoggingInInterceptor()); cl.getOutInterceptors().add(new LoggingOutInterceptor()); } final HTTPConduit http = (HTTPConduit) cl.getConduit(); final HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setReceiveTimeout(getTimeOut()); httpClientPolicy.setAllowChunking(false); httpClientPolicy.setConnectionTimeout(getTimeOut()); http.setClient(httpClientPolicy); }
@Test public void testConnectionWithProxy() throws Exception { QName serviceName = new QName("http://cxf.apache.org/systest/jaxws/", "HelloService"); HelloService service = new HelloService(null, serviceName); assertNotNull(service); Hello hello = service.getHelloPort(); Client client = ClientProxy.getClient(hello); client.getInInterceptors().add(new LoggingInInterceptor()); client.getOutInterceptors().add(new LoggingOutInterceptor()); HTTPConduit http = (HTTPConduit)client.getConduit(); HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setAllowChunking(false); httpClientPolicy.setReceiveTimeout(0); httpClientPolicy.setProxyServerType(ProxyServerType.HTTP); httpClientPolicy.setProxyServer("localhost"); httpClientPolicy.setProxyServerPort(PROXY_PORT); http.setClient(httpClientPolicy); ((BindingProvider)hello).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/hello"); assertEquals("getSayHi", hello.sayHi("SayHi")); } }
/** * {@inheritDoc} */ @Override public void onProxyChange(ProxySettings proxySettings) { HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setConnection(ConnectionType.CLOSE); httpClientPolicy.setAllowChunking(true); httpClientPolicy.setCacheControl(ClientCacheControlType.NO_CACHE); if (proxySettings.isEnabled()) { httpClientPolicy.setProxyServer(proxySettings.getProxyHost()); httpClientPolicy.setProxyServerPort(proxySettings.getProxyPort()); httpClientPolicy.setProxyServerType(ProxyServerType.HTTP); } else { httpClientPolicy.setProxyServer(null); httpClientPolicy.unsetProxyServerPort(); httpClientPolicy.setProxyServerType(null); } Client client = ClientProxy.getClient(pronomService); HTTPConduit http = (HTTPConduit) client.getConduit(); http.setClient(httpClientPolicy); }
/** * {@inheritDoc} */ @Override public void onProxyChange(ProxySettings proxySettings) { HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setConnection(ConnectionType.CLOSE); httpClientPolicy.setAllowChunking(true); httpClientPolicy.setCacheControl("no-cache"); if (proxySettings.isEnabled()) { httpClientPolicy.setProxyServer(proxySettings.getProxyHost()); httpClientPolicy.setProxyServerPort(proxySettings.getProxyPort()); httpClientPolicy.setProxyServerType(ProxyServerType.HTTP); } else { httpClientPolicy.setProxyServer(null); httpClientPolicy.setProxyServerPort(null); httpClientPolicy.setProxyServerType(null); } Client client = ClientProxy.getClient(pronomService); HTTPConduit http = (HTTPConduit) client.getConduit(); http.setClient(httpClientPolicy); }