I’m having trouble having WEBrick return XHTML to the browser - the browser renders the identical file with an ‘html’ extension perfectly but won’t render xhtml and its associated CSS stylesheet.
I’ve tried two things:
require ‘webrick’
def start_webrick(config = {})
config.update(:Port => 5000, :DocumentRoot => ‘/my_folder’)
server = WEBrick::HTTPServer.new(config)
yield server if block_given?
[‘INT’, ‘TERM’].each {|signal|
trap(signal) {server.shutdown}
}
server.start
end
start_webrick
And 2)
require ‘webrick’
WEBrick::HTTPUtils::DefaultMimeTypes[‘xhtml’] = ‘application/xhtml+xml’
var = File.read(‘/my_folder/index.xhtml’)
server = WEBrick::HTTPServer.new(:Port => 5000)
server.mount_proc(‘/’) {|request, response| response.body = var}
trap(“INT”) {server.shutdown}
server.start
=end
Neither works. I’ve also changed the default mime-type to ‘application/xhtml+xml’ with no success.
I would appreciate any help. Thank you.