#!/usr/bin/env ruby
require 'bundler/setup'
require 'webmachine'
class Resource < Webmachine::Resource
def resource_exists?
false
end
def encodings_provided
{ 'gzip' => :encode_gzip,
'deflate' => :encode_deflate,
'identity' => :encode_identity }
end
def to_html
"Hello"
end
end
Webmachine.application.routes do
add_route ['*'], Resource
end
Webmachine.run
This is the reply
HTTP/1.1 404 Not Found
Content-Type: text/html
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 213
Date: Sat, 04 Jan 2014 22:48:04 GMT
Server: Webmachine-Ruby/1.2.1 WEBrick/1.3.1 (Ruby/2.1.0/2013-12-25)
Connection: Keep-Alive
<!DOCTYPE html><html> <head><title>404 Not Found</title></head> <body><h1>404 Not Found</h1><p>The requested document was not found on this server.</p> <address>Webmachine-Ruby/1.2.1 server</address></body></html>