# File lib_doc/rucy/redirect.rb, line 80
    def publish(script_name, request, response, logger)
      logger.debug("[#{Time.now.httpdate}] 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) # Not Found
        end
      else
        ex = HTTPError.new(405)        # Method Not Allowed
        ex.set_header('Allow', 'GET, HEAD')
        raise ex
      end
      nil
    end