Example usage for org.apache.http.util Args notBlank

List of usage examples for org.apache.http.util Args notBlank

Introduction

In this page you can find the example usage for org.apache.http.util Args notBlank.

Prototype

public static <T extends CharSequence> T notBlank(T t, String str) 

Source Link

Usage

From source file:org.zalando.stups.tokens.util.Objects.java

public static <T extends CharSequence> T notBlank(String name, T argument) {
    return Args.notBlank(argument, name);
}

From source file:org.zalando.stups.tokens.FileSupplier.java

FileSupplier(final String filename) {
    this.filename = Args.notBlank(filename, "filename");
}

From source file:com.wudaosoft.net.httpclient.FileResponseHandler.java

public FileResponseHandler(final String dir) {
    this.dir = new File(Args.notBlank(dir, "dir"));
    Args.check(this.dir.isDirectory(), "dir must be a directory");
}

From source file:com.messagemedia.restapi.client.v1.internal.RestRequestBuilder.java

private RestRequestBuilder(String endpoint, String path, HttpMethod method, RestClient client) {

    Args.notBlank(path, "path");
    Args.notNull(method, "method");
    Args.notNull(client, "client");
    Args.notBlank(endpoint, "endpoint");

    try {//from www.ja  v a2 s  . com
        this.uriBuilder = new URIBuilder(endpoint);
    } catch (URISyntaxException e) {
        throw new IllegalArgumentException(e);
    }

    this.path = path;
    this.client = client;
    this.method = method;
    this.headers = new HashMap<String, String>();
}

From source file:nl.nn.adapterframework.http.mime.MultipartEntityBuilder.java

public MultipartEntityBuilder setMimeSubtype(String subType) {
    Args.notBlank(subType, "MIME subtype");
    this.contentType = ContentType.create("multipart/" + subType);
    return this;
}

From source file:me.ixfan.wechatkit.user.UserManager.java

/**
 * ?? UnionId ?????UnionId ?//  w w  w.  j  a  va2  s.co  m
 *
 * @param openId  OpenId
 * @param lang zh_CN zh_TW ?en  zh_CN
 * @return {@link WeChatFollower}
 * @throws WeChatApiErrorException API??
 */
public WeChatFollower getUserInfo(final String openId, String lang) throws WeChatApiErrorException {
    Args.notBlank(openId, "OpenId");
    if (TextUtils.isBlank(lang)) {
        lang = "zh_CN";
    }
    Args.check(lang.equals("zh_CN") || lang.equals("zh_TW") || lang.equals("en"),
            "'lang' ? zh_CN, zh_TW  en.");

    final String url = WeChatConstants.WECHAT_GET_USER_INFO
            .replace("${ACCESS_TOKEN}", super.tokenManager.getAccessToken()).replace("${OPENID}", openId)
            .replace("${LANG}", lang);
    JsonObject jsonResponse;
    try {
        jsonResponse = HttpClientUtil.sendGetRequestAndGetJsonResponse(url);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

    if (jsonResponse.has("subscribe")) {
        return WeChatFollower.fromJson(jsonResponse);
    } else {
        throw new WeChatApiErrorException(jsonResponse.get("errcode").getAsInt(),
                jsonResponse.get("errmsg").getAsString());
    }
}

From source file:cn.aage.robot.http.entity.ContentType.java

/**
 * Creates a new instance of {@link ContentType}.
 *
 * @param mimeType MIME type. It may not be <code>null</code> or empty. It may not contain
 *                 characters <">, <;>, <,> reserved by the HTTP specification.
 * @param charset  charset./*  ww  w  .j av  a 2  s .c  o  m*/
 * @return content type
 */
public static ContentType create(final String mimeType, final Charset charset) {
    final String type = Args.notBlank(mimeType, "MIME type").toLowerCase(Locale.ENGLISH);
    Args.check(valid(type), "MIME type may not contain reserved characters");
    return new ContentType(type, charset);
}