Class: Baykit::BayServer::Docker::SendFile::FileContentHandler

Inherits:
Object
  • Object
show all
Includes:
Tours, Tours::ReqContentHandler
Defined in:
lib/baykit/bayserver/docker/send_file/file_content_handler.rb

Constant Summary

Constants included from Tours::ReqContentHandler

Tours::ReqContentHandler::DEV_NULL

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ FileContentHandler

Returns a new instance of FileContentHandler.



15
16
17
18
# File 'lib/baykit/bayserver/docker/send_file/file_content_handler.rb', line 15

def initialize(path)
  @path = path
  @abortable = true
end

Instance Attribute Details

#abortableObject (readonly)

Returns the value of attribute abortable.



13
14
15
# File 'lib/baykit/bayserver/docker/send_file/file_content_handler.rb', line 13

def abortable
  @abortable
end

#pathObject (readonly)

Returns the value of attribute path.



12
13
14
# File 'lib/baykit/bayserver/docker/send_file/file_content_handler.rb', line 12

def path
  @path
end

Instance Method Details

#on_abort(tur) ⇒ Object



34
35
36
37
# File 'lib/baykit/bayserver/docker/send_file/file_content_handler.rb', line 34

def on_abort(tur)
  BayLog.debug("%s onAbortReq aborted=%s", tur, abortable)
  return abortable
end

#on_end_content(tur) ⇒ Object



28
29
30
31
32
# File 'lib/baykit/bayserver/docker/send_file/file_content_handler.rb', line 28

def on_end_content(tur)
  BayLog.debug("%s endReqContent", tur)
  tur.res.send_file(Tour::TOUR_ID_NOCHECK, path, tur.res.charset, true)
  @abortable = false
end

#on_read_content(tur, buf, start, len) ⇒ Object

Implements ReqContentHandler



24
25
26
# File 'lib/baykit/bayserver/docker/send_file/file_content_handler.rb', line 24

def on_read_content(tur, buf, start, len)
  BayLog.debug("%s onReadReqContent(Ignore) len=%d", tur, len)
end