private MultipartPart(String fieldName, String fileName, String contentType, Object content) { this.fieldName = fieldName; this.fileName = fileName; this.contentType = contentType != null ? contentType : ContentTypes.TEXT.getAt(0); this.content = content; }
public static ContentTypes fromValue(final String value) { for (ContentTypes type : ContentTypes.values()) { if (type.values.contains(value)) { return type; } } return null; }
private MultipartPart(String fieldName, String fileName, String contentType, Object content) { this.fieldName = fieldName; this.fileName = fileName; this.contentType = contentType != null ? contentType : ContentTypes.TEXT.getAt(0); this.content = content; }
public static ContentTypes fromValue(final String value) { for (ContentTypes type : ContentTypes.values()) { if (type.values.contains(value)) { return type; } } return null; }
private MultipartPart(String fieldName, String fileName, String contentType, Object content) { this.fieldName = fieldName; this.fileName = fileName; this.contentType = contentType != null ? contentType : ContentTypes.TEXT.getAt(0); this.content = content; }
public static ContentTypes fromValue(final String value) { for (ContentTypes type : ContentTypes.values()) { if (type.values.contains(value)) { return type; } } return null; }
/** * Downloads the content to a temporary file (*.tmp in the system temp directory). * * @param config the `HttpConfig` instance */ public static void toTempFile(final HttpConfig config) { toTempFile(config, ContentTypes.ANY.getAt(0)); }
/** * Downloads the content into an `OutputStream`. * * @param config the `HttpConfig` instance * @param ostream the `OutputStream` to contain the content. */ public static void toStream(final HttpConfig config, final OutputStream ostream) { toStream(config, ContentTypes.ANY.getAt(0), ostream); }
/** * Downloads the content into an `OutputStream`. * * @param config the `HttpConfig` instance * @param ostream the `OutputStream` to contain the content. */ public static void toStream(final HttpConfig config, final OutputStream ostream) { toStream(config, ContentTypes.ANY.getAt(0), ostream); }
/** * Downloads the content to a temporary file (*.tmp in the system temp directory). * * @param config the `HttpConfig` instance */ public static void toTempFile(final HttpConfig config) { toTempFile(config, ContentTypes.ANY.getAt(0)); }
/** * Downloads the content to a specified file. * * @param config the `HttpConfig` instance * @param file the file where content will be downloaded */ public static void toFile(final HttpConfig config, final File file) { toFile(config, ContentTypes.ANY.getAt(0), file); }
/** * Downloads the content to a specified file. * * @param config the `HttpConfig` instance * @param file the file where content will be downloaded */ public static void toFile(final HttpConfig config, final File file) { toFile(config, ContentTypes.ANY.getAt(0), file); }
/** * Downloads the content to a temporary file (*.tmp in the system temp directory). * * @param config the `HttpConfig` instance */ public static void toTempFile(final HttpConfig config) { toTempFile(config, ContentTypes.ANY.getAt(0)); }
/** * Downloads the content to a specified file. * * @param config the `HttpConfig` instance * @param file the file where content will be downloaded */ public static void toFile(final HttpConfig config, final File file) { toFile(config, ContentTypes.ANY.getAt(0), file); }
/** * Configures a field part with the given field name and value. * * @param fieldName the field name * @param value the value * @return a reference to this {@link MultipartContent} instance */ public MultipartContent part(String fieldName, String value) { return part(fieldName, null, ContentTypes.TEXT.getAt(0), value); }
/** * Configures a field part with the given field name and value. * * @param fieldName the field name * @param value the value * @return a reference to this {@link MultipartContent} instance */ public MultipartContent part(String fieldName, String value) { return part(fieldName, null, ContentTypes.TEXT.getAt(0), value); }
/** * Downloads the content into an `OutputStream`. * * @param config the `HttpConfig` instance * @param ostream the `OutputStream` to contain the content. */ public static void toStream(final HttpConfig config, final OutputStream ostream) { toStream(config, ContentTypes.ANY.getAt(0), ostream); }
/** * Configures a field part with the given field name and value. * * @param fieldName the field name * @param value the value * @return a reference to this {@link MultipartContent} instance */ public MultipartContent part(String fieldName, String value) { return part(fieldName, null, ContentTypes.TEXT.getAt(0), value); }
default Object actualContext(final String contentType, final Object id) { final Map.Entry<String, Object> key = new AbstractMap.SimpleImmutableEntry<>(contentType, id); final Map.Entry<String, Object> anyKey = new AbstractMap.SimpleImmutableEntry<>(ContentTypes.ANY.getAt(0), id); final Function<ChainedHttpConfig, Object> theValue = (config) -> { Object ctx = config.getContextMap().get(key); if (ctx != null) { return ctx; } else { return config.getContextMap().get(anyKey); } }; return traverse(this, ChainedHttpConfig::getParent, theValue, Traverser::notNull); }
default Object actualContext(final String contentType, final Object id) { final Map.Entry<String, Object> key = new AbstractMap.SimpleImmutableEntry<>(contentType, id); final Map.Entry<String, Object> anyKey = new AbstractMap.SimpleImmutableEntry<>(ContentTypes.ANY.getAt(0), id); final Function<ChainedHttpConfig, Object> theValue = (config) -> { Object ctx = config.getContextMap().get(key); if (ctx != null) { return ctx; } else { return config.getContextMap().get(anyKey); } }; return traverse(this, ChainedHttpConfig::getParent, theValue, Traverser::notNull); }