当前位置: 首页>>代码示例>>Java>>正文


Java BasicClientCookie.setVersion方法代码示例

本文整理汇总了Java中org.apache.http.impl.cookie.BasicClientCookie.setVersion方法的典型用法代码示例。如果您正苦于以下问题:Java BasicClientCookie.setVersion方法的具体用法?Java BasicClientCookie.setVersion怎么用?Java BasicClientCookie.setVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.http.impl.cookie.BasicClientCookie的用法示例。


在下文中一共展示了BasicClientCookie.setVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getuCookie

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
public static CookieStore getuCookie() {
    CookieStore uCookie = new BasicCookieStore();
    try {
        String COOKIE_S_LINKDATA = LemallPlatform.getInstance().getCookieLinkdata();
        if (!TextUtils.isEmpty(COOKIE_S_LINKDATA)) {
            String[] cookies = COOKIE_S_LINKDATA.split("&");
            for (String item : cookies) {
                String[] keyValue = item.split(SearchCriteria.EQ);
                if (keyValue.length == 2) {
                    if (OtherUtil.isContainsChinese(keyValue[1])) {
                        keyValue[1] = URLEncoder.encode(keyValue[1], "UTF-8");
                    }
                    BasicClientCookie cookie = new BasicClientCookie(keyValue[0], keyValue[1]);
                    cookie.setVersion(0);
                    cookie.setDomain(".lemall.com");
                    cookie.setPath("/");
                    uCookie.addCookie(cookie);
                }
            }
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return uCookie;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:26,代码来源:AsyncHttpClient.java

示例2: setCookieStore

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
public static void setCookieStore(HttpResponse httpResponse) {
  System.out.println("----setCookieStore");
  cookieStore = new BasicCookieStore();
  // JSESSIONID
  String setCookie = httpResponse.getFirstHeader("Set-Cookie")
      .getValue();
  String JSESSIONID = setCookie.substring("JSESSIONID=".length(),
      setCookie.indexOf(";"));
  System.out.println("JSESSIONID:" + JSESSIONID);
  // 新建一个Cookie
  BasicClientCookie cookie = new BasicClientCookie("JSESSIONID",
      JSESSIONID);
  cookie.setVersion(0);
  //cookie.setDomain("127.0.0.1");
  //cookie.setPath("/CwlProClient");
  // cookie.setAttribute(ClientCookie.VERSION_ATTR, "0");
  // cookie.setAttribute(ClientCookie.DOMAIN_ATTR, "127.0.0.1");
  // cookie.setAttribute(ClientCookie.PORT_ATTR, "8080");
  // cookie.setAttribute(ClientCookie.PATH_ATTR, "/CwlProWeb");
  cookieStore.addCookie(cookie);
}
 
开发者ID:bluetata,项目名称:crawler-jsoup-maven,代码行数:22,代码来源:CSDNLoginApater.java

示例3: authToGoogle

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
/**
 * Authentication with google account
 * @param cookies cookies list keys from google auth
 * @param login username associated to zds login
 * @param id user id on ZdS associated to login
 */
public void authToGoogle(List<HttpCookie> cookies, String login, String id) {
    if(login != null && id != null) {
        this.login = login;
        this.idUser = id;
        log.info("L'identifiant de l'utilisateur " + this.login + " est : " + idUser);
        cookieStore = new BasicCookieStore();
        for(HttpCookie cookie:cookies) {
            BasicClientCookie c = new BasicClientCookie(cookie.getName(), cookie.getValue());
            c.setDomain(cookie.getDomain());
            c.setPath(cookie.getPath());
            c.setSecure(cookie.getSecure());
            c.setVersion(cookie.getVersion());
            c.setComment(cookie.getComment());
            cookieStore.addCookie(c);
        }
        context.setCookieStore(cookieStore);
        this.authenticated = true;
    }
    else {
        log.debug("Le login de l'utilisateur n'a pas pu être trouvé");
    }
}
 
开发者ID:firm1,项目名称:zest-writer,代码行数:29,代码来源:ZdsHttp.java

示例4: makeCookie

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
/**
 * Create an HttpClient cookie from a JMeter cookie
 */
private org.apache.http.cookie.Cookie makeCookie(Cookie jmc) {
    long exp = jmc.getExpiresMillis();
    BasicClientCookie ret = new BasicClientCookie(jmc.getName(),
            jmc.getValue());
    ret.setDomain(jmc.getDomain());
    ret.setPath(jmc.getPath());
    ret.setExpiryDate(exp > 0 ? new Date(exp) : null); // use null for no expiry
    ret.setSecure(jmc.getSecure());
    ret.setVersion(jmc.getVersion());
    if(jmc.isDomainSpecified()) {
        ret.setAttribute(ClientCookie.DOMAIN_ATTR, jmc.getDomain());
    }
    if(jmc.isPathSpecified()) {
        ret.setAttribute(ClientCookie.PATH_ATTR, jmc.getPath());
    }
    return ret;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:21,代码来源:HC4CookieHandler.java

示例5: clearCookieForHost

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
protected synchronized void clearCookieForHost(String sessionHost) throws Exception {
  Cookie sessionCookie = null;
  for (Cookie cookie : cookieStore.getCookies()) {
    String cookieDomain = cookie.getDomain();
    if (cookieDomain != null) {
      if (sessionHost.equals(cookieDomain) ||
          sessionHost.indexOf(cookieDomain) != -1 ||
          cookieDomain.indexOf(sessionHost) != -1) {
        sessionCookie = cookie;
        break;
      }
    }
  }

  if (sessionCookie != null) {
    BasicClientCookie httpCookie =
        new BasicClientCookie(sessionCookie.getName(), sessionCookie.getValue());
    httpCookie.setExpiryDate(new Date(0));
    httpCookie.setVersion(1);
    httpCookie.setPath(sessionCookie.getPath());
    httpCookie.setDomain(sessionCookie.getDomain());
    cookieStore.addCookie(httpCookie);
  }

  cookieStore.clearExpired(new Date()); // this should clear the cookie
}
 
开发者ID:lucidworks,项目名称:solr-hadoop-common,代码行数:27,代码来源:FusionPipelineClient.java

示例6: clearCookieForHost

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
protected synchronized void clearCookieForHost(String sessionHost) throws Exception {
  Cookie sessionCookie = null;
  for (Cookie cookie : cookieStore.getCookies()) {
    String cookieDomain = cookie.getDomain();
    if (cookieDomain != null) {
      if (sessionHost.equals(cookieDomain) ||
              sessionHost.indexOf(cookieDomain) != -1 ||
              cookieDomain.indexOf(sessionHost) != -1) {
        sessionCookie = cookie;
        break;
      }
    }
  }

  if (sessionCookie != null) {
    BasicClientCookie httpCookie = new BasicClientCookie(sessionCookie.getName(), sessionCookie.getValue());
    httpCookie.setExpiryDate(new Date(0));
    httpCookie.setVersion(1);
    httpCookie.setPath(sessionCookie.getPath());
    httpCookie.setDomain(sessionCookie.getDomain());
    cookieStore.addCookie(httpCookie);
  }

  cookieStore.clearExpired(new Date()); // this should clear the cookie
}
 
开发者ID:lucidworks,项目名称:fusion-client-tools,代码行数:26,代码来源:FusionPipelineClient.java

示例7: generateCookie

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
private BasicClientCookie generateCookie(String cookie) {
    Map<String, String> cookieMap = generateCookieMap(cookie);

    BasicClientCookie clientCookie = new BasicClientCookie(cookieMap.get("name"), cookieMap.get("value"));
    if (cookieMap.containsKey("domain")) {
        clientCookie.setDomain(cookieMap.get("domain"));
    }
    if (cookieMap.containsKey("path")) {
        clientCookie.setPath(cookieMap.get("path"));
    }
    if (cookieMap.containsKey("version")) {
        clientCookie.setVersion(Integer.parseInt(cookieMap.get("version")));
    }
    /* TODO
    if (cookieMap.containsKey("expiry")) {
        clientCookie.setExpiryDate(cookieMap.get("expiry"));
    }
    */

    return clientCookie;
}
 
开发者ID:frankbp,项目名称:robotframework-httplibrary,代码行数:22,代码来源:HttpConnection.java

示例8: create

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
@Override
public DefaultHttpClient create(final HttpMethod method, final URI uri) {
  final CookieStore cookieStore = new BasicCookieStore();

  // Populate cookies if needed
  final BasicClientCookie cookie = new BasicClientCookie("name", "value");
  cookie.setVersion(0);
  cookie.setDomain(".mycompany.com");
  cookie.setPath("/");
  cookieStore.addCookie(cookie);

  final DefaultHttpClient httpClient = super.create(method, uri);
  httpClient.setCookieStore(cookieStore);

  return httpClient;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:CookieHttpClientFactory.java

示例9: getAllCookies

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
public List<Cookie> getAllCookies() {
	List<Cookie> cookies = new ArrayList<Cookie>();

	Cursor cursor = db
			.query(TABLE_NAME, null, null, null, null, null, null);

	for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
		String name = cursor.getString(cursor.getColumnIndex(Column.NAME));
		String value = cursor
				.getString(cursor.getColumnIndex(Column.VALUE));

		BasicClientCookie cookie = new BasicClientCookie(name, value);

		cookie.setComment(cursor.getString(cursor
				.getColumnIndex(Column.COMMENT)));
		cookie.setDomain(cursor.getString(cursor
				.getColumnIndex(Column.DOMAIN)));
		long expireTime = cursor.getLong(cursor
				.getColumnIndex(Column.EXPIRY_DATE));
		if (expireTime != 0) {
			cookie.setExpiryDate(new Date(expireTime));
		}
		cookie.setPath(cursor.getString(cursor.getColumnIndex(Column.PATH)));
		cookie.setSecure(cursor.getInt(cursor.getColumnIndex(Column.SECURE)) == 1);
		cookie.setVersion(cursor.getInt(cursor
				.getColumnIndex(Column.VERSION)));

		cookies.add(cookie);
	}

	cursor.close();

	return cookies;
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:35,代码来源:MyCookieDBManager.java

示例10: readObject

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    String name = (String) in.readObject();
    String value = (String) in.readObject();
    clientCookie = new BasicClientCookie(name, value);
    clientCookie.setComment((String) in.readObject());
    clientCookie.setDomain((String) in.readObject());
    clientCookie.setExpiryDate((Date) in.readObject());
    clientCookie.setPath((String) in.readObject());
    clientCookie.setVersion(in.readInt());
    clientCookie.setSecure(in.readBoolean());
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:12,代码来源:SerializableCookie.java

示例11: DCookieStore

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
public DCookieStore(DSession permanentSession) {
    this.permanentSession = permanentSession;

    if (this.permanentSession != null && this.permanentSession.getCookies() != null) {
        for (Cookie cookie : this.permanentSession.getCookies()) {
            BasicClientCookie bcc = new BasicClientCookie(cookie.getName(), cookie.getValue());
            bcc.setDomain(((BasicClientCookie)cookie).getDomain());
            bcc.setPath(((BasicClientCookie)cookie).getPath());
            bcc.setVersion(((BasicClientCookie)cookie).getVersion());
            super.addCookie(bcc);
        }
    }
}
 
开发者ID:indiketa,项目名称:degiro-java-client,代码行数:14,代码来源:DCookieStore.java

示例12: readObject

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    String key = (String) in.readObject();
    String value = (String) in.readObject();
    clientCookie = new BasicClientCookie(key, value);
    clientCookie.setComment((String) in.readObject());
    clientCookie.setDomain((String) in.readObject());
    clientCookie.setExpiryDate((Date) in.readObject());
    clientCookie.setPath((String) in.readObject());
    clientCookie.setVersion(in.readInt());
    clientCookie.setSecure(in.readBoolean());
}
 
开发者ID:hcq0618,项目名称:AndroidWear-OpenWear,代码行数:12,代码来源:SerializableCookie.java

示例13: clearCookieForHost

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
protected synchronized void clearCookieForHost(String sessionHost) throws Exception {
  Cookie sessionCookie = null;
  for (Cookie cookie : cookieStore.getCookies()) {
    String cookieDomain = cookie.getDomain();
    if (cookieDomain != null) {
      if (sessionHost.equals(cookieDomain) ||
        sessionHost.indexOf(cookieDomain) != -1 ||
        cookieDomain.indexOf(sessionHost) != -1)
      {
        sessionCookie = cookie;
        break;
      }
    }
  }

  if (sessionCookie != null) {
    BasicClientCookie httpCookie =
      new BasicClientCookie(sessionCookie.getName(),sessionCookie.getValue());
    httpCookie.setExpiryDate(new Date(0));
    httpCookie.setVersion(1);
    httpCookie.setPath(sessionCookie.getPath());
    httpCookie.setDomain(sessionCookie.getDomain());
    cookieStore.addCookie(httpCookie);
  }

  cookieStore.clearExpired(new Date()); // this should clear the cookie
}
 
开发者ID:lucidworks,项目名称:storm-solr,代码行数:28,代码来源:FusionPipelineClient.java

示例14: getCookies

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
@Override
public List<Cookie> getCookies() {
  List<Cookie> cookies = new ArrayList<Cookie>();
  SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
  queryBuilder.setTables(TABLE_NAME);
  SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
  String projection[] = { VERSION, NAME, VALUE, DOMAIN, PATH, EXPIRY }; 
  Cursor c = queryBuilder.query(
      db, projection, null, null, null, null, null);
  c.moveToFirst();
  
  while (!c.isAfterLast()) {
    BasicClientCookie cookie = new BasicClientCookie(
        c.getString(c.getColumnIndex(NAME)),
        c.getString(c.getColumnIndex(VALUE)));
    cookie.setVersion(c.getInt(c.getColumnIndex(VERSION)));
    cookie.setDomain(c.getString(c.getColumnIndex(DOMAIN)));
    cookie.setPath(c.getString(c.getColumnIndex(PATH)));
    long expiry = c.getLong(c.getColumnIndex(EXPIRY));
    if (expiry != 0) cookie.setExpiryDate(new Date(expiry));
    cookies.add(cookie);
    c.moveToNext();
  }

  c.close();
  db.close();
  return cookies;
}
 
开发者ID:adepasquale,项目名称:esms,代码行数:29,代码来源:AccountConnectorAndroid.java

示例15: readObject

import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    String name = (String)in.readObject();
    String value = (String)in.readObject();
    clientCookie = new BasicClientCookie(name, value);
    clientCookie.setComment((String)in.readObject());
    clientCookie.setDomain((String)in.readObject());
    clientCookie.setExpiryDate((Date)in.readObject());
    clientCookie.setPath((String)in.readObject());
    clientCookie.setVersion(in.readInt());
    clientCookie.setSecure(in.readBoolean());
}
 
开发者ID:tommy4711,项目名称:gaeproxy,代码行数:12,代码来源:SerializableCookie.java


注:本文中的org.apache.http.impl.cookie.BasicClientCookie.setVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。