Class: Baykit::BayServer::Docker::SendFile::SendFileDocker
- Inherits:
-
Base::ClubBase
- Object
- Base::DockerBase
- Base::ClubBase
- Baykit::BayServer::Docker::SendFile::SendFileDocker
- Defined in:
- lib/baykit/bayserver/docker/send_file/send_file_docker.rb
Instance Attribute Summary collapse
-
#list_files ⇒ Object
readonly
Returns the value of attribute list_files.
Attributes inherited from Base::ClubBase
#charset, #decode_path_info, #extension, #file_name, #locale
Attributes inherited from Base::DockerBase
Instance Method Summary collapse
- #arrive(tur) ⇒ Object
-
#init(elm, parent) ⇒ Object
Implements DockerBase.
- #init_key_val(kv) ⇒ Object
Methods inherited from Base::ClubBase
#initialize, #inspect, #matches, #to_s
Methods included from Club
#charset, #decode_path_info, #extension, #file_name, #matches
Methods inherited from Base::DockerBase
Constructor Details
This class inherits a constructor from Baykit::BayServer::Docker::Base::ClubBase
Instance Attribute Details
#list_files ⇒ Object (readonly)
Returns the value of attribute list_files.
19 20 21 |
# File 'lib/baykit/bayserver/docker/send_file/send_file_docker.rb', line 19 def list_files @list_files end |
Instance Method Details
#arrive(tur) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/baykit/bayserver/docker/send_file/send_file_docker.rb', line 39 def arrive(tur) rel_path = tur.req.rewritten_uri != nil ? tur.req.rewritten_uri : tur.req.uri if StringUtil.set?(tur.town.name) rel_path = rel_path[tur.town.name.length .. -1] pos = rel_path.index('?') if pos != nil rel_path = rel_path[0, pos] end begin rel_path = URLDecoder.decode(rel_path, tur.req.charset) rescue Encoding::UndefinedConversionError => e BayLog.warn("%s Cannot decode request path: %s (encoding=%s)", tur, rel_path, tur.req.charset) end real = "#{tur.town.location}/#{rel_path}" if File.directory?(real) && @list_files train = DirectoryTrain.new(tur, real) train.start_tour() else handler = FileContentHandler.new(real) tur.req.set_content_handler(handler) end end end |
#init(elm, parent) ⇒ Object
Implements DockerBase
25 26 27 |
# File 'lib/baykit/bayserver/docker/send_file/send_file_docker.rb', line 25 def init(elm, parent) super end |
#init_key_val(kv) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/baykit/bayserver/docker/send_file/send_file_docker.rb', line 29 def init_key_val(kv) case kv.key.downcase when "listfiles" @list_files = StringUtil.parse_bool(kv.value) else return super end return true end |