當前位置: 首頁>>代碼示例>>Java>>正文


Java BasicClientCookie.setSecure方法代碼示例

本文整理匯總了Java中org.apache.http.impl.cookie.BasicClientCookie.setSecure方法的典型用法代碼示例。如果您正苦於以下問題:Java BasicClientCookie.setSecure方法的具體用法?Java BasicClientCookie.setSecure怎麽用?Java BasicClientCookie.setSecure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.http.impl.cookie.BasicClientCookie的用法示例。


在下文中一共展示了BasicClientCookie.setSecure方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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

示例3: shareCookies

import org.apache.http.impl.cookie.BasicClientCookie; //導入方法依賴的package包/類
/**
 * Share the cookies with HttpClientTask
 */
public void shareCookies(){
  Object store = getCookieStore();
  if (store == null){
    store = new BasicCookieStore();
    this.getParametersInner().put(HttpClientTask.PARAM_HTTP_COOKIES, store);
  }
  
  CookieStore cookieStore = (CookieStore)store; 
  for (Cookie cookie : this.getDriver().manage().getCookies()){
    BasicClientCookie newCookie = new BasicClientCookie(cookie.getName(), cookie.getValue());
    newCookie.setDomain(cookie.getDomain());
    newCookie.setPath(cookie.getPath());
    newCookie.setExpiryDate(cookie.getExpiry());
    newCookie.setSecure(cookie.isSecure());
    cookieStore.addCookie(newCookie);
  }
}
 
開發者ID:detectiveframework,項目名稱:detective,代碼行數:21,代碼來源:GebDetectivePage.java

示例4: convertCookie

import org.apache.http.impl.cookie.BasicClientCookie; //導入方法依賴的package包/類
/**
 * Converts Selenium cookie to Apache http client.
 * @param browserCookie selenium cookie.
 * @return http client format.
 */
protected ClientCookie convertCookie(Cookie browserCookie) {
    BasicClientCookie cookie = new BasicClientCookie(browserCookie.getName(), browserCookie.getValue());
    String domain = browserCookie.getDomain();
    if (domain != null && domain.startsWith(".")) {
        // http client does not like domains starting with '.', it always removes it when it receives them
        domain = domain.substring(1);
    }
    cookie.setDomain(domain);
    cookie.setPath(browserCookie.getPath());
    cookie.setExpiryDate(browserCookie.getExpiry());
    cookie.setSecure(browserCookie.isSecure());
    if (browserCookie.isHttpOnly()) {
        cookie.setAttribute("httponly", "");
    }
    return cookie;
}
 
開發者ID:fhoeben,項目名稱:hsac-fitnesse-fixtures,代碼行數:22,代碼來源:CookieConverter.java

示例5: 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

示例6: 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

示例7: setCookie

import org.apache.http.impl.cookie.BasicClientCookie; //導入方法依賴的package包/類
/**
 * 批量設置Cookie
 * 
 * @param cookies
 *            cookie鍵值對圖
 * @param domain
 *            作用域 不可為空
 * @param path
 *            路徑 傳null默認為"/"
 * @param useSecure
 *            是否使用安全機製 傳null 默認為false
 * @return 是否成功設置cookie
 */
public boolean setCookie(Map<String, String> cookies, String domain, String path, Boolean useSecure) {
	synchronized (cookieStore) {
		if (domain == null) {
			return false;
		}
		if (path == null) {
			path = "/";
		}
		if (useSecure == null) {
			useSecure = false;
		}
		if (cookies == null || cookies.isEmpty()) {
			return true;
		}
		Set<Entry<String, String>> set = cookies.entrySet();
		String key = null;
		String value = null;
		for (Entry<String, String> entry : set) {
			key = entry.getKey();
			if (key == null || key.isEmpty() || value == null || value.isEmpty()) {
				throw new IllegalArgumentException("cookies key and value both can not be empty");
			}
			BasicClientCookie cookie = new BasicClientCookie(key, value);
			cookie.setDomain(domain);
			cookie.setPath(path);
			cookie.setSecure(useSecure);
			cookieStore.addCookie(cookie);
		}
		return true;
	}
}
 
開發者ID:fier-liu,項目名稱:FCat,代碼行數:45,代碼來源:HttpCallSSL.java

示例8: mimicCookieState

import org.apache.http.impl.cookie.BasicClientCookie; //導入方法依賴的package包/類
/**
 * Load in all the cookies WebDriver currently knows about so that we can mimic the browser cookie state
 *
 * @param seleniumCookieSet
 * @return
 */
private BasicCookieStore mimicCookieState(Set<Cookie> seleniumCookieSet) {
    BasicCookieStore mimicWebDriverCookieStore = new BasicCookieStore();
    for (Cookie seleniumCookie : seleniumCookieSet) {
        BasicClientCookie duplicateCookie = new BasicClientCookie(seleniumCookie.getName(), seleniumCookie.getValue());
        duplicateCookie.setDomain(seleniumCookie.getDomain());
        duplicateCookie.setSecure(seleniumCookie.isSecure());
        duplicateCookie.setExpiryDate(seleniumCookie.getExpiry());
        duplicateCookie.setPath(seleniumCookie.getPath());
        mimicWebDriverCookieStore.addCookie(duplicateCookie);
    }
 
    return mimicWebDriverCookieStore;
}
 
開發者ID:GovernIB,項目名稱:helium,代碼行數:20,代碼來源:FileDownloader.java

示例9: 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

示例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:tommy4711,項目名稱:gaeproxy,代碼行數:12,代碼來源:SerializableCookie.java

示例11: 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:bither,項目名稱:bither-desktop-java,代碼行數:13,代碼來源:SerializableCookie.java

示例12: readObject

import org.apache.http.impl.cookie.BasicClientCookie; //導入方法依賴的package包/類
private void readObject(ObjectInputStream objectinputstream)
{
    b = new BasicClientCookie((String)objectinputstream.readObject(), (String)objectinputstream.readObject());
    b.setComment((String)objectinputstream.readObject());
    b.setDomain((String)objectinputstream.readObject());
    b.setExpiryDate((Date)objectinputstream.readObject());
    b.setPath((String)objectinputstream.readObject());
    b.setVersion(objectinputstream.readInt());
    b.setSecure(objectinputstream.readBoolean());
}
 
開發者ID:vishnudevk,項目名稱:MiBandDecompiled,代碼行數:11,代碼來源:SerializableCookie.java

示例13: mimicCookieState

import org.apache.http.impl.cookie.BasicClientCookie; //導入方法依賴的package包/類
/**
 * Load in all the cookies WebDriver currently knows about so that we can mimic the browser
 * cookie state
 *
 * @param seleniumCookieSet
 *            Set&lt;Cookie&gt;
 */
private BasicCookieStore mimicCookieState(Set<Cookie> seleniumCookieSet) {
	BasicCookieStore copyOfWebDriverCookieStore = new BasicCookieStore();
	for (Cookie seleniumCookie : seleniumCookieSet) {
		BasicClientCookie duplicateCookie = new BasicClientCookie(seleniumCookie.getName(),
				seleniumCookie.getValue());
		duplicateCookie.setDomain(seleniumCookie.getDomain());
		duplicateCookie.setSecure(seleniumCookie.isSecure());
		duplicateCookie.setExpiryDate(seleniumCookie.getExpiry());
		duplicateCookie.setPath(seleniumCookie.getPath());
		copyOfWebDriverCookieStore.addCookie(duplicateCookie);
	}

	return copyOfWebDriverCookieStore;
}
 
開發者ID:gautamsabba,項目名稱:UIFramework,代碼行數:22,代碼來源:FileDownloader.java

示例14: addCookies

import org.apache.http.impl.cookie.BasicClientCookie; //導入方法依賴的package包/類
private void addCookies() {

		Map<String, List<String>> cookies = httpData.getCookies();
		Iterator<String> keys = cookies.keySet().iterator();
		String domain = "";
		domain = message.getURI().getHost();
		CookieStore cookieStore = new BasicCookieStore();

		HttpContext localContext = new BasicHttpContext();

		// Bind custom cookie store to the local context
		localContext.setAttribute( ClientContext.COOKIE_STORE, cookieStore );
		client.getParams().setParameter( ClientPNames.COOKIE_POLICY, CookiePolicy.BROWSER_COMPATIBILITY );

		while ( keys.hasNext() ) {
			String nextKey = keys.next();
			List<String> values = cookies.get( nextKey );
			Date date = new Date( 2038, 1, 1 );
			for ( int i = 0; i < values.size(); i++ ) {
				BasicClientCookie cookie = new BasicClientCookie( nextKey, values.get( i ) );
				cookieStore.addCookie( cookie );
				cookie.setVersion( 1 );
				cookie.setDomain( domain );
				cookie.setPath( "/" );
				cookie.setExpiryDate( date );
				cookie.setSecure( false );
			}
		}
		client.setCookieStore( cookieStore );
	}
 
開發者ID:OpenBD,項目名稱:openbd-core,代碼行數:31,代碼來源:cfHttpConnection.java

示例15: getCookie

import org.apache.http.impl.cookie.BasicClientCookie; //導入方法依賴的package包/類
public Cookie getCookie()
{
	if(cookie == null)
	{
		BasicClientCookie basicCookie = new BasicClientCookie(name, value);
		basicCookie.setDomain(domain);
		basicCookie.setExpiryDate(expiryDate);
		basicCookie.setPath(path);
		basicCookie.setSecure(secure);
		basicCookie.setVersion(version);
		cookie = basicCookie;
	}

	return cookie;
}
 
開發者ID:matmat94,項目名稱:JVC-Forums-Reader,代碼行數:16,代碼來源:SerializableCookie.java


注:本文中的org.apache.http.impl.cookie.BasicClientCookie.setSecure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。