module Hawkular::ClientUtils

Public Instance Methods

hawk_escape(url_part) click to toggle source

Escapes the passed url part. This is necessary, as many ids inside Hawkular can contain characters that are invalid for an url/uri. The passed value is duplicated Does not escape the = character @param [String] url_part Part of an url to be escaped @return [String] escaped url_part as new string

   # File lib/hawkular/client_utils.rb
28 def hawk_escape(url_part)
29   return url_part.to_s if url_part.is_a?(Numeric)
30 
31   url_part
32     .to_s
33     .dup
34     .gsub('%', '%25')
35     .gsub(' ', '%20')
36     .gsub('[', '%5b')
37     .gsub(']', '%5d')
38     .gsub('|', '%7c')
39     .gsub('(', '%28')
40     .gsub(')', '%29')
41     .gsub('/', '%2f')
42 end
hawk_escape_id(url_part) click to toggle source

Escapes the passed url part. This is necessary, as many ids inside Hawkular can contain characters that are invalid for an url/uri. The passed value is duplicated Does escape the = character @param [String] url_part Part of an url to be escaped @return [String] escaped url_part as new string

   # File lib/hawkular/client_utils.rb
51 def hawk_escape_id(url_part)
52   hawk_escape(url_part)
53     .gsub('=', '%3d')
54     .gsub(';', '%3b')
55 end