Android Question question about httputils2/httprequest

hypergreatthing

Member
Licensed User
Longtime User
Long story short, i'm writing to write a class to be able to put and get files from a s3 bucket.
Part of the amazon s3 documentation describes http put requests to be like this:
PUT /ObjectName HTTP/1.1

I don't really see a way to do that using httprequest. I only see methods to add headers.
Is there a quick work around with reflection? I used tpacketCapture and see the put request in the following format:
PUT / HTTP/1.1
Date: Thursday, 27 February 2014 19:53:17
Authorization: AWS AKIAJX5FT77CS5VLAYEA:nKnPBlnRTdqI+ey2SMk+IHjM6G2T16aYIpIO5ynolgc=

the error i get is method not allowed. When doing some looking into it, they mentioned the PUT header not being correct as the documentation suggests it should be like.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

hypergreatthing

Member
Licensed User
Longtime User
HttpClient supports put request. The request should be initialized with InitializePut instead of InitializePost.

You can also use HttpUtils2. However it requires a simple change in the code.

Instead of usin HttpUtils2 library, you should download the code and copy PostBytes (or any of the other Post methods) and create a Put method.
http://www.b4x.com/android/forum/threads/httputils2-web-services-are-now-even-simpler.18992/
I am using the code module of httpjob.
It's my understanding that the module creates a httprequest object called req and initializes it with either a post, get, put, delete or a head method.
My question is basically, when the httprequest object is initalized with initalizeput or initializeput2, the first line of the request says for example: "PUT / HTTP/1.1".
The other variables in the request are set by using req.setheader. But i can't find a method to change the action type of the request to be custom, like "PUT /##ObjectName## HTTP/1.1" where the ##ObjectName## is a variable as indicated by the amazon aws docs.
reference: http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html
 
Upvote 0

Gentry

Member
Licensed User
Longtime User
Any chance that PUT (and maybe PATCH and DELETE) will be included in the baseline library?
 
Upvote 0
Top