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


Java Args.notEmpty方法代码示例

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


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

示例1: formatCookies

import org.apache.http.util.Args; //导入方法依赖的package包/类
public List<Header> formatCookies(final List<Cookie> cookies) {
    Args.notEmpty(cookies, "List of cookies");
    final CharArrayBuffer buffer = new CharArrayBuffer(20 * cookies.size());
    buffer.append(SM.COOKIE);
    buffer.append(": ");
    for (int i = 0; i < cookies.size(); i++) {
        final Cookie cookie = cookies.get(i);
        if (i > 0) {
            buffer.append("; ");
        }
        buffer.append(cookie.getName());
        final String s = cookie.getValue();
        if (s != null) {
            buffer.append("=");
            buffer.append(s);
        }
    }
    final List<Header> headers = new ArrayList<Header>(1);
    headers.add(new BufferedHeader(buffer));
    return headers;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:22,代码来源:NetscapeDraftSpecHC4.java

示例2: formatCookies

import org.apache.http.util.Args; //导入方法依赖的package包/类
public List<Header> formatCookies(final List<Cookie> cookies) {
    Args.notEmpty(cookies, "List of cookies");
    List<Cookie> cookieList;
    if (cookies.size() > 1) {
        // Create a mutable copy and sort the copy.
        cookieList = new ArrayList<Cookie>(cookies);
        Collections.sort(cookieList, PATH_COMPARATOR);
    } else {
        cookieList = cookies;
    }
    if (this.oneHeader) {
        return doFormatOneHeader(cookieList);
    } else {
        return doFormatManyHeaders(cookieList);
    }
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:17,代码来源:RFC2109SpecHC4.java

示例3: setServiceData

import org.apache.http.util.Args; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @throws IllegalArgumentException {@inheritDoc}
 */
@Override
public RestRootEntity<ServiceData> setServiceData(@Nonnull String instanceId,
                                                  @Nonnull Map<String, Object> parameters) {
    instanceId = Args.notNull(instanceId, "Instance id (instanceId)");
    parameters = Args.notNull(parameters, "Variables (parameters)");
    Args.notEmpty(parameters.keySet(), "Parameters names");
    Args.notEmpty(parameters.values(), "Parameters values");

    Gson gson = new GsonBuilder().setDateFormat(DATE_TIME_FORMAT).create();
    String params = gson.toJson(parameters);


    URI uri = new SafeUriBuilder(rootUri).addPath(instanceId).addParameter(ACTION, ACTION_SET_DATA)
            .addParameter(PARAMS, params).build();

    return makePost(httpClient, httpContext, uri, new TypeToken<RestRootEntity<ServiceData>>() {});
}
 
开发者ID:egetman,项目名称:ibm-bpm-rest-client,代码行数:23,代码来源:ServiceClientImpl.java

示例4: setTaskData

import org.apache.http.util.Args; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @throws IllegalArgumentException {@inheritDoc}
 */
@Override
public RestRootEntity<ServiceData> setTaskData(@Nonnull String tkiid, @Nonnull Map<String, Object> parameters) {
    tkiid = Args.notNull(tkiid, "Task id (tkiid)");
    parameters = Args.notNull(parameters, "Variables (parameters)");
    Args.notEmpty(parameters.keySet(), "Parameters names");
    Args.notEmpty(parameters.values(), "Parameters values");

    Gson gson = new GsonBuilder().setDateFormat(DATE_TIME_FORMAT).create();
    String params = gson.toJson(parameters);

    URI uri = new SafeUriBuilder(rootUri).addPath(tkiid).addParameter(ACTION, ACTION_SET_DATA)
            .addParameter(PARAMS, params).build();

    return makePost(httpClient, httpContext, uri, new TypeToken<RestRootEntity<ServiceData>>() {});
}
 
开发者ID:egetman,项目名称:ibm-bpm-rest-client,代码行数:21,代码来源:TaskClientImpl.java

示例5: formatCookies

import org.apache.http.util.Args; //导入方法依赖的package包/类
@Override
public List<Header> formatCookies(final List<Cookie> cookies) {
    Args.notEmpty(cookies, "List of cookies");
    final CharArrayBuffer buffer = new CharArrayBuffer(20 * cookies.size());
    buffer.append(SM.COOKIE);
    buffer.append(": ");
    for (int i = 0; i < cookies.size(); i++) {
        final Cookie cookie = cookies.get(i);
        if (i > 0) {
            buffer.append("; ");
        }
        buffer.append(cookie.getName());
        final String s = cookie.getValue();
        if (s != null) {
            buffer.append("=");
            buffer.append(s);
        }
    }
    final List<Header> headers = new ArrayList<Header>(1);
    headers.add(new BufferedHeader(buffer));
    return headers;
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:23,代码来源:NetscapeDraftSpec.java

示例6: formatCookies

import org.apache.http.util.Args; //导入方法依赖的package包/类
@Override
public List<Header> formatCookies(final List<Cookie> cookies) {
    Args.notEmpty(cookies, "List of cookies");
    List<Cookie> cookieList;
    if (cookies.size() > 1) {
        // Create a mutable copy and sort the copy.
        cookieList = new ArrayList<Cookie>(cookies);
        Collections.sort(cookieList, CookiePathComparator.INSTANCE);
    } else {
        cookieList = cookies;
    }
    if (this.oneHeader) {
        return doFormatOneHeader(cookieList);
    } else {
        return doFormatManyHeaders(cookieList);
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:18,代码来源:RFC2109Spec.java

示例7: getParameter

import org.apache.http.util.Args; //导入方法依赖的package包/类
/**
 * @since 4.3
 */
public String getParameter(final String name) {
    Args.notEmpty(name, "Parameter name");
    if (this.params == null) {
        return null;
    }
    for (final NameValuePair param: this.params) {
        if (param.getName().equalsIgnoreCase(name)) {
            return param.getValue();
        }
    }
    return null;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:16,代码来源:ContentType.java

示例8: formatCookies

import org.apache.http.util.Args; //导入方法依赖的package包/类
public List<Header> formatCookies(final List<Cookie> cookies) {
    Args.notEmpty(cookies, "List of cookies");
    final CharArrayBuffer buffer = new CharArrayBuffer(20 * cookies.size());
    buffer.append(SM.COOKIE);
    buffer.append(": ");
    for (int i = 0; i < cookies.size(); i++) {
        final Cookie cookie = cookies.get(i);
        if (i > 0) {
            buffer.append("; ");
        }
        final String cookieName = cookie.getName();
        final String cookieValue = cookie.getValue();
        if (cookie.getVersion() > 0 && !isQuoteEnclosed(cookieValue)) {
            BasicHeaderValueFormatterHC4.INSTANCE.formatHeaderElement(
                    buffer,
                    new BasicHeaderElement(cookieName, cookieValue),
                    false);
        } else {
            // Netscape style cookies do not support quoted values
            buffer.append(cookieName);
            buffer.append("=");
            if (cookieValue != null) {
                buffer.append(cookieValue);
            }
        }
    }
    final List<Header> headers = new ArrayList<Header>(1);
    headers.add(new BufferedHeader(buffer));
    return headers;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:31,代码来源:BrowserCompatSpecHC4.java

示例9: formatCookies

import org.apache.http.util.Args; //导入方法依赖的package包/类
@Override
public List<Header> formatCookies(final List<Cookie> cookies) {
    Args.notEmpty(cookies, "List of cookies");
    final CharArrayBuffer buffer = new CharArrayBuffer(20 * cookies.size());
    buffer.append(SM.COOKIE);
    buffer.append(": ");
    for (int i = 0; i < cookies.size(); i++) {
        final Cookie cookie = cookies.get(i);
        if (i > 0) {
            buffer.append("; ");
        }
        final String cookieName = cookie.getName();
        final String cookieValue = cookie.getValue();
        if (cookie.getVersion() > 0 && !isQuoteEnclosed(cookieValue)) {
            BasicHeaderValueFormatter.INSTANCE.formatHeaderElement(
                    buffer,
                    new BasicHeaderElement(cookieName, cookieValue),
                    false);
        } else {
            // Netscape style cookies do not support quoted values
            buffer.append(cookieName);
            buffer.append("=");
            if (cookieValue != null) {
                buffer.append(cookieValue);
            }
        }
    }
    final List<Header> headers = new ArrayList<Header>(1);
    headers.add(new BufferedHeader(buffer));
    return headers;
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:32,代码来源:BrowserCompatSpec.java

示例10: chooseProxy

import org.apache.http.util.Args; //导入方法依赖的package包/类
/**
 * Chooses a proxy from a list of available proxies.
 * The default implementation just picks the first non-SOCKS proxy
 * from the list. If there are only SOCKS proxies,
 * {@link Proxy#NO_PROXY Proxy.NO_PROXY} is returned.
 * Derived classes may implement more advanced strategies,
 * such as proxy rotation if there are multiple options.
 *
 * @param proxies   the list of proxies to choose from,
 *                  never {@code null} or empty
 * @param target    the planned target, never {@code null}
 * @param request   the request to be sent, never {@code null}
 * @param context   the context, or {@code null}
 *
 * @return  a proxy type
 */
protected Proxy chooseProxy(final List<Proxy> proxies,
                            final HttpHost    target,
                            final HttpRequest request,
                            final HttpContext context) {
    Args.notEmpty(proxies, "List of proxies");

    Proxy result = null;

    // check the list for one we can use
    for (int i=0; (result == null) && (i < proxies.size()); i++) {

        final Proxy p = proxies.get(i);
        switch (p.type()) {

        case DIRECT:
        case HTTP:
            result = p;
            break;

        case SOCKS:
            // SOCKS hosts are not handled on the route level.
            // The socket may make use of the SOCKS host though.
            break;
        }
    }

    if (result == null) {
        //@@@ log as warning or info that only a socks proxy is available?
        // result can only be null if all proxies are socks proxies
        // socks proxies are not handled on the route planning level
        result = Proxy.NO_PROXY;
    }

    return result;
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:52,代码来源:ProxySelectorRoutePlanner.java

示例11: register

import org.apache.http.util.Args; //导入方法依赖的package包/类
public RegistryBuilder<I> register(final String id, final I item) {
    Args.notEmpty(id, "ID");
    Args.notNull(item, "Item");
    items.put(id.toLowerCase(Locale.US), item);
    return this;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:7,代码来源:RegistryBuilder.java

示例12: formatCookies

import org.apache.http.util.Args; //导入方法依赖的package包/类
@Override
public List<Header> formatCookies(final List<Cookie> cookies) {
    Args.notEmpty(cookies, "List of cookies");
    final List<? extends Cookie> sortedCookies;
    if (cookies.size() > 1) {
        // Create a mutable copy and sort the copy.
        sortedCookies = new ArrayList<Cookie>(cookies);
        Collections.sort(sortedCookies, CookiePriorityComparator.INSTANCE);
    } else {
        sortedCookies = cookies;
    }
    final CharArrayBuffer buffer = new CharArrayBuffer(20 * sortedCookies.size());
    buffer.append(SM.COOKIE);
    buffer.append(": ");
    for (int n = 0; n < sortedCookies.size(); n++) {
        final Cookie cookie = sortedCookies.get(n);
        if (n > 0) {
            buffer.append(PARAM_DELIMITER);
            buffer.append(' ');
        }
        buffer.append(cookie.getName());
        final String s = cookie.getValue();
        if (s != null) {
            buffer.append(EQUAL_CHAR);
            if (containsSpecialChar(s)) {
                buffer.append(DQUOTE_CHAR);
                for (int i = 0; i < s.length(); i++) {
                    final char ch = s.charAt(i);
                    if (ch == DQUOTE_CHAR || ch == ESCAPE_CHAR) {
                        buffer.append(ESCAPE_CHAR);
                    }
                    buffer.append(ch);
                }
                buffer.append(DQUOTE_CHAR);
            } else {
                buffer.append(s);
            }
        }
    }
    final List<Header> headers = new ArrayList<Header>(1);
    headers.add(new BufferedHeader(buffer));
    return headers;
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:44,代码来源:RFC6265CookieSpec.java

示例13: update

import org.apache.http.util.Args; //导入方法依赖的package包/类
/**
 * Updates the auth state with a queue of {@link AuthOption}s.
 *
 * @param authOptions a queue of auth options. May not be null or empty.
 *
 * @since 4.2
 */
public void update(final Queue<AuthOption> authOptions) {
    Args.notEmpty(authOptions, "Queue of auth options");
    this.authOptions = authOptions;
    this.authScheme = null;
    this.credentials = null;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:14,代码来源:AuthStateHC4.java


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