Class: SWS::Adaptor::Generic

Inherits:
Object
  • Object
show all
Defined in:
lib/sws/adaptor.rb

Overview

Base class for all adaptors

Direct Known Subclasses

CGI, FastCGI, Standalone

Constant Summary collapse

HEADER_TRANSLATION =

Header translation hash - defines how the env variables are named in request.headers TODO: add missing headers

{
	"HTTP_USER_AGENT" => "user-agent",
	"HTTP_HOST" => "host",
	"HTTP_COOKIE" => "cookie",
	"CONTENT_LENGTH" => "content-length",
	"CONTENT_TYPE" => "content-type",
	"REMOTE_ADDR" => "remote-address"
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGeneric

Returns a new instance of Generic.



32
33
34
# File 'lib/sws/adaptor.rb', line 32

def initialize ()
	raise "Adaptor::Generic cannot be instantiated - override and don't call super"
end

Instance Attribute Details

#base_pathObject (readonly)

Base path of the adaptor



30
31
32
# File 'lib/sws/adaptor.rb', line 30

def base_path
  @base_path
end

Instance Method Details

#each_requestObject

Main adaptor method - invokes block for each received request. Custom adaptors should override this method and shouldn’t call super



46
47
48
# File 'lib/sws/adaptor.rb', line 46

def each_request ()
	raise "Override and do not call super for Adaptor.each_request"
end

#runObject

Start the adaptor. Custom adaptors should override this method and shouldn’t call super



39
40
41
# File 'lib/sws/adaptor.rb', line 39

def run ()
	raise "Override and do not call super for Adaptor.run"
end