/** * Construct an Elasticsearch endpoint from the provided index, type and * id. * @param index - required; name of Elasticsearch index * @param type - optional; name of Elasticsearch type * @param id - optional; Elasticsearch document ID * @return the index, type and id concatenated with '/'. */ static String getEndpoint(String index, String type, String id) { requireNonNull(index); notBlank(index, "index"); StringBuilder sb = new StringBuilder(); sb.append("/").append(index); if (!(type == null || type.isEmpty())) { sb.append("/").append(type); } if (!(id == null || id.isEmpty())) { sb.append("/").append(id); } return sb.toString(); }
/** * @since 4.4 */ public MultipartEntityBuilder setMimeSubtype(final String subType) { Args.notBlank(subType, "MIME subtype"); this.contentType = ContentType.create("multipart/" + subType); return this; }
/** * @since 4.4 */ public MultipartEntityBuilder setMimeSubtype(final String subType) { Args.notBlank(subType, "MIME subtype"); this.contentType = ContentType.create("multipart/" + subType); return this; }
InternalHttpRequest(final String method, final URI requestURI) { Args.notBlank(method, "Method"); Args.notNull(requestURI, "Request URI"); this.method = method; this.uri = requestURI; this.aborted = new AtomicBoolean(false); this.cancellableRef = new AtomicReference<Cancellable>(null); }
InternalHttpRequest(final String method, final URI requestURI) { Args.notBlank(method, "Method"); Args.notNull(requestURI, "Request URI"); this.method = method; this.uri = requestURI; this.aborted = new AtomicBoolean(false); this.cancellableRef = new AtomicReference<Cancellable>(null); }
public static RequestBuilder create(final String method) { Args.notBlank(method, "HTTP method"); return new RequestBuilder(method); }
public static RequestBuilder create(final String method) { Args.notBlank(method, "HTTP method"); return new RequestBuilder(method); }
public static RequestBuilder create(final String method) { Args.notBlank(method, "HTTP method"); return new RequestBuilder(method); }
public static RequestBuilder create(final String method) { Args.notBlank(method, "HTTP method"); return new RequestBuilder(method); }
public static HttpRequestBuilder create(final String method) { Args.notBlank(method, "HTTP method"); return new HttpRequestBuilder(method); }
public static RequestBuilder create(final String method) { Args.notBlank(method, "HTTP method"); return new RequestBuilder(method); }
public static RequestBuilder create(final String method) { Args.notBlank(method, "HTTP method"); return new RequestBuilder(method); }
public static RequestBuilder create(final String method) { Args.notBlank(method, "HTTP method"); return new RequestBuilder(method); }
/** * 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. * @return content type */ public static ContentType create(final String mimeType, final Charset charset) { final String type = Args.notBlank(mimeType, "MIME type").toLowerCase(Locale.US); Args.check(valid(type), "MIME type may not contain reserved characters"); return new ContentType(type, charset); }
/** * Creates a new instance of {@link ContentType}. * * @param mimeType MIME type. It may not be {@code null} or empty. It may not contain * characters {@code <">, <;>, <,>} reserved by the HTTP specification. * @param charset charset. * @return content type */ public static ContentType create(final String mimeType, final Charset charset) { final String type = Args.notBlank(mimeType, "MIME type").toLowerCase(Locale.ROOT); Args.check(valid(type), "MIME type may not contain reserved characters"); return new ContentType(type, charset); }
/** * 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. * @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); }
/** * Creates a new instance of {@link ContentType}. * * @param mimeType MIME type. It may not be {@code null} or empty. It may not contain * characters {@code <">, <;>, <,>} reserved by the HTTP specification. * @param charset charset. * @return content type */ public static ContentType create(final String mimeType, final Charset charset) { final String normalizedMimeType = Args.notBlank(mimeType, "MIME type").toLowerCase(Locale.ROOT); Args.check(valid(normalizedMimeType), "MIME type may not contain reserved characters"); return new ContentType(normalizedMimeType, charset); }
public CookieOrigin(final String host, final int port, final String path, final boolean secure) { super(); Args.notBlank(host, "Host"); Args.notNegative(port, "Port"); Args.notNull(path, "Path"); this.host = host.toLowerCase(Locale.ROOT); this.port = port; if (!TextUtils.isBlank(path)) { this.path = path; } else { this.path = "/"; } this.secure = secure; }
/** * Creates a new instance of {@link ContentType}. * * @param mimeType MIME type. It may not be {@code null} or empty. It may not contain * characters {@code <">, <;>, <,>} reserved by the HTTP specification. * @param charset charset. * @return content type */ public static ContentType create(final String mimeType, final Charset charset) { final String type = Args.notBlank(mimeType, "MIME type").toLowerCase(Locale.ROOT); Args.check(valid(type), "MIME type may not contain reserved characters"); return new ContentType(type, charset); }
/** * Creates a new instance of {@link ContentType}. * * @param mimeType MIME type. It may not be {@code null} or empty. It may not contain * characters {@code <">, <;>, <,>} reserved by the HTTP specification. * @param charset charset. * @return content type */ public static ContentType create(final String mimeType, final Charset charset) { final String type = Args.notBlank(mimeType, "MIME type").toLowerCase(Locale.ROOT); Args.check(valid(type), "MIME type may not contain reserved characters"); return new ContentType(type, charset); }