Class: Contrast::Agent::RequestHandler
- Includes:
- Components::Interface
- Defined in:
- lib/contrast/agent/request_handler.rb
Overview
This class is instantiated when we receive a request and the agent is enabled to process that request. It holds the ruleset that we perform filtering operations on (currently prefilter and postfilter).
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#ruleset ⇒ Object
readonly
Returns the value of attribute ruleset.
Instance Method Summary collapse
-
#initialize(context) ⇒ RequestHandler
constructor
A new instance of RequestHandler.
- #send_activity_messages ⇒ Object
-
#stream_safe_postfilter ⇒ Object
If the response is streaming, we should only perform filtering on our stream safe rules.
Methods included from Components::Interface
Constructor Details
#initialize(context) ⇒ RequestHandler
Returns a new instance of RequestHandler.
15 16 17 18 |
# File 'lib/contrast/agent/request_handler.rb', line 15 def initialize context @context = context @ruleset = AGENT.ruleset end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
13 14 15 |
# File 'lib/contrast/agent/request_handler.rb', line 13 def context @context end |
#ruleset ⇒ Object (readonly)
Returns the value of attribute ruleset.
13 14 15 |
# File 'lib/contrast/agent/request_handler.rb', line 13 def ruleset @ruleset end |
Instance Method Details
#send_activity_messages ⇒ Object
20 21 22 23 24 25 |
# File 'lib/contrast/agent/request_handler.rb', line 20 def Contrast::Agent::Inventory::DependencyUsageAnalysis.instance.generate_library_usage(context.activity) [context.server_activity, context.activity, context.observed_route].each do || Contrast::Agent.messaging_queue.send_event_eventually() end end |
#stream_safe_postfilter ⇒ Object
If the response is streaming, we should only perform filtering on our stream safe rules
28 29 30 31 32 |
# File 'lib/contrast/agent/request_handler.rb', line 28 def stream_safe_postfilter stream_safe_ruleset = ruleset.select(&:stream_safe?) postfilter_ruleset = Contrast::Agent::RuleSet.new(stream_safe_ruleset) postfilter_ruleset.postfilter end |