0

我目前正在使用 AWS 推荐的使用预签名 URL 上传到 S3 存储桶的方法,此处详细介绍

// Create the connection and use it to upload the new object using the pre-signed URL.

HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("PUT");
OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());
out.write("This text uploaded as an object via presigned URL.");
out.close();

// Check the HTTP response code. To complete the upload and make the object available, 
// you must interact with the connection object in some way.

connection.getResponseCode();
System.out.println("HTTP response code: " + connection.getResponseCode());

我想改为使用 Http4k 来执行此操作。这个工具包可以实现这样的功能吗?如果是这样,有人可以指导我正确的方向吗?

4

0 回答 0