Class: VpimServlet

Inherits:
WEBrick::HTTPServlet::AbstractServlet
  • Object
show all
Defined in:
lib/vpim/agent/main.rb,
lib/vpim/agent/scraps.rb

Instance Method Summary collapse

Instance Method Details

#do_GET(req, resp) ⇒ Object

Raises:

  • (WEBrick::HTTPStatus::OK)


283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/vpim/agent/main.rb', line 283

def do_GET(req, resp)
  body = <<"EOF"
<h1>#{$vpim_title}</h1>

See:
<ul>
EOF

  $stuff.each do |name,path,protocol|
    #body << "<li><a href=\"#{protocol}://#{$host}:#{$port}#{path}\">#{name}</a>\n"
    #
    # $host is wrong, it lacks the domain - we should derive this from how
    # we are called, or just leave it out.
    body << "<li><a href=\"#{path}\">#{name}</a>\n"
  end

  body << "</ul>\n"

  resp.body = body
  resp['content-type'] = 'text/html'
  raise WEBrick::HTTPStatus::OK
end