Class: Baykit::BayServer::Docker::BuiltIn::BuiltInCityDocker
- Inherits:
-
Baykit::BayServer::Docker::Base::DockerBase
- Object
- Baykit::BayServer::Docker::Base::DockerBase
- Baykit::BayServer::Docker::BuiltIn::BuiltInCityDocker
- Includes:
- Agent, Bcf, Baykit::BayServer::Docker, Baykit::BayServer::Docker::BuiltIn, City, SendFile, Util
- Defined in:
- lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb
Defined Under Namespace
Classes: ClubMatchInfo, MatchInfo
Instance Attribute Summary collapse
-
#clubs ⇒ Object
readonly
Returns the value of attribute clubs.
-
#default_club ⇒ Object
readonly
Returns the value of attribute default_club.
-
#default_town ⇒ Object
readonly
Returns the value of attribute default_town.
-
#log_list ⇒ Object
readonly
Returns the value of attribute log_list.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#permission_list ⇒ Object
readonly
Returns the value of attribute permission_list.
-
#towns ⇒ Object
readonly
Returns the value of attribute towns.
-
#trouble ⇒ Object
readonly
Returns the value of attribute trouble.
Attributes inherited from Baykit::BayServer::Docker::Base::DockerBase
Instance Method Summary collapse
- #enter(tur) ⇒ Object
-
#init(elm, parent) ⇒ Object
Implements Docker.
-
#init_docker(dkr) ⇒ Object
Implements DockerBase.
-
#initialize ⇒ BuiltInCityDocker
constructor
A new instance of BuiltInCityDocker.
- #log(tur) ⇒ Object
- #to_s ⇒ Object
Methods included from Baykit::BayServer::Docker::BuiltIn
Methods included from City
Methods included from Docker
Methods inherited from Baykit::BayServer::Docker::Base::DockerBase
Constructor Details
#initialize ⇒ BuiltInCityDocker
Returns a new instance of BuiltInCityDocker.
57 58 59 60 61 62 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 57 def initialize() @towns = [] @clubs = [] @log_list = [] @permission_list = [] end |
Instance Attribute Details
#clubs ⇒ Object (readonly)
Returns the value of attribute clubs.
48 49 50 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 48 def clubs @clubs end |
#default_club ⇒ Object (readonly)
Returns the value of attribute default_club.
49 50 51 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 49 def default_club @default_club end |
#default_town ⇒ Object (readonly)
Returns the value of attribute default_town.
46 47 48 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 46 def default_town @default_town end |
#log_list ⇒ Object (readonly)
Returns the value of attribute log_list.
51 52 53 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 51 def log_list @log_list end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
55 56 57 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 55 def name @name end |
#permission_list ⇒ Object (readonly)
Returns the value of attribute permission_list.
52 53 54 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 52 def @permission_list end |
#towns ⇒ Object (readonly)
Returns the value of attribute towns.
45 46 47 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 45 def towns @towns end |
#trouble ⇒ Object (readonly)
Returns the value of attribute trouble.
54 55 56 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 54 def trouble @trouble end |
Instance Method Details
#enter(tur) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 107 def enter(tur) BayLog.debug("%s City[%s] Request URI: %s", tur, @name, tur.req.uri) tur.city = self @permission_list.each do |p| p.tour_admitted(tur) end match_info = get_town_and_club(tur.req.uri) if match_info == nil raise HttpException.new(HttpStatus::NOT_FOUND, tur.req.uri) end match_info.town.tour_admitted(tur) if match_info.redirect_uri != nil raise HttpException.moved_temp(match_info.redirect_uri) else BayLog.debug("%s Town[%s] Club[%s]", tur, match_info.town.name(), match_info.club_match.club) tur.req.query_string = match_info.query_string tur.req.script_name = match_info.club_match.script_name if StringUtil.set?(match_info.club_match.club.charset) tur.req.charset = match_info.club_match.club.charset tur.res.charset = match_info.club_match.club.charset else tur.req.charset = BayServer.harbor.charset tur.res.charset = BayServer.harbor.charset end tur.req.path_info = match_info.club_match.path_info if StringUtil.set?(tur.req.path_info) && match_info.club_match.club.decode_path_info tur.req.path_info = CGI.unescape(tur.req.path_info, Encoding::ASCII_8BIT) end if match_info.rewritten_uri tur.req.rewritten_uri = match_info.rewritten_uri # URI is rewritten end clb = match_info.club_match.club tur.town = match_info.town tur.club = clb clb.arrive(tur) end end |
#init(elm, parent) ⇒ Object
Implements Docker
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 72 def init(elm, parent) super @name = elm.arg @towns.sort! { |dkr1, dkr2| dkr2.name.length <=> dkr1.name.length } @towns.each do |t| BayLog.debug(BayMessage.get(:MSG_SETTING_UP_TOWN, t.name, t.location)) end @default_town = BuiltInTownDocker.new @default_club = SendFileDocker.new end |
#init_docker(dkr) ⇒ Object
Implements DockerBase
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 90 def init_docker(dkr) if dkr.kind_of?(Baykit::BayServer::Docker::Town) @towns << dkr elsif dkr.kind_of?(Baykit::BayServer::Docker::Club) @clubs << dkr elsif dkr.kind_of?(Baykit::BayServer::Docker::Log) @log_list << dkr elsif dkr.kind_of?(Baykit::BayServer::Docker::Permission) @permission_list << dkr elsif dkr.kind_of?(Baykit::BayServer::Docker::Trouble) @trouble = dkr else return false end return true end |
#log(tur) ⇒ Object
154 155 156 157 158 159 160 161 162 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 154 def log(tur) @log_list.each do |dkr| begin dkr.log(tur) rescue IOError => e BayLog.error_e(e) end end end |
#to_s ⇒ Object
64 65 66 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_city_docker.rb', line 64 def to_s "City[#{@name}]" end |