I need to create a Java application that creates a PUT request formatted like this:
PUT /AccountId/vaults/VaultName HTTP/1.1
Host: glacier.Region.amazonaws.com
Date: Date
Authorization: SignatureValue
Content-Length: Length
x-amz-glacier-version: 2012-06-01
I'm pretty new to formatting requests so any help would be appreciated.The only thing that I have in my code is:
public static void main(String[] args) {
try {
URL url = new URL("http://glacier.us-east-1.amazonaws.com");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("PUT");
int code = con.getResponseCode();
System.out.print(code);
}
catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
As you can tell I'm pretty lost.