List of usage examples for org.apache.http.params BasicHttpParams setIntParameter
public HttpParams setIntParameter(String str, int i)
From source file:com.bt.download.android.core.HttpFetcher.java
private static HttpClient setupHttpClient(boolean gzip) { SSLSocketFactory.getSocketFactory().setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443)); BasicHttpParams params = new BasicHttpParams(); params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(20)); params.setIntParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 200); ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(params, schemeRegistry); DefaultHttpClient httpClient = new DefaultHttpClient(cm, new BasicHttpParams()); httpClient.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(HTTP_RETRY_COUNT, true)); if (gzip) {/*www . j a va2 s . co m*/ httpClient.addRequestInterceptor(new HttpRequestInterceptor() { public void process(HttpRequest request, HttpContext context) throws HttpException, IOException { if (!request.containsHeader("Accept-Encoding")) { request.addHeader("Accept-Encoding", "gzip"); } } }); httpClient.addResponseInterceptor(new HttpResponseInterceptor() { public void process(HttpResponse response, HttpContext context) throws HttpException, IOException { HttpEntity entity = response.getEntity(); Header ceheader = entity.getContentEncoding(); if (ceheader != null) { HeaderElement[] codecs = ceheader.getElements(); for (int i = 0; i < codecs.length; i++) { if (codecs[i].getName().equalsIgnoreCase("gzip")) { response.setEntity(new GzipDecompressingEntity(response.getEntity())); return; } } } } }); } return httpClient; }
From source file:android.net.http.HttpConnection.java
/** * Opens the connection to a http server * * @return the opened low level connection * @throws IOException if the connection fails for any reason. *///from w w w .j a v a 2 s . co m @Override AndroidHttpClientConnection openConnection(Request req) throws IOException { // Update the certificate info (connection not secure - set to null) EventHandler eventHandler = req.getEventHandler(); mCertificate = null; eventHandler.certificate(mCertificate); AndroidHttpClientConnection conn = new AndroidHttpClientConnection(); BasicHttpParams params = new BasicHttpParams(); Socket sock = new Socket(mHost.getHostName(), mHost.getPort()); params.setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8192); conn.bind(sock, params); return conn; }
From source file:org.jclouds.http.apachehc.config.ApacheHCHttpCommandExecutorServiceModule.java
@Singleton @Provides//from ww w . j a v a2s. c o m final HttpParams newBasicHttpParams(HttpUtils utils) { BasicHttpParams params = new BasicHttpParams(); params.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024) .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, true) .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true) .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "jclouds/1.0"); if (utils.getConnectionTimeout() > 0) { params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, utils.getConnectionTimeout()); } if (utils.getSocketOpenTimeout() > 0) { params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, utils.getSocketOpenTimeout()); } if (utils.getMaxConnections() > 0) ConnManagerParams.setMaxTotalConnections(params, utils.getMaxConnections()); if (utils.getMaxConnectionsPerHost() > 0) { ConnPerRoute connectionsPerRoute = new ConnPerRouteBean(utils.getMaxConnectionsPerHost()); ConnManagerParams.setMaxConnectionsPerRoute(params, connectionsPerRoute); } HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); return params; }
From source file:org.mycard.net.network.HttpConnection.java
/*** * Opens the connection to a http server * * @return the opened low level connection * @throws IOException if the connection fails for any reason. *///www . j av a2s . com @Override AndroidHttpClientConnection openConnection(Request req) throws IOException { // Update the certificate info (connection not secure - set to null) //EventHandler eventHandler = req.getEventHandler(); //mCertificate = null; //eventHandler.certificate(mCertificate); AndroidHttpClientConnection conn = new AndroidHttpClientConnection(); BasicHttpParams params = new BasicHttpParams(); Socket sock = new Socket(); sock.connect(new InetSocketAddress(mHost.getHostName(), mHost.getPort()), 20 * 1000); params.setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8192); conn.bind(sock, params); return conn; }
From source file:com.kkbox.toolkit.image.KKImageRequest.java
private void init(Context context, String url, String localPath, Cipher cipher, KKImageRequestListener imageRequestListener) { BasicHttpParams params = new BasicHttpParams(); params.setIntParameter(HttpConnectionParams.CONNECTION_TIMEOUT, 10000); params.setIntParameter(HttpConnectionParams.SO_TIMEOUT, 10000); httpclient = new DefaultHttpClient(params); this.url = url; this.localPath = localPath; this.context = context; this.cipher = cipher; this.listener = imageRequestListener; }
From source file:org.zaizi.sensefy.auth.user.acl.ManifoldACLRequester.java
@PostConstruct public void init() { socketTimeOut = 300000;// ww w .j a v a 2s .c o m poolSize = 50; // Initialize the connection pool httpConnectionManager = new PoolingClientConnectionManager(); httpConnectionManager.setMaxTotal(poolSize); httpConnectionManager.setDefaultMaxPerRoute(poolSize); BasicHttpParams params = new BasicHttpParams(); params.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true); params.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false); params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, socketTimeOut); DefaultHttpClient clientAux = new DefaultHttpClient(httpConnectionManager, params); clientAux.setRedirectStrategy(new DefaultRedirectStrategy()); client = clientAux; }
From source file:com.kkbox.toolkit.internal.api.APIRequest.java
public APIRequest(String url, Cipher cipher, int socketTimeout) { BasicHttpParams params = new BasicHttpParams(); params.setIntParameter(HttpConnectionParams.CONNECTION_TIMEOUT, 10000); params.setIntParameter(HttpConnectionParams.SO_TIMEOUT, socketTimeout); httpclient = new DefaultHttpClient(params); getParams = TextUtils.isEmpty(Uri.parse(url).getQuery()) ? "" : "?" + Uri.parse(url).getQuery(); this.url = url.split("\\?")[0]; this.cipher = cipher; }
From source file:com.jobaline.uiautomation.framework.selenium.phantomJsThreeHourTimeoutFix.HttpCommandExecutor.java
public HttpCommandExecutor(Map<String, CommandInfo> additionalCommands, URL addressOfRemoteServer) { try {/*from w ww . jav a 2 s. c o m*/ remoteServer = addressOfRemoteServer == null ? new URL(System.getProperty("webdriver.remote.server", "http://localhost:4444/wd/hub")) : addressOfRemoteServer; } catch (MalformedURLException e) { throw new WebDriverException(e); } HttpParams params = new BasicHttpParams(); // Use the JRE default for the socket linger timeout. params.setParameter(CoreConnectionPNames.SO_LINGER, -1); HttpClientParams.setRedirecting(params, false); synchronized (HttpCommandExecutor.class) { if (httpClientFactory == null) { httpClientFactory = new HttpClientFactory(); } } client = httpClientFactory.getHttpClient(); // PATCH start // HttpClientFactory has a hardcoded timeout of three hours. // This class is intended to be used only for phantomjs which runs locally so the timeouts will be set to a low value BasicHttpParams paramsPatched = (BasicHttpParams) client.getParams(); paramsPatched.setIntParameter("http.connection.timeout", 90000); // 1 minute an a half paramsPatched.setIntParameter("http.socket.timeout", 90000); // 1 minute an a half ((DefaultHttpClient) client).setParams(params); // PATCH end if (addressOfRemoteServer != null && addressOfRemoteServer.getUserInfo() != null) { // Use HTTP Basic auth UsernamePasswordCredentials credentials = new UsernamePasswordCredentials( addressOfRemoteServer.getUserInfo()); ((DefaultHttpClient) client).getCredentialsProvider().setCredentials(AuthScope.ANY, credentials); } // Some machines claim "localhost.localdomain" is the same as "localhost". // This assumption is not always true. String host = remoteServer.getHost().replace(".localdomain", ""); targetHost = new HttpHost(host, remoteServer.getPort(), remoteServer.getProtocol()); ImmutableMap.Builder<String, CommandInfo> builder = ImmutableMap.builder(); for (Map.Entry<String, CommandInfo> entry : additionalCommands.entrySet()) { builder.put(entry.getKey(), entry.getValue()); } builder.put(GET_ALL_SESSIONS, get("/sessions")).put(NEW_SESSION, post("/session")) .put(GET_CAPABILITIES, get("/session/:sessionId")).put(QUIT, delete("/session/:sessionId")) .put(GET_CURRENT_WINDOW_HANDLE, get("/session/:sessionId/window_handle")) .put(GET_WINDOW_HANDLES, get("/session/:sessionId/window_handles")) .put(GET, post("/session/:sessionId/url")) // The Alert API is still experimental and should not be used. .put(GET_ALERT, get("/session/:sessionId/alert")) .put(DISMISS_ALERT, post("/session/:sessionId/dismiss_alert")) .put(ACCEPT_ALERT, post("/session/:sessionId/accept_alert")) .put(GET_ALERT_TEXT, get("/session/:sessionId/alert_text")) .put(SET_ALERT_VALUE, post("/session/:sessionId/alert_text")) .put(GO_FORWARD, post("/session/:sessionId/forward")).put(GO_BACK, post("/session/:sessionId/back")) .put(REFRESH, post("/session/:sessionId/refresh")) .put(EXECUTE_SCRIPT, post("/session/:sessionId/execute")) .put(EXECUTE_ASYNC_SCRIPT, post("/session/:sessionId/execute_async")) .put(GET_CURRENT_URL, get("/session/:sessionId/url")) .put(GET_TITLE, get("/session/:sessionId/title")) .put(GET_PAGE_SOURCE, get("/session/:sessionId/source")) .put(SCREENSHOT, get("/session/:sessionId/screenshot")) .put(FIND_ELEMENT, post("/session/:sessionId/element")) .put(FIND_ELEMENTS, post("/session/:sessionId/elements")) .put(GET_ACTIVE_ELEMENT, post("/session/:sessionId/element/active")) .put(FIND_CHILD_ELEMENT, post("/session/:sessionId/element/:id/element")) .put(FIND_CHILD_ELEMENTS, post("/session/:sessionId/element/:id/elements")) .put(CLICK_ELEMENT, post("/session/:sessionId/element/:id/click")) .put(CLEAR_ELEMENT, post("/session/:sessionId/element/:id/clear")) .put(SUBMIT_ELEMENT, post("/session/:sessionId/element/:id/submit")) .put(GET_ELEMENT_TEXT, get("/session/:sessionId/element/:id/text")) .put(SEND_KEYS_TO_ELEMENT, post("/session/:sessionId/element/:id/value")) .put(UPLOAD_FILE, post("/session/:sessionId/file")) .put(GET_ELEMENT_VALUE, get("/session/:sessionId/element/:id/value")) .put(GET_ELEMENT_TAG_NAME, get("/session/:sessionId/element/:id/name")) .put(IS_ELEMENT_SELECTED, get("/session/:sessionId/element/:id/selected")) .put(IS_ELEMENT_ENABLED, get("/session/:sessionId/element/:id/enabled")) .put(IS_ELEMENT_DISPLAYED, get("/session/:sessionId/element/:id/displayed")) .put(HOVER_OVER_ELEMENT, post("/session/:sessionId/element/:id/hover")) .put(GET_ELEMENT_LOCATION, get("/session/:sessionId/element/:id/location")) .put(GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW, get("/session/:sessionId/element/:id/location_in_view")) .put(GET_ELEMENT_SIZE, get("/session/:sessionId/element/:id/size")) .put(GET_ELEMENT_ATTRIBUTE, get("/session/:sessionId/element/:id/attribute/:name")) .put(ELEMENT_EQUALS, get("/session/:sessionId/element/:id/equals/:other")) .put(GET_ALL_COOKIES, get("/session/:sessionId/cookie")) .put(ADD_COOKIE, post("/session/:sessionId/cookie")) .put(DELETE_ALL_COOKIES, delete("/session/:sessionId/cookie")) .put(DELETE_COOKIE, delete("/session/:sessionId/cookie/:name")) .put(SWITCH_TO_FRAME, post("/session/:sessionId/frame")) .put(SWITCH_TO_PARENT_FRAME, post("/session/:sessionId/frame/parent")) .put(SWITCH_TO_WINDOW, post("/session/:sessionId/window")) .put(GET_WINDOW_SIZE, get("/session/:sessionId/window/:windowHandle/size")) .put(GET_WINDOW_POSITION, get("/session/:sessionId/window/:windowHandle/position")) .put(SET_WINDOW_SIZE, post("/session/:sessionId/window/:windowHandle/size")) .put(SET_WINDOW_POSITION, post("/session/:sessionId/window/:windowHandle/position")) .put(MAXIMIZE_WINDOW, post("/session/:sessionId/window/:windowHandle/maximize")) .put(CLOSE, delete("/session/:sessionId/window")) .put(DRAG_ELEMENT, post("/session/:sessionId/element/:id/drag")) .put(GET_ELEMENT_VALUE_OF_CSS_PROPERTY, get("/session/:sessionId/element/:id/css/:propertyName")) .put(IMPLICITLY_WAIT, post("/session/:sessionId/timeouts/implicit_wait")) .put(SET_SCRIPT_TIMEOUT, post("/session/:sessionId/timeouts/async_script")) .put(SET_TIMEOUT, post("/session/:sessionId/timeouts")) .put(EXECUTE_SQL, post("/session/:sessionId/execute_sql")) .put(GET_LOCATION, get("/session/:sessionId/location")) .put(SET_LOCATION, post("/session/:sessionId/location")) .put(GET_APP_CACHE_STATUS, get("/session/:sessionId/application_cache/status")) .put(IS_BROWSER_ONLINE, get("/session/:sessionId/browser_connection")) .put(SET_BROWSER_ONLINE, post("/session/:sessionId/browser_connection")) .put(SWITCH_TO_CONTEXT, post("/session/:sessionId/context")) .put(GET_CURRENT_CONTEXT_HANDLE, get("/session/:sessionId/context")) .put(GET_CONTEXT_HANDLES, get("/session/:sessionId/contexts")) // TODO (user): Would it be better to combine this command with // GET_LOCAL_STORAGE_SIZE? .put(GET_LOCAL_STORAGE_ITEM, get("/session/:sessionId/local_storage/key/:key")) .put(REMOVE_LOCAL_STORAGE_ITEM, delete("/session/:sessionId/local_storage/key/:key")) .put(GET_LOCAL_STORAGE_KEYS, get("/session/:sessionId/local_storage")) .put(SET_LOCAL_STORAGE_ITEM, post("/session/:sessionId/local_storage")) .put(CLEAR_LOCAL_STORAGE, delete("/session/:sessionId/local_storage")) .put(GET_LOCAL_STORAGE_SIZE, get("/session/:sessionId/local_storage/size")) // TODO (user): Would it be better to combine this command with // GET_SESSION_STORAGE_SIZE? .put(GET_SESSION_STORAGE_ITEM, get("/session/:sessionId/session_storage/key/:key")) .put(REMOVE_SESSION_STORAGE_ITEM, delete("/session/:sessionId/session_storage/key/:key")) .put(GET_SESSION_STORAGE_KEYS, get("/session/:sessionId/session_storage")) .put(SET_SESSION_STORAGE_ITEM, post("/session/:sessionId/session_storage")) .put(CLEAR_SESSION_STORAGE, delete("/session/:sessionId/session_storage")) .put(GET_SESSION_STORAGE_SIZE, get("/session/:sessionId/session_storage/size")) .put(GET_SCREEN_ORIENTATION, get("/session/:sessionId/orientation")) .put(SET_SCREEN_ORIENTATION, post("/session/:sessionId/orientation")) // Interactions-related commands. .put(CLICK, post("/session/:sessionId/click")) .put(DOUBLE_CLICK, post("/session/:sessionId/doubleclick")) .put(MOUSE_DOWN, post("/session/:sessionId/buttondown")) .put(MOUSE_UP, post("/session/:sessionId/buttonup")) .put(MOVE_TO, post("/session/:sessionId/moveto")) .put(SEND_KEYS_TO_ACTIVE_ELEMENT, post("/session/:sessionId/keys")) // IME related commands. .put(IME_GET_AVAILABLE_ENGINES, get("/session/:sessionId/ime/available_engines")) .put(IME_GET_ACTIVE_ENGINE, get("/session/:sessionId/ime/active_engine")) .put(IME_IS_ACTIVATED, get("/session/:sessionId/ime/activated")) .put(IME_DEACTIVATE, post("/session/:sessionId/ime/deactivate")) .put(IME_ACTIVATE_ENGINE, post("/session/:sessionId/ime/activate")) // Advanced Touch API commands // TODO(berrada): Refactor single tap with mouse click. .put(TOUCH_SINGLE_TAP, post("/session/:sessionId/touch/click")) .put(TOUCH_DOWN, post("/session/:sessionId/touch/down")) .put(TOUCH_UP, post("/session/:sessionId/touch/up")) .put(TOUCH_MOVE, post("/session/:sessionId/touch/move")) .put(TOUCH_SCROLL, post("/session/:sessionId/touch/scroll")) .put(TOUCH_DOUBLE_TAP, post("/session/:sessionId/touch/doubleclick")) .put(TOUCH_LONG_PRESS, post("/session/:sessionId/touch/longclick")) .put(TOUCH_FLICK, post("/session/:sessionId/touch/flick")) .put(GET_LOG, post("/session/:sessionId/log")) .put(GET_AVAILABLE_LOG_TYPES, get("/session/:sessionId/log/types")) .put(STATUS, get("/status")); nameToUrl = builder.build(); }
From source file:org.apache.manifoldcf.crawler.connectors.meridio.meridiowrapper.MeridioWrapper.java
/** The Meridio Wrapper constructor that calls the Meridio login method * *@param log a handle to a Log4j logger *@param meridioDmwsUrl the URL to the Meridio Document Management Web Service *@param meridioRmwsUrl the URL to the Meridio Records Management Web Service *@param dmwsProxyHost the proxy for DMWS, or null if none *@param dmwsProxyPort the proxy port for DMWS, or -1 if default *@param rmwsProxyHost the proxy for RMWS, or null if none *@param rmwsProxyPort the proxy port for RMWS, or -1 if default *@param userName the username of the user to log in as, must include the Windows, e.g. domain\\user *@param password the password of the user who is logging in *@param clientWorkstation an identifier for the client workstation, could be the IP address, for auditing purposes *@param protocolFactory the protocol factory object to use for https communication *@param engineConfigurationFile the engine configuration object to use to communicate with the web services * *@throws RemoteException if an error is encountered logging into Meridio *///from w ww.j a va2s .c o m public MeridioWrapper(Logger log, URL meridioDmwsUrl, URL meridioRmwsUrl, URL meridioManifoldCFWSUrl, String dmwsProxyHost, String dmwsProxyPort, String rmwsProxyHost, String rmwsProxyPort, String mcwsProxyHost, String mcwsProxyPort, String userName, String password, String clientWorkstation, javax.net.ssl.SSLSocketFactory mySSLFactory, Class resourceClass, String engineConfigurationFile) throws RemoteException, NumberFormatException { // Initialize local instance variables oLog = log; this.engineConfiguration = new ResourceProvider(resourceClass, engineConfigurationFile); this.clientWorkstation = clientWorkstation; // Set up the pool. // We have a choice: We can either have one httpclient instance, which gets reinitialized for every service // it connects with (because each one has a potentially different proxy setup), OR we can have a different // httpclient for each service. The latter approach is obviously the more efficient, so I've chosen to do it // that way. PoolingClientConnectionManager localConnectionManager = new PoolingClientConnectionManager(); localConnectionManager.setMaxTotal(1); if (mySSLFactory != null) { SSLSocketFactory myFactory = new SSLSocketFactory(mySSLFactory, new BrowserCompatHostnameVerifier()); Scheme myHttpsProtocol = new Scheme("https", 443, myFactory); localConnectionManager.getSchemeRegistry().register(myHttpsProtocol); } connectionManager = localConnectionManager; // Parse the user and password values int index = userName.indexOf("\\"); String domainUser; String domain; if (index != -1) { domainUser = userName.substring(index + 1); domain = userName.substring(0, index); if (oLog != null && oLog.isDebugEnabled()) oLog.debug("Meridio: User is '" + domainUser + "', domain is '" + domain + "'"); } else { domain = null; domainUser = userName; if (oLog != null && oLog.isDebugEnabled()) oLog.debug("Meridio: User is '" + domainUser + "'; there is no domain specified"); } if (oLog != null && oLog.isDebugEnabled()) { if (password != null && password.length() > 0) oLog.debug("Meridio: Password exists"); else oLog.debug("Meridio: Password is null"); } // Initialize the three httpclient objects // dmws first BasicHttpParams dmwsParams = new BasicHttpParams(); dmwsParams.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true); dmwsParams.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false); dmwsParams.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 60000); dmwsParams.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 900000); dmwsParams.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true); DefaultHttpClient localDmwsHttpClient = new DefaultHttpClient(connectionManager, dmwsParams); // No retries localDmwsHttpClient.setHttpRequestRetryHandler(new HttpRequestRetryHandler() { public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { return false; } }); localDmwsHttpClient.setRedirectStrategy(new DefaultRedirectStrategy()); if (domainUser != null) { localDmwsHttpClient.getCredentialsProvider().setCredentials( new AuthScope(meridioDmwsUrl.getHost(), meridioDmwsUrl.getPort()), new NTCredentials(domainUser, password, currentHost, domain)); } // Initialize proxy if (dmwsProxyHost != null && dmwsProxyHost.length() > 0) { int port = (dmwsProxyPort == null || dmwsProxyPort.length() == 0) ? 8080 : Integer.parseInt(dmwsProxyPort); // Configure proxy authentication if (domainUser != null && domainUser.length() > 0) { localDmwsHttpClient.getCredentialsProvider().setCredentials(new AuthScope(dmwsProxyHost, port), new NTCredentials(domainUser, password, currentHost, domain)); } HttpHost proxy = new HttpHost(dmwsProxyHost, port); localDmwsHttpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); } dmwsHttpClient = localDmwsHttpClient; // rmws BasicHttpParams rmwsParams = new BasicHttpParams(); rmwsParams.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true); rmwsParams.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false); rmwsParams.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 60000); rmwsParams.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 900000); rmwsParams.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true); DefaultHttpClient localRmwsHttpClient = new DefaultHttpClient(connectionManager, rmwsParams); // No retries localRmwsHttpClient.setHttpRequestRetryHandler(new HttpRequestRetryHandler() { public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { return false; } }); localRmwsHttpClient.setRedirectStrategy(new DefaultRedirectStrategy()); if (domainUser != null) { localRmwsHttpClient.getCredentialsProvider().setCredentials( new AuthScope(meridioRmwsUrl.getHost(), meridioRmwsUrl.getPort()), new NTCredentials(domainUser, password, currentHost, domain)); } // Initialize proxy if (rmwsProxyHost != null && rmwsProxyHost.length() > 0) { int port = (rmwsProxyPort == null || rmwsProxyPort.length() == 0) ? 8080 : Integer.parseInt(rmwsProxyPort); // Configure proxy authentication if (domainUser != null && domainUser.length() > 0) { localRmwsHttpClient.getCredentialsProvider().setCredentials(new AuthScope(rmwsProxyHost, port), new NTCredentials(domainUser, password, currentHost, domain)); } HttpHost proxy = new HttpHost(rmwsProxyHost, port); localRmwsHttpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); } rmwsHttpClient = localRmwsHttpClient; // mcws if (meridioManifoldCFWSUrl != null) { BasicHttpParams mcwsParams = new BasicHttpParams(); mcwsParams.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true); mcwsParams.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false); mcwsParams.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 60000); mcwsParams.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 900000); mcwsParams.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true); DefaultHttpClient localMcwsHttpClient = new DefaultHttpClient(connectionManager, mcwsParams); // No retries localMcwsHttpClient.setHttpRequestRetryHandler(new HttpRequestRetryHandler() { public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { return false; } }); localMcwsHttpClient.setRedirectStrategy(new DefaultRedirectStrategy()); if (domainUser != null) { localMcwsHttpClient.getCredentialsProvider().setCredentials( new AuthScope(meridioManifoldCFWSUrl.getHost(), meridioManifoldCFWSUrl.getPort()), new NTCredentials(domainUser, password, currentHost, domain)); } // Initialize proxy if (mcwsProxyHost != null && mcwsProxyHost.length() > 0) { int port = (mcwsProxyPort == null || mcwsProxyPort.length() == 0) ? 8080 : Integer.parseInt(mcwsProxyPort); // Configure proxy authentication if (domainUser != null && domainUser.length() > 0) { localMcwsHttpClient.getCredentialsProvider().setCredentials(new AuthScope(mcwsProxyHost, port), new NTCredentials(domainUser, password, currentHost, domain)); } HttpHost proxy = new HttpHost(mcwsProxyHost, port); localMcwsHttpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); } mcwsHttpClient = localMcwsHttpClient; } else mcwsHttpClient = null; // Set up the stub handles /*================================================================= * Get a handle to the DMWS *================================================================*/ MeridioDMLocator meridioDMLocator = new MeridioDMLocator(engineConfiguration); MeridioDMSoapStub meridioDMWebService = new MeridioDMSoapStub(meridioDmwsUrl, meridioDMLocator); meridioDMWebService.setPortName(meridioDMLocator.getMeridioDMSoapWSDDServiceName()); meridioDMWebService.setUsername(userName); meridioDMWebService.setPassword(password); meridioDMWebService._setProperty(HTTPCLIENT_PROPERTY, dmwsHttpClient); meridioDMWebService_ = meridioDMWebService; /*================================================================= * Get a handle to the RMWS *================================================================*/ MeridioRMLocator meridioRMLocator = new MeridioRMLocator(engineConfiguration); MeridioRMSoapStub meridioRMWebService = new MeridioRMSoapStub(meridioRmwsUrl, meridioRMLocator); meridioRMWebService.setPortName(meridioRMLocator.getMeridioRMSoapWSDDServiceName()); meridioRMWebService.setUsername(userName); meridioRMWebService.setPassword(password); meridioRMWebService._setProperty(HTTPCLIENT_PROPERTY, rmwsHttpClient); meridioRMWebService_ = meridioRMWebService; /*================================================================= * Get a handle to the MeridioMetaCarta Web Service *================================================================*/ if (meridioManifoldCFWSUrl != null) { MetaCartaLocator meridioMCWS = new MetaCartaLocator(engineConfiguration); Service McWsService = null; MetaCartaSoapStub meridioMetaCartaWebService = new MetaCartaSoapStub(meridioManifoldCFWSUrl, McWsService); meridioMetaCartaWebService.setPortName(meridioMCWS.getMetaCartaSoapWSDDServiceName()); meridioMetaCartaWebService.setUsername(userName); meridioMetaCartaWebService.setPassword(password); meridioMetaCartaWebService._setProperty(HTTPCLIENT_PROPERTY, mcwsHttpClient); meridioMCWS_ = meridioMetaCartaWebService; } this.loginUnified(); }