Class MultipartSupport
java.lang.Object
ru.vyarus.dropwizard.guice.test.client.builder.util.conf.MultipartSupport
Build multipart form. Requires 'org.glassfish.jersey.media:jersey-media-multipart' dependency.
- Since:
- 15.09.2025
-
Method Summary
Modifier and TypeMethodDescriptionstatic jakarta.ws.rs.client.Entity<?>buildMultipart(Map<String, Object> formParams, @Nullable DateFormat dateFormat, @Nullable DateTimeFormatter dateTimeFormat) Build a multipart form entity from parameters.static @Nullable StringreadFilename(jakarta.ws.rs.core.Response response) static StringreadFilename(String header)
-
Method Details
-
buildMultipart
public static jakarta.ws.rs.client.Entity<?> buildMultipart(Map<String, Object> formParams, @Nullable DateFormat dateFormat, @Nullable DateTimeFormatter dateTimeFormat) Build a multipart form entity from parameters. AnyBodyPartvalue used as-is (e.g. manually constructedFormDataBodyPart). File could be specified asFileorInputStream. All other values are converted to string.String conversion specifics:
- Date fields string conversion could be customized with date formatters (one for java.util and other for java.time api).
- Null values converted to ""
- First level collection assumed to be a multi-value. Underlying collections are converted to strings.
- By default, call toString on a provided object
- Parameters:
formParams- form parametersdateFormat- java.util dates formatterdateTimeFormat- java.time dates formatter- Returns:
- form multipart entity
-
readFilename
- Parameters:
response- response object- Returns:
- file name from content-disposition header or null if header not found
-
readFilename
- Parameters:
header- content-disposition header- Returns:
- filename from content-disposition header
-