List of usage examples for org.apache.http.params HttpParams getParameter
Object getParameter(String str);
From source file:com.android.providers.downloads.ui.network.SslHttpClient.java
private static HttpParams checkForInvalidParams(HttpParams params) { String className = (String) params.getParameter(ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME); if (className != null) { throw new IllegalArgumentException( "Don't try to pass ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME parameter. We use our own connection manager factory anyway..."); }// w w w . j a v a2 s . c om return params; }
From source file:org.apache.synapse.transport.http.access.Access.java
protected static String getParam(HttpMessage message, String paramName) { HttpParams params = message.getParams(); String param = (String) params.getParameter(paramName); if (param == null) { param = "-"; }//from ww w . j a v a2s.c o m return param; }
From source file:glaze.oauth.OAuthSchemeFactory.java
public AuthScheme newInstance(final HttpParams params) { return new OAuthScheme((String) params.getParameter(DEFAULT_REALM)); }
From source file:org.hydracache.server.httpd.handler.AbstractJsonServiceActionTest.java
protected void stubJSonPHandlerParam(String jsonHandlerName) { HttpParams httpParams = mock(HttpParams.class); when(mockRequest.getParams()).thenReturn(httpParams); when(httpParams.getParameter("handler")).thenReturn(jsonHandlerName); }
From source file:org.eclipse.mylyn.internal.commons.repositories.http.core.PollingSslProtocolSocketFactory.java
private SslSupport getSslSupport(HttpParams params) { SslSupport sslSupport = (SslSupport) params.getParameter(SslSupport.class.getName()); return (sslSupport != null) ? sslSupport : defaultSslSupport; }
From source file:org.hydracache.server.httpd.handler.AbstractHttpMethodHandlerTest.java
protected void stubGetProtocolParam(String protocol) { HttpParams mockHttpParams = mock(HttpParams.class); when(mockRequest.getParams()).thenReturn(mockHttpParams); when(mockHttpParams.getParameter(BaseHttpMethodHandler.PROTOCOL_PARAMETER_NAME)).thenReturn(protocol); }
From source file:glaze.oauth.PreemptiveAuthorizer.java
/** * If no auth scheme has been selected for the given context, consider each * of the preferred auth schemes and select the first one for which an * AuthScheme and matching Credentials are available. *//*from w w w. j a va 2s .c om*/ @SuppressWarnings("unchecked") public void process(HttpRequest request, HttpContext context) throws HttpException, IOException { AuthState authState = (AuthState) context.getAttribute(ClientContext.TARGET_AUTH_STATE); if (authState != null && authState.getAuthScheme() != null) { return; } HttpHost target = (HttpHost) context.getAttribute(ExecutionContext.HTTP_TARGET_HOST); CredentialsProvider provider = (CredentialsProvider) context.getAttribute(ClientContext.CREDS_PROVIDER); AuthSchemeRegistry schemes = (AuthSchemeRegistry) context.getAttribute(ClientContext.AUTHSCHEME_REGISTRY); HttpParams params = request.getParams(); for (String schemeName : (Iterable<String>) params.getParameter(AuthPNames.PROXY_AUTH_PREF)) { AuthScheme scheme = schemes.getAuthScheme(schemeName, params); if (scheme != null) { AuthScope targetScope = new AuthScope(target.getHostName(), target.getPort(), scheme.getRealm(), scheme.getSchemeName()); Credentials creds = provider.getCredentials(targetScope); if (creds != null) { authState.update(scheme, creds); return; } } } }
From source file:org.apache.solr.client.solrj.impl.SolrPortAwareCookieSpecFactory.java
@Override public CookieSpec newInstance(final HttpParams params) { if (params != null) { String[] patterns = null; final Collection<?> param = (Collection<?>) params.getParameter(CookieSpecPNames.DATE_PATTERNS); if (param != null) { patterns = new String[param.size()]; patterns = param.toArray(patterns); }//from w w w . j a v a 2 s . c om return new PortAwareCookieSpec(patterns); } else { return new PortAwareCookieSpec(null); } }
From source file:org.apache.synapse.transport.passthru.config.BaseConfigurationTest.java
@Test public void testBuildHttpParams() throws Exception { HttpParams httpParams = baseConfiguration.buildHttpParams(); Assert.assertNotNull("HTTP Parameters hasn't been initialized.", httpParams); String originServer = (String) httpParams.getParameter(HttpProtocolParams.ORIGIN_SERVER); Assert.assertEquals("Origin Server isn't correct.", "WSO2-PassThrough-HTTP", originServer); }
From source file:com.eviware.soapui.impl.wsdl.support.http.SoapUISSLSocketFactory.java
@Override public Socket createSocket(HttpParams params) throws IOException { String sslConfig = (String) params.getParameter(SoapUIHttpRoute.SOAPUI_SSL_CONFIG); if (StringUtils.isNullOrEmpty(sslConfig)) { return enableSocket((SSLSocket) sslContext.getSocketFactory().createSocket()); }/*from w w w . j a va2 s . co m*/ SSLSocketFactory factory = factoryMap.get(sslConfig); if (factory != null) { if (factory == this) return enableSocket((SSLSocket) sslContext.getSocketFactory().createSocket()); else return enableSocket((SSLSocket) factory.createSocket(params)); } try { // try to create new factory for specified config int ix = sslConfig.lastIndexOf(' '); String keyStore = sslConfig.substring(0, ix); String pwd = sslConfig.substring(ix + 1); KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); if (keyStore.trim().length() > 0) { File f = new File(keyStore); if (f.exists()) { log.info("Initializing Keystore from [" + keyStore + "]"); try { KeyMaterial km = new KeyMaterial(f, pwd.toCharArray()); ks = km.getKeyStore(); } catch (Exception e) { SoapUI.logError(e); pwd = null; } } } factory = new SoapUISSLSocketFactory(ks, pwd); factoryMap.put(sslConfig, factory); return enableSocket((SSLSocket) factory.createSocket(params)); } catch (Exception gse) { SoapUI.logError(gse); return enableSocket((SSLSocket) super.createSocket(params)); } }