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


Java Cookie.getValue方法代碼示例

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


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

示例1: getJSessionID

import org.apache.commons.httpclient.Cookie; //導入方法依賴的package包/類
protected String getJSessionID() {
	String jSessionID = null;
	if (httpState != null) {
		Cookie[] httpCookies = httpState.getCookies();
		int len = httpCookies.length;
		Cookie cookie = null;
		
		for (int i=0; i<len; i++) {
			cookie = httpCookies[i];
			String cookieName = cookie.getName();
			String cookieValue = cookie.getValue();
			if (cookieName.equalsIgnoreCase("JSESSIONID")) {
				jSessionID = cookieValue;
				break;
			}
		}
	}
	return jSessionID;
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:20,代碼來源:Step.java

示例2: formatCookieAsVer

import org.apache.commons.httpclient.Cookie; //導入方法依賴的package包/類
/**
 * Return a string suitable for sending in a <tt>"Cookie"</tt> header 
 * as defined in RFC 2109 for backward compatibility with cookie version 0
 * @param buffer The string buffer to use for output
 * @param cookie The {@link Cookie} to be formatted as string
 * @param version The version to use.
 */
private void formatCookieAsVer(final StringBuffer buffer, final Cookie cookie, int version) {
    String value = cookie.getValue();
    if (value == null) {
        value = "";
    }
    formatParam(buffer, new NameValuePair(cookie.getName(), value), version);
    if ((cookie.getPath() != null) && cookie.isPathAttributeSpecified()) {
      buffer.append("; ");
      formatParam(buffer, new NameValuePair("$Path", cookie.getPath()), version);
    }
    if ((cookie.getDomain() != null) 
        && cookie.isDomainAttributeSpecified()) {
        buffer.append("; ");
        formatParam(buffer, new NameValuePair("$Domain", cookie.getDomain()), version);
    }
}
 
開發者ID:jenkinsci,項目名稱:lib-commons-httpclient,代碼行數:24,代碼來源:RFC2109Spec.java

示例3: cookiesAsString

import org.apache.commons.httpclient.Cookie; //導入方法依賴的package包/類
private String cookiesAsString()
{
    String result = "[";
    for(Cookie c: this.cookies)
    {
        result = c.getName()+":"+c.getValue();
    }
    result += "]";
    return result;
}
 
開發者ID:goldmansachs,項目名稱:jrpip,代碼行數:11,代碼來源:ThankYouWriter.java

示例4: getCookieStrings

import org.apache.commons.httpclient.Cookie; //導入方法依賴的package包/類
public Vector<String> getCookieStrings() {
	// Use the HandleCookie Property of the transaction to return or not the cookies.
	//
	// We noticed a Bug in tomcat when too much cookies where set in the response to the client. This causes a 
	// IndexOutOfBoundException:  4096 in coyote.
	// To overcome this situation, now you can configure HandleCookies to false in the transaction to prevent cookies to be reflected
	// to the client.
	if (requestedObject instanceof AbstractHttpTransaction ) {
		if (!((AbstractHttpTransaction)requestedObject).isHandleCookie())
			return new Vector<String>();
	}
	
	Vector<String> cookies = new Vector<String>();
	if (httpState != null) {
		Cookie[] httpCookies = httpState.getCookies();
		int len = httpCookies.length;
		Cookie cookie = null;
		String sCookie;
		
		DateFormat df = new SimpleDateFormat("EEE, dd-MMM-yyyy HH:mm:ss z", Locale.US);
		df.setTimeZone(TimeZone.getTimeZone("GMT"));
		for (int i=0; i<len; i++) {
			cookie = httpCookies[i];
			sCookie = 	cookie.getName() + "=" + cookie.getValue() + ";";
			sCookie +=	(cookie.getExpiryDate() != null) ? "expires=" + df.format(cookie.getExpiryDate())+ ";":"";
			sCookie +=	"path=" + cookie.getPath() + ";";
			sCookie +=	"domain=" + cookie.getDomain() + ";";
			sCookie +=	cookie.getSecure() ? "secure": "";
			cookies.add(sCookie);
		}
	}
	return cookies;
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:34,代碼來源:Context.java

示例5: formatCookie

import org.apache.commons.httpclient.Cookie; //導入方法依賴的package包/類
public static String formatCookie(Cookie cookie) {
	StringBuffer buf = new StringBuffer();
	Date d = cookie.getExpiryDate();
	String[][] datas = {
			// {"$Version",Integer.toString(cookie.getVersion())},
			{ cookie.getName(), cookie.getValue() }, { "$Domain", cookie.getDomain() },
			{ "$Path", cookie.getPath() }, { "$Secure", Boolean.toString(cookie.getSecure()) },
			{ "$Date", d == null ? "null" : DateFormat.getDateTimeInstance().format(d) } };
	buf.append(datas[0][0] + "=" + datas[0][1]);
	for (int i = 1; i < datas.length; i++) {
		if (datas[i][1] != null)
			buf.append("; " + datas[i][0] + "=" + datas[i][1]);
	}
	return buf.toString();
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:16,代碼來源:CookiesUtils.java

示例6: formatCookie

import org.apache.commons.httpclient.Cookie; //導入方法依賴的package包/類
/**
 * Return a string suitable for sending in a <tt>"Cookie"</tt> header
 * @param cookie a {@link Cookie} to be formatted as string
 * @return a string suitable for sending in a <tt>"Cookie"</tt> header.
 */
public String formatCookie(Cookie cookie) {
    LOG.trace("enter CookieSpecBase.formatCookie(Cookie)");
    if (cookie == null) {
        throw new IllegalArgumentException("Cookie may not be null");
    }
    StringBuffer buf = new StringBuffer();
    buf.append(cookie.getName());
    buf.append("=");
    String s = cookie.getValue();
    if (s != null) {
        buf.append(s);
    }
    return buf.toString();
}
 
開發者ID:jenkinsci,項目名稱:lib-commons-httpclient,代碼行數:20,代碼來源:CookieSpecBase.java


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