Lets Post something..
..and create a Ruby / Webrick Webserver that receives post and gets in seconds:
require ‘webrick’ include WEBrick
class CurrentTimeServlet < WEBrick::HTTPServlet::AbstractServlet
def doGET(request, response) response[‘Content-Type’] = ‘text/plain’ response.status = 200 response.body = Time.now.tos + “\n” end
def do_POST(request, response) puts request.body end end
———————————————————————
Create an HTTP server
s = HTTPServer.new( :Port => 8000 )
s.mount(“/logreceiver”, CurrentTimeServlet)
When the server gets a control-C, kill it
trap(“INT”){ s.shutdown }
Start the server
s.start
0 TrackBacks
Listed below are links to blogs that reference this entry: Lets Post something...
TrackBack URL for this entry: http://www.innoq.com/mt4/mt-tb.cgi/2451
Leave a comment