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


Java Cookie.getExpiryDate方法代码示例

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


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

示例1: saveCookie

import org.apache.http.cookie.Cookie; //导入方法依赖的package包/类
public void saveCookie(Cookie cookie) {
	L.d("saveCookie:" + cookie);
	if (cookie == null) {
		return;
	}
	db.delete(TABLE_NAME, Column.NAME + " = ? ",
			new String[] { cookie.getName() });
	ContentValues values = new ContentValues();
	values.put(Column.VALUE, cookie.getValue());
	values.put(Column.NAME, cookie.getName());
	values.put(Column.COMMENT, cookie.getComment());
	values.put(Column.DOMAIN, cookie.getDomain());
	if (cookie.getExpiryDate() != null) {
		values.put(Column.EXPIRY_DATE, cookie.getExpiryDate().getTime());
	}
	values.put(Column.PATH, cookie.getPath());
	values.put(Column.SECURE, cookie.isSecure() ? 1 : 0);
	values.put(Column.VERSION, cookie.getVersion());

	db.insert(TABLE_NAME, null, values);
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:22,代码来源:MyCookieDBManager.java

示例2: makeHttpRequest

import org.apache.http.cookie.Cookie; //导入方法依赖的package包/类
@Override
protected HttpResponse makeHttpRequest(HttpEntity entity, long startTime) {
    if (entity != null) {
        requestBuilder.setEntity(entity);
        requestBuilder.setHeader(entity.getContentType());
    }
    HttpUriRequest httpRequest = requestBuilder.build();
    CloseableHttpClient client = clientBuilder.build();
    BasicHttpContext context = new BasicHttpContext();
    context.setAttribute(URI_CONTEXT_KEY, getRequestUri());
    CloseableHttpResponse httpResponse;
    byte[] bytes;
    try {
        httpResponse = client.execute(httpRequest, context);
        HttpEntity responseEntity = httpResponse.getEntity();
        if (responseEntity == null || responseEntity.getContent() == null) {
            bytes = new byte[0];
        } else {
            InputStream is = responseEntity.getContent();
            bytes = FileUtils.toBytes(is);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    long responseTime = getResponseTime(startTime);
    HttpResponse response = new HttpResponse(responseTime);
    response.setUri(getRequestUri());
    response.setBody(bytes);
    response.setStatus(httpResponse.getStatusLine().getStatusCode());
    for (Cookie c : cookieStore.getCookies()) {
        com.intuit.karate.http.Cookie cookie = new com.intuit.karate.http.Cookie(c.getName(), c.getValue());
        cookie.put(DOMAIN, c.getDomain());
        cookie.put(PATH, c.getPath());
        if (c.getExpiryDate() != null) {
            cookie.put(EXPIRES, c.getExpiryDate().getTime() + "");
        }
        cookie.put(PERSISTENT, c.isPersistent() + "");
        cookie.put(SECURE, c.isSecure() + "");
        response.addCookie(cookie);
    }
    cookieStore.clear(); // we rely on the StepDefs for cookie 'persistence'
    for (Header header : httpResponse.getAllHeaders()) {
        response.addHeader(header.getName(), header.getValue());
    }
    return response;
}
 
开发者ID:intuit,项目名称:karate,代码行数:47,代码来源:ApacheHttpClient.java

示例3: getSessionMap

import org.apache.http.cookie.Cookie; //导入方法依赖的package包/类
private Map<String, Object> getSessionMap() {
    Map<String, Object> sessionMap = new HashMap<String, Object>();
    String sessionId = null;
    Date maxAge = null;
    for (Cookie cookie : cookies) {
        if (SESSION_ID.equals(cookie.getName())) {
            sessionId = cookie.getValue();
            maxAge = cookie.getExpiryDate();
        }
    }
    sessionMap.put(SESSION_ID, sessionId);
    sessionMap.put(MAX_AGE, maxAge);

    return sessionMap;
}
 
开发者ID:personium,项目名称:personium-core,代码行数:16,代码来源:ImplicitFlowTest.java


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