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


Java HeaderElement.getParameters方法代碼示例

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


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

示例1: parse

import org.apache.http.HeaderElement; //導入方法依賴的package包/類
protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin)
            throws MalformedCookieException {
    List<Cookie> cookies = new ArrayList<Cookie>(elems.length);
    for (HeaderElement headerelement : elems) {
        String name = headerelement.getName();
        String value = headerelement.getValue();
        if (name == null || name.length() == 0) {
            throw new MalformedCookieException("Cookie name may not be empty");
        }

        BasicClientCookie cookie = new BasicClientCookie(name, value);
        cookie.setPath(getDefaultPath(origin));
        cookie.setDomain(getDefaultDomain(origin));

        // cycle through the parameters
        NameValuePair[] attribs = headerelement.getParameters();
        for (int j = attribs.length - 1; j >= 0; j--) {
            NameValuePair attrib = attribs[j];
            String s = attrib.getName().toLowerCase(Locale.ENGLISH);

            cookie.setAttribute(s, attrib.getValue());

            CookieAttributeHandler handler = findAttribHandler(s);
            if (handler != null) {
                handler.parse(cookie, attrib.getValue());
            }
        }
        cookies.add(cookie);
    }
    return cookies;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:32,代碼來源:CookieSpecBase.java

示例2: parse

import org.apache.http.HeaderElement; //導入方法依賴的package包/類
protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin)
            throws MalformedCookieException {
    final List<Cookie> cookies = new ArrayList<Cookie>(elems.length);
    for (final HeaderElement headerelement : elems) {
        final String name = headerelement.getName();
        final String value = headerelement.getValue();
        if (name == null || name.length() == 0) {
            throw new MalformedCookieException("Cookie name may not be empty");
        }

        final BasicClientCookieHC4 cookie = new BasicClientCookieHC4(name, value);
        cookie.setPath(getDefaultPath(origin));
        cookie.setDomain(getDefaultDomain(origin));

        // cycle through the parameters
        final NameValuePair[] attribs = headerelement.getParameters();
        for (int j = attribs.length - 1; j >= 0; j--) {
            final NameValuePair attrib = attribs[j];
            final String s = attrib.getName().toLowerCase(Locale.ENGLISH);

            cookie.setAttribute(s, attrib.getValue());

            final CookieAttributeHandler handler = findAttribHandler(s);
            if (handler != null) {
                handler.parse(cookie, attrib.getValue());
            }
        }
        cookies.add(cookie);
    }
    return cookies;
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:32,代碼來源:CookieSpecBaseHC4.java

示例3: createCookieForHeaderElement

import org.apache.http.HeaderElement; //導入方法依賴的package包/類
/**
 *  This method will create a {@link BasicClientCookie} with the given {@link HeaderElement}.
 *  It sill set the cookie's name and value according to the {@link HeaderElement#getName()} and {@link HeaderElement#getValue()} methods.
 *  Moreover, it will transport every {@link HeaderElement} parameter to the cookie using the {@link BasicClientCookie#setAttribute(String, String)}.
 *  Additionally, it configures the cookie path ({@link BasicClientCookie#setPath(String)}) to value '/client/api' and the cookie domain using {@link #configureDomainForCookie(BasicClientCookie)} method.
 */
protected BasicClientCookie createCookieForHeaderElement(HeaderElement element) {
    BasicClientCookie cookie = new BasicClientCookie(element.getName(), element.getValue());
    for (NameValuePair parameter : element.getParameters()) {
        cookie.setAttribute(parameter.getName(), parameter.getValue());
    }
    cookie.setPath("/client/api");
    configureDomainForCookie(cookie);
    return cookie;
}
 
開發者ID:Autonomiccs,項目名稱:apache-cloudstack-java-client,代碼行數:16,代碼來源:ApacheCloudStackClient.java

示例4: parse

import org.apache.http.HeaderElement; //導入方法依賴的package包/類
protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin)
            throws MalformedCookieException {
    final List<Cookie> cookies = new ArrayList<Cookie>(elems.length);
    for (final HeaderElement headerelement : elems) {
        final String name = headerelement.getName();
        final String value = headerelement.getValue();
        if (name == null || name.isEmpty()) {
            continue;
        }

        final BasicClientCookie cookie = new BasicClientCookie(name, value);
        cookie.setPath(getDefaultPath(origin));
        cookie.setDomain(getDefaultDomain(origin));

        // cycle through the parameters
        final NameValuePair[] attribs = headerelement.getParameters();
        for (int j = attribs.length - 1; j >= 0; j--) {
            final NameValuePair attrib = attribs[j];
            final String s = attrib.getName().toLowerCase(Locale.ROOT);

            cookie.setAttribute(s, attrib.getValue());

            final CookieAttributeHandler handler = findAttribHandler(s);
            if (handler != null) {
                handler.parse(cookie, attrib.getValue());
            }
        }
        cookies.add(cookie);
    }
    return cookies;
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:32,代碼來源:CookieSpecBase.java

示例5: createCookies

import org.apache.http.HeaderElement; //導入方法依賴的package包/類
private List<Cookie> createCookies(
        final HeaderElement[] elems,
        final CookieOrigin origin) throws MalformedCookieException {
    List<Cookie> cookies = new ArrayList<Cookie>(elems.length);
    for (HeaderElement headerelement : elems) {
        String name = headerelement.getName();
        String value = headerelement.getValue();
        if (name == null || name.length() == 0) {
            throw new MalformedCookieException("Cookie name may not be empty");
        }

        BasicClientCookie2 cookie = new BasicClientCookie2(name, value);
        cookie.setPath(getDefaultPath(origin));
        cookie.setDomain(getDefaultDomain(origin));
        cookie.setPorts(new int [] { origin.getPort() });
        // cycle through the parameters
        NameValuePair[] attribs = headerelement.getParameters();

        // Eliminate duplicate attributes. The first occurrence takes precedence
        // See RFC2965: 3.2  Origin Server Role
        Map<String, NameValuePair> attribmap =
                new HashMap<String, NameValuePair>(attribs.length);
        for (int j = attribs.length - 1; j >= 0; j--) {
            NameValuePair param = attribs[j];
            attribmap.put(param.getName().toLowerCase(Locale.ENGLISH), param);
        }
        for (Map.Entry<String, NameValuePair> entry : attribmap.entrySet()) {
            NameValuePair attrib = entry.getValue();
            String s = attrib.getName().toLowerCase(Locale.ENGLISH);

            cookie.setAttribute(s, attrib.getValue());

            CookieAttributeHandler handler = findAttribHandler(s);
            if (handler != null) {
                handler.parse(cookie, attrib.getValue());
            }
        }
        cookies.add(cookie);
    }
    return cookies;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:42,代碼來源:RFC2965Spec.java

示例6: create

import org.apache.http.HeaderElement; //導入方法依賴的package包/類
private static ContentType create(final HeaderElement helem) {
    final String mimeType = helem.getName();
    final NameValuePair[] params = helem.getParameters();
    return new ContentType(mimeType, params != null && params.length > 0 ? params : null);
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:6,代碼來源:ContentType.java

示例7: createCookies

import org.apache.http.HeaderElement; //導入方法依賴的package包/類
private List<Cookie> createCookies(
        final HeaderElement[] elems,
        final CookieOrigin origin) throws MalformedCookieException {
    final List<Cookie> cookies = new ArrayList<Cookie>(elems.length);
    for (final HeaderElement headerelement : elems) {
        final String name = headerelement.getName();
        final String value = headerelement.getValue();
        if (name == null || name.length() == 0) {
            throw new MalformedCookieException("Cookie name may not be empty");
        }

        final BasicClientCookie2HC4 cookie = new BasicClientCookie2HC4(name, value);
        cookie.setPath(getDefaultPath(origin));
        cookie.setDomain(getDefaultDomain(origin));
        cookie.setPorts(new int [] { origin.getPort() });
        // cycle through the parameters
        final NameValuePair[] attribs = headerelement.getParameters();

        // Eliminate duplicate attributes. The first occurrence takes precedence
        // See RFC2965: 3.2  Origin Server Role
        final Map<String, NameValuePair> attribmap =
                new HashMap<String, NameValuePair>(attribs.length);
        for (int j = attribs.length - 1; j >= 0; j--) {
            final NameValuePair param = attribs[j];
            attribmap.put(param.getName().toLowerCase(Locale.ENGLISH), param);
        }
        for (final Map.Entry<String, NameValuePair> entry : attribmap.entrySet()) {
            final NameValuePair attrib = entry.getValue();
            final String s = attrib.getName().toLowerCase(Locale.ENGLISH);

            cookie.setAttribute(s, attrib.getValue());

            final CookieAttributeHandler handler = findAttribHandler(s);
            if (handler != null) {
                handler.parse(cookie, attrib.getValue());
            }
        }
        cookies.add(cookie);
    }
    return cookies;
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:42,代碼來源:RFC2965SpecHC4.java

示例8: createCookies

import org.apache.http.HeaderElement; //導入方法依賴的package包/類
private List<Cookie> createCookies(
        final HeaderElement[] elems,
        final CookieOrigin origin) throws MalformedCookieException {
    final List<Cookie> cookies = new ArrayList<Cookie>(elems.length);
    for (final HeaderElement headerelement : elems) {
        final String name = headerelement.getName();
        final String value = headerelement.getValue();
        if (name == null || name.isEmpty()) {
            throw new MalformedCookieException("Cookie name may not be empty");
        }

        final BasicClientCookie2 cookie = new BasicClientCookie2(name, value);
        cookie.setPath(getDefaultPath(origin));
        cookie.setDomain(getDefaultDomain(origin));
        cookie.setPorts(new int [] { origin.getPort() });
        // cycle through the parameters
        final NameValuePair[] attribs = headerelement.getParameters();

        // Eliminate duplicate attributes. The first occurrence takes precedence
        // See RFC2965: 3.2  Origin Server Role
        final Map<String, NameValuePair> attribmap =
                new HashMap<String, NameValuePair>(attribs.length);
        for (int j = attribs.length - 1; j >= 0; j--) {
            final NameValuePair param = attribs[j];
            attribmap.put(param.getName().toLowerCase(Locale.ROOT), param);
        }
        for (final Map.Entry<String, NameValuePair> entry : attribmap.entrySet()) {
            final NameValuePair attrib = entry.getValue();
            final String s = attrib.getName().toLowerCase(Locale.ROOT);

            cookie.setAttribute(s, attrib.getValue());

            final CookieAttributeHandler handler = findAttribHandler(s);
            if (handler != null) {
                handler.parse(cookie, attrib.getValue());
            }
        }
        cookies.add(cookie);
    }
    return cookies;
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:42,代碼來源:RFC2965Spec.java


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