How to write a ruby script to handle http messages (server side)

  • Thread starter Tessy Katsiampa
  • Start date
T

Tessy Katsiampa

hello all,

I used HttpUrlConnection & AsyncTask classes in Android to perform an HTTP GET and POST request in order to upload and download an image to/from a server correspondingly. I must write a Ruby script on server side to handle these requests. I managed to authenticate the user but i don't know how to store and send the image on/from the server to the Android application and also how to create a folder containing all the user data (images) on server side. Could anyone please help me with that part? I have attached the code in Ruby that i managed to write:

require 'rubygems'
require 'sinatra'

use Rack::Auth::Basic, "Restricted Area" do |username,password|
username=='user' and password=='user1'
end

get '/' do

end

post '/' do
end



ps:the only thing that my script needs to do is to store the image from theHTTP POST request,that the android application will perform and then to send this image back to the android application when the user performs a HTTPGET request

Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top