[Java] Sync jersey2 jersey3 template (#18281)

* sync jersey2 and 3 templates

* add deprecated

* update samples
This commit is contained in:
William Cheng
2024-04-03 16:32:39 +08:00
committed by GitHub
parent 2934f5ac51
commit 88204b247a
27 changed files with 312 additions and 434 deletions

View File

@@ -807,7 +807,7 @@ public class ApiClient extends JavaTimeFormatter {
File file = (File) param.getValue();
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey())
.fileName(file.getName()).size(file.length()).build();
// Attempt to probe the content type for the file so that the form part is more correctly
// and precisely identified, but fall back to application/octet-stream if that fails.
MediaType type;
@@ -816,7 +816,7 @@ public class ApiClient extends JavaTimeFormatter {
} catch (IOException | IllegalArgumentException e) {
type = MediaType.APPLICATION_OCTET_STREAM_TYPE;
}
multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, type));
} else {
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build();