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

  • Thread starter Tessy Katsiampa
  • Start date

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'

get '/' do


post '/' do

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

Forum statistics

Latest member

Latest Threads