Module: Buby::Implants::ResponseInfo

Defined in:
lib/buby/implants/response_info.rb

Overview

This interface is used to retrieve key details about an HTTP response. Extensions can obtain an IResponseInfo object for a given response by calling ExtensionHelpers#analyzeResponse.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.implant(info) ⇒ Object

Install ourselves into the current IResponseInfo java class

Parameters:

  • info (IResponseInfo)


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/buby/implants/response_info.rb', line 21

def self.implant(info)
  unless info.implanted? || info.nil?
    pp [:implanting, info, info.class] if $DEBUG
    info.class.class_exec(info) do |info|
      a_methods = %w{
        getCookies
      }
      a_methods.each do |meth|
        alias_method "__"+meth.to_s, meth
      end
      include Buby::Implants::ResponseInfo
      a_methods.each do |meth|
        java_class.ruby_names_for_java_method(meth).each do |ruby_meth|
          define_method ruby_meth, Buby::Implants::ResponseInfo.instance_method(meth)
        end
      end
      include Buby::Implants::Proxy
    end
  end
  info
end

Instance Method Details

#getCookiesICookie

This method is used to obtain details of the HTTP cookies set in the response.

Returns:

  • (ICookie)

    A list of ICookie objects representing the cookies set in the response, if any.



14
15
16
# File 'lib/buby/implants/response_info.rb', line 14

def getCookies
  __getCookies.tap{|cookies| Buby::Implants::Cookie.implant(cookies.first)}
end