def publish(script_name, request, response, logger)
logger.debug("enter document: #{self.class}")
case (request.method)
when 'GET', 'HEAD'
loc_path = request.path.dup
if (request.query) then
loc_path << '?' << request.query
end
if (loc_path.gsub!(@req_path_pattern, @replace_location)) then
response.status = @status
response.set_header('Location', loc_path)
response.set_header('Content-Type', 'text/plain')
response.absolute_location(request)
response.start_body
response << "Jump to #{loc_path}.\n" if (request.method != 'HEAD')
else
raise HTTPError.new(404)
end
else
ex = HTTPError.new(405)
ex.set_header('Allow', 'GET, HEAD')
raise ex
end
nil
end