Android CookieManager - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android CookieManager class.

This code example shows how to use the following methods:getCookie, removeAllCookie
      return true; 
    } 
 
    @Override 
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
      String cookieString = cookieManager.getCookie(url);
       
      if (cookieString != null && cookieString.indexOf("_toggl_session") > -1) {
        String s = cookieString.substring(cookieString.indexOf("_toggl_session") + 15);
        int end = s.length(); 
        if (s.indexOf(";") > -1) {
          end = s.indexOf(";");
        } 
        String togglSession = s.substring(0, end);
         
        if (togglSession.length() < 200) {
          Intent intent = getIntent();
          intent.putExtra(TOGGL_SESSION_ID, togglSession);
          setResult(RESULT_OK, intent);
          view.stopLoading();

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHost, getPath, getPort, getUserInfo
		    new GenericObjectPoolConfig()); 
	} 
    } 
 
    public JedisPool(final URI uri) {
	String h = uri.getHost();
	int port = uri.getPort();
	String password = uri.getUserInfo().split(":", 2)[1];
	int database = Integer.parseInt(uri.getPath().split("/", 2)[1]);
	this.internalPool = new GenericObjectPool<Jedis>(new JedisFactory(h,
		port, Protocol.DEFAULT_TIMEOUT, password, database, null),
		new GenericObjectPoolConfig()); 
    } 
 
    public JedisPool(final GenericObjectPoolConfig poolConfig,
	    final String host, int port, int timeout, final String password) {
	this(poolConfig, host, port, timeout, password,
		Protocol.DEFAULT_DATABASE, null); 
    } 
 
9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        final ProtocolChannelClient.Configuration configuration = new ProtocolChannelClient.Configuration();
 
        if(client.getProtocol() == null) {
            // WFLY-1462 for compatibility assume remoting if the standard native port is configured 
            String protocol = client.getPort() == 9999 ? "remote://" : "http-remoting://";
            configuration.setUri(new URI(protocol + formatPossibleIpv6Address(client.getHost()) +  ":" + client.getPort()));
        } else  { 
            configuration.setUri(new URI(client.getProtocol() + "://" + formatPossibleIpv6Address(client.getHost()) +  ":" + client.getPort()));
        } 
        configuration.setOptionMap(DEFAULT_OPTIONS);
        final long timeout = client.getConnectionTimeout();
        if(timeout > 0) {
            configuration.setConnectionTimeout(timeout);
        } 
        return configuration;
    } 
 
    private static String formatPossibleIpv6Address(String address) {
        if (address == null) {
            return address;
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHost, getPort, getUserInfo
 
    public  Context getRemoteContext() throws Exception {
        final Properties env = new Properties();
        env.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory.class.getName());
        URI webUri = managementClient.getWebUri();
        URI namingUri = new URI("http-remoting", webUri.getUserInfo(), webUri.getHost(), webUri.getPort(), "", "" ,"");
        env.put(Context.PROVIDER_URL, namingUri.toString());
        env.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
        env.put("jboss.naming.client.security.callback.handler.class", CallbackHandler.class.getName());
        return new InitialContext(env);
    } 
 
    @Test 
    public void testRemoteLookup() throws Exception { 
        Context context = null;
        try { 
            context = getRemoteContext();
            assertEquals("TestValue", context.lookup("test"));
        } finally { 
            if (context != null)
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
  @Override 
  public URI getTrackingUri(ApplicationId id) throws URISyntaxException { 
    String jobSuffix = id.toString().replaceFirst("^application_", "job_"); 
    String historyServerAddress = 
        MRWebAppUtil.getJHSWebappURLWithScheme(getConf()); 
    return new URI(historyServerAddress + "/jobhistory/job/"+ jobSuffix); 
  } 
} 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHost, getPort
        if (host == null) {
            String referrer = request.getHeader("referer");
            if (referrer != null) {
                URI url;
                try { 
                    url = new URI(referrer);
                    int port = url.getPort();
                    host = url.getHost() + ((port > -1) ? ":" + url.getPort() : "");
                } catch (URISyntaxException e) {
                    throw new RuntimeException("referrer '" + referrer + "' can't be parsed as a URL");
                } 
            } else { 
                throw new RuntimeException("neither the 'host' nor 'referer' headers were present in the HTTP response, I can't determine what URL OpenRefine is listening to.");
            } 
        } 
        return "http://" + host + "/command/core/authorize/" + provider.getHost();
    } 
} 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHost, getPort
    AndroidHttpClient client = null;
 
    try { 
      Log.w("MmsSender", "Sending MMS1 of length: " + (mms != null ? mms.length : "null"));
      client                 = constructHttpClient(context, parameters);
      URI targetUrl          = new URI(parameters.getMmsc());
      HttpHost target        = new HttpHost(targetUrl.getHost(), targetUrl.getPort(), HttpHost.DEFAULT_SCHEME_NAME);
      HttpPost request       = new HttpPost(parameters.getMmsc());
      ByteArrayEntity entity = new ByteArrayEntity(mms);
 
      entity.setContentType("application/vnd.wap.mms-message");
 
      request.setEntity(entity);
      request.setParams(client.getParams());
      request.addHeader("Accept", "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic");
//      request.addHeader("x-wap-profile", "http://www.htcmms.com.tw/Android/Common/nexusone/ua-profile.xml"); 
      request.addHeader("x-wap-profile", "http://www.google.com/oha/rdf/ua-profile-kila.xml");
      HttpResponse response = client.execute(target, request);
      StatusLine status     = response.getStatusLine();
 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHost, getScheme, getUserInfo
  /** 
   * @throws IllegalArgumentException if credentials for S3 cannot be 
   * determined. 
   */ 
  public void initialize(URI uri, Configuration conf) {
    if (uri.getHost() == null) {
      throw new IllegalArgumentException("Invalid hostname in URI " + uri);
    } 
     
    String userInfo = uri.getUserInfo();
    if (userInfo != null) {
      int index = userInfo.indexOf(':');
      if (index != -1) {
        accessKey = userInfo.substring(0, index);
        secretAccessKey = userInfo.substring(index + 1);
      } else { 
        accessKey = userInfo;
      } 
    } 
     

8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPath, getPort, getScheme
 
        if (uri == null) {
            throw new IllegalArgumentException(LocalizationMessages.ERROR_CONTAINER_URI_NULL());
        } 
 
        final String scheme = uri.getScheme();
        if (!scheme.equalsIgnoreCase("http") && !scheme.equalsIgnoreCase("https")) {
            throw new IllegalArgumentException(LocalizationMessages.ERROR_CONTAINER_URI_SCHEME_UNKNOWN(uri));
        } 
 
        final String path = uri.getPath();
        if (path == null) {
            throw new IllegalArgumentException(LocalizationMessages.ERROR_CONTAINER_URI_PATH_NULL(uri));
        } else if (path.length() == 0) {
            throw new IllegalArgumentException(LocalizationMessages.ERROR_CONTAINER_URI_PATH_EMPTY(uri));
        } else if (path.charAt(0) != '/') {
            throw new IllegalArgumentException(LocalizationMessages.ERROR_CONTAINER_URI_PATH_START(uri));
        } 
 
        final int port = (uri.getPort() == -1) ? 80 : uri.getPort();

8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getAuthority, getPort, getRawPath, getScheme
            throw new OAuthMessageSignerException(e);
        } 
    } 
 
    public String normalizeRequestUrl() throws URISyntaxException {
        URI uri = new URI(request.getRequestUrl());
        String scheme = uri.getScheme().toLowerCase();
        String authority = uri.getAuthority().toLowerCase();
        boolean dropPort = (scheme.equals("http") && uri.getPort() == 80)
                || (scheme.equals("https") && uri.getPort() == 443);
        if (dropPort) {
            // find the last : in the authority 
            int index = authority.lastIndexOf(":");
            if (index >= 0) {
                authority = authority.substring(0, index);
            } 
        } 
        String path = uri.getRawPath();
        if (path == null || path.length() <= 0) {
            path = "/"; // conforms to RFC 2616 section 3.2.2

8
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android CookieManager Questions & Answers:

See Code Examples for Android CookieManager Methods: