Class: Baykit::BayServer::Docker::Ajp::Command::CmdData
- Inherits:
-
AjpCommand
- Object
- Protocol::Command
- AjpCommand
- Baykit::BayServer::Docker::Ajp::Command::CmdData
- Defined in:
- lib/baykit/bayserver/docker/ajp/command/cmd_data.rb
Constant Summary collapse
- LENGTH_OF_SIZE =
2
- MAX_DATA_LEN =
AjpPacket::MAX_DATA_LEN - LENGTH_OF_SIZE
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#length ⇒ Object
Returns the value of attribute length.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Attributes inherited from AjpCommand
Instance Method Summary collapse
- #handle(handler) ⇒ Object
-
#initialize(data = nil, start = 0, length = 0) ⇒ CmdData
constructor
A new instance of CmdData.
- #pack(pkt) ⇒ Object
- #unpack(pkt) ⇒ Object
Methods inherited from AjpCommand
Constructor Details
#initialize(data = nil, start = 0, length = 0) ⇒ CmdData
Returns a new instance of CmdData.
24 25 26 27 28 29 |
# File 'lib/baykit/bayserver/docker/ajp/command/cmd_data.rb', line 24 def initialize(data = nil, start = 0, length = 0) super(AjpType::DATA, true) @data = data @start = start @length = length end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
22 23 24 |
# File 'lib/baykit/bayserver/docker/ajp/command/cmd_data.rb', line 22 def data @data end |
#length ⇒ Object
Returns the value of attribute length.
21 22 23 |
# File 'lib/baykit/bayserver/docker/ajp/command/cmd_data.rb', line 21 def length @length end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
20 21 22 |
# File 'lib/baykit/bayserver/docker/ajp/command/cmd_data.rb', line 20 def start @start end |
Instance Method Details
#handle(handler) ⇒ Object
50 51 52 |
# File 'lib/baykit/bayserver/docker/ajp/command/cmd_data.rb', line 50 def handle(handler) return handler.handle_data(self) end |
#pack(pkt) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/baykit/bayserver/docker/ajp/command/cmd_data.rb', line 39 def pack(pkt) acc = pkt.new_ajp_data_accessor acc.put_short(@length) acc.put_bytes(@data, @start, @length) #BayLog.debug "pack AJP command data: #{pkt.data.bytes}" # must be called from last line super end |
#unpack(pkt) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/baykit/bayserver/docker/ajp/command/cmd_data.rb', line 31 def unpack(pkt) super acc = pkt.new_ajp_data_accessor @length = acc.get_short @data = pkt.buf @start = pkt.header_len + 2 end |