本文整理汇总了Java中org.apache.http.impl.cookie.BasicClientCookie.setComment方法的典型用法代码示例。如果您正苦于以下问题:Java BasicClientCookie.setComment方法的具体用法?Java BasicClientCookie.setComment怎么用?Java BasicClientCookie.setComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.http.impl.cookie.BasicClientCookie
的用法示例。
在下文中一共展示了BasicClientCookie.setComment方法的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é");
}
}
示例2: 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;
}
示例3: 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());
}
示例4: 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());
}
示例5: 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());
}
示例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());
}
示例7: 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());
}
示例8: 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());
}
示例9: 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());
}
示例10: getCookies
import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
/**
* @return saved cookies array.
*/
public BasicClientCookie[] getCookies()
{
Cursor cursor = mDatabase.query(DbOpenHelper.COOKIES_TABLE, null, null, null, null, null, null);
// No cookies or error happens.
if(cursor.getColumnIndex(DbOpenHelper.COOKIES_NAME) == -1 || cursor.isAfterLast())
{
cursor.close();
return null;
}
cursor.moveToFirst();
BasicClientCookie[] cookies = new BasicClientCookie[cursor.getCount()];
int index = 0;
while(!cursor.isAfterLast())
{
BasicClientCookie cookie = new BasicClientCookie(
cursor.getString(cursor.getColumnIndex(DbOpenHelper.COOKIES_NAME)),
cursor.getString(cursor.getColumnIndex(DbOpenHelper.COOKIES_VALUE)));
cookie.setComment(cursor.getString(cursor.getColumnIndex(DbOpenHelper.COOKIES_COMMENT)));
cookie.setDomain(cursor.getString(cursor.getColumnIndex(DbOpenHelper.COOKIES_DOMAIN)));
cookie.setPath(cursor.getString(cursor.getColumnIndex(DbOpenHelper.COOKIES_PATH)));
cookie.setVersion(cursor.getInt(cursor.getColumnIndex(DbOpenHelper.COOKIES_VERSION)));
cookie.setSecure(cursor.getInt(cursor.getColumnIndex(DbOpenHelper.COOKIES_SECURE)) == 0 ? false : true);
cookies[index++] = cookie;
cursor.moveToNext();
}
cursor.close();
return cookies;
}
示例11: readObject
import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
{
ois.defaultReadObject();
BasicClientCookie theCookie = new BasicClientCookie((String)ois.readObject(), null);
theCookie.setComment((String) ois.readObject());
theCookie.setDomain((String) ois.readObject());
theCookie.setExpiryDate((Date) ois.readObject());
theCookie.setPath((String) ois.readObject());
theCookie.setValue((String) ois.readObject());
theCookie.setVersion((int) ois.readInt());
cookie = theCookie;
}
示例12: parseRawCookie
import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
public static ArrayList<BasicClientCookie> parseRawCookie(String rawCookie){
String[] rawCookieParams = rawCookie.split(";");
ArrayList<BasicClientCookie> cookies = new ArrayList<BasicClientCookie>();
for(String rawCookieParam : rawCookieParams){
String[] rawCookieNameAndValue = rawCookieParam.split("=");
if(rawCookieNameAndValue.length != 2)
continue;
String cookieName = rawCookieNameAndValue[0].trim();
String cookieValue = rawCookieNameAndValue[1].trim();
BasicClientCookie cookie = new BasicClientCookie(cookieName, cookieValue);
for(int i = 1; i < rawCookieParams.length; i++){
String rawCookieParamNameAndValue[] = rawCookieParams[i].trim().split("=");
String paramName = rawCookieParamNameAndValue[0].trim();
if(paramName.equalsIgnoreCase("secure"))
cookie.setSecure(true);
else{
// attribute not a flag or missing value.
if(rawCookieParamNameAndValue.length == 2){
String paramValue = rawCookieParamNameAndValue[1].trim();
if(paramName.equalsIgnoreCase("max-age")){
long maxAge = Long.parseLong(paramValue);
Date expiryDate = new Date(java.lang.System.currentTimeMillis() + maxAge);
cookie.setExpiryDate(expiryDate);
} else if(paramName.equalsIgnoreCase("domain"))
cookie.setDomain(paramValue);
else if(paramName.equalsIgnoreCase("path"))
cookie.setPath(paramValue);
else if(paramName.equalsIgnoreCase("comment"))
cookie.setComment(paramValue);
}
}
}
cookies.add(cookie);
}
return cookies;
}
示例13: readExternal
import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
public void readExternal(final ObjectInput in) throws IOException,
ClassNotFoundException {
nullMask = in.readInt();
String name = null;
String value = null;
String comment = null;
String commentURL = null;
Date expiryDate = null;
boolean isPersistent = false;
String domain = null;
String path = null;
int[] ports = null;
boolean isSecure = false;
int version = 0;
if ((nullMask & NAME) == 0) {
name = in.readUTF();
}
if ((nullMask & VALUE) == 0) {
value = in.readUTF();
}
if ((nullMask & COMMENT) == 0) {
comment = in.readUTF();
}
if ((nullMask & COMMENT_URL) == 0) {
commentURL = in.readUTF();
}
if ((nullMask & EXPIRY_DATE) == 0) {
expiryDate = new Date(in.readLong());
}
isPersistent = in.readBoolean();
if ((nullMask & DOMAIN) == 0) {
domain = in.readUTF();
}
if ((nullMask & PATH) == 0) {
path = in.readUTF();
}
if ((nullMask & PORTS) == 0) {
final int len = in.readInt();
ports = new int[len];
for (int i = 0; i < len; i++) {
ports[i] = in.readInt();
}
}
isSecure = in.readBoolean();
version = in.readInt();
final BasicClientCookie bc = new BasicClientCookie(name, value);
bc.setComment(comment);
bc.setDomain(domain);
bc.setExpiryDate(expiryDate);
bc.setPath(path);
bc.setSecure(isSecure);
bc.setVersion(version);
this.cookie = bc;
}
示例14: parseRawCookie
import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
public static ArrayList<BasicClientCookie> parseRawCookie(String rawCookie) {
String[] rawCookieParams = rawCookie.split(";");
ArrayList<BasicClientCookie> cookies = new ArrayList<BasicClientCookie>();
for (String rawCookieParam : rawCookieParams) {
String[] rawCookieNameAndValue = rawCookieParam.split("=");
if (rawCookieNameAndValue.length != 2)
continue;
String cookieName = rawCookieNameAndValue[0].trim();
String cookieValue = rawCookieNameAndValue[1].trim();
BasicClientCookie cookie = new BasicClientCookie(cookieName,
cookieValue);
for (int i = 1; i < rawCookieParams.length; i++) {
String rawCookieParamNameAndValue[] = rawCookieParams[i].trim()
.split("=");
String paramName = rawCookieParamNameAndValue[0].trim();
if (paramName.equalsIgnoreCase("secure"))
cookie.setSecure(true);
else {
// attribute not a flag or missing value.
if (rawCookieParamNameAndValue.length == 2) {
String paramValue = rawCookieParamNameAndValue[1]
.trim();
if (paramName.equalsIgnoreCase("max-age")) {
long maxAge = Long.parseLong(paramValue);
Date expiryDate = new Date(
java.lang.System.currentTimeMillis()
+ maxAge);
cookie.setExpiryDate(expiryDate);
} else if (paramName.equalsIgnoreCase("domain"))
cookie.setDomain(paramValue);
else if (paramName.equalsIgnoreCase("path"))
cookie.setPath(paramValue);
else if (paramName.equalsIgnoreCase("comment"))
cookie.setComment(paramValue);
}
}
}
cookies.add(cookie);
}
return cookies;
}
示例15: readExternal
import org.apache.http.impl.cookie.BasicClientCookie; //导入方法依赖的package包/类
public void readExternal(final ObjectInput in) throws IOException,
ClassNotFoundException
{
nullMask = in.readInt();
String name = null;
String value = null;
String comment = null;
//String commentURL = null;
Date expiryDate = null;
//boolean isPersistent = false;
String domain = null;
String path = null;
int[] ports = null;
boolean isSecure = false;
int version = 0;
if ((nullMask & NAME) == 0)
name = in.readUTF();
if ((nullMask & VALUE) == 0)
value = in.readUTF();
if ((nullMask & COMMENT) == 0)
comment = in.readUTF();
if ((nullMask & COMMENT_URL) == 0)
//commentURL =
in.readUTF();
if ((nullMask & EXPIRY_DATE) == 0)
expiryDate = new Date(in.readLong());
//isPersistent =
in.readBoolean();
if ((nullMask & DOMAIN) == 0)
domain = in.readUTF();
if ((nullMask & PATH) == 0)
path = in.readUTF();
if ((nullMask & PORTS) == 0)
{
final int len = in.readInt();
if (len < 10)
{
ports = new int[len];
for (int i = 0; i < len; i++)
ports[i] = in.readInt();
}
}
isSecure = in.readBoolean();
version = in.readInt();
final BasicClientCookie bc = new BasicClientCookie(name, value);
bc.setComment(comment);
bc.setDomain(domain);
bc.setExpiryDate(expiryDate);
bc.setPath(path);
bc.setSecure(isSecure);
bc.setVersion(version);
this.cookie = bc;
}