Class: VertxWeb::LanguageHeader
- Inherits:
-
Locale
- Object
- Locale
- VertxWeb::LanguageHeader
- Includes:
- ParsedHeaderValue
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb
Overview
A parsed language header.
Delivers a more direct access to the individual elements of the header it represents
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (Object) DEFAULT_WEIGHT
If no "q" parameter is present, the default weight is 1.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (true, false) isMatchedBy(matchTry)
Test if this header is matched by matchTry header.
-
- (String) parameter(key)
The value of the parameter specified by this key.
-
- (Hash{String => String}) parameters
The parameters specified in this header value.
-
- (true, false) isPermitted
Is this an allowed operation as specified by the corresponding header?.
-
- (String) rawValue
Contains the raw value that was received from the user agent.
-
- (String) subtag(*args)
A subtag of this language header.
-
- (Fixnum) subtagCount
The number of subtags this value has.
-
- (String) tag
The tag of the language as specified by rfc7231#section-3.1.3.1.
-
- (String) value
Holds the unparsed value of the header.
-
- (Float) weight
Holds the weight specified in the "q" parameter of the header.
-
- (Fixnum) weightedOrder
An integer that represents the absolute order position of this header.
Methods inherited from Locale
#country, create, #language, #variant
Class Method Details
+ (Boolean) accept?(obj)
23 24 25 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 23 def @@j_api_type.accept?(obj) obj.class == LanguageHeader end |
+ (Object) DEFAULT_WEIGHT
If no "q" parameter is present, the default weight is 1.
200 201 202 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 200 def self.DEFAULT_WEIGHT Java::IoVertxExtWeb::LanguageHeader.DEFAULT_WEIGHT end |
+ (Object) j_api_type
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 32 def self.j_api_type @@j_api_type end |
+ (Object) j_class
35 36 37 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 35 def self.j_class Java::IoVertxExtWeb::LanguageHeader.java_class end |
+ (Object) unwrap(obj)
29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 29 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
26 27 28 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 26 def @@j_api_type.wrap(obj) LanguageHeader.new(obj) end |
Instance Method Details
- (true, false) isMatchedBy(matchTry)
Test if this header is matched by matchTry header
189 190 191 192 193 194 195 196 197 198 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 189 def matched_by?(*args) if args[0].class.method_defined?(:j_del) && !block_given? return @j_del.java_method(:isMatchedBy, [Java::IoVertxExtWeb::ParsedHeaderValue.java_class]).call(args[0].j_del) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling matched_by?(#{args[0]})" end end |
- (String) parameter(key)
The value of the parameter specified by this key. Each is one of 3 things:
- null <- That key was not specified
- ParsedHeaderValue.EMPTY (tested using ==) <- The value was not specified
- [Other] <- The value of the parameter
q
parameter is never present.
105 106 107 108 109 110 111 112 113 114 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 105 def parameter(*args) if args[0].class == String && !block_given? return @j_del.java_method(:parameter, [Java::java.lang.String.java_class]).call(args[0]) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling parameter(#{args[0]})" end end |
- (Hash{String => String}) parameters
The parameters specified in this header value.
Note: The
q
parameter is never present.
149 150 151 152 153 154 155 156 157 158 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 149 def parameters if !block_given? return Java::IoVertxLangRuby::Helper.adaptingMap(@j_del.java_method(:parameters, []).call(), Proc.new { |val| val }, Proc.new { |val| ::Vertx::Util::Utils.to_string(val) }) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling parameters()" end end |
- (true, false) isPermitted
Is this an allowed operation as specified by the corresponding header?
85 86 87 88 89 90 91 92 93 94 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 85 def permitted? if !block_given? return @j_del.java_method(:isPermitted, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling permitted?()" end end |
- (String) rawValue
Contains the raw value that was received from the user agent
54 55 56 57 58 59 60 61 62 63 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 54 def raw_value if !block_given? return @j_del.java_method(:rawValue, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling raw_value()" end end |
- (String) subtag - (String) subtag(level)
A subtag of this language header.
+ info: rfc7231#section-3.1.3.1
+ info: rfc7231#section-3.1.3.1
70 71 72 73 74 75 76 77 78 79 80 81 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 70 def subtag(*args) if !block_given? && args[0] == nil return @j_del.java_method(:subtag, []).call() elsif args[0].class == Fixnum && !block_given? return @j_del.java_method(:subtag, [Java::int.java_class]).call(args[0]) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling subtag(#{args[0]})" end end |
- (Fixnum) subtagCount
Returns the number of subtags this value has
175 176 177 178 179 180 181 182 183 184 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 175 def subtag_count if !block_given? return @j_del.java_method(:subtagCount, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling subtag_count()" end end |
- (String) tag
The tag of the language as specified by
rfc7231#section-3.1.3.1.
Equivalent to
Equivalent to
135 136 137 138 139 140 141 142 143 144 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 135 def tag if !block_given? return @j_del.java_method(:tag, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling tag()" end end |
- (String) value
Holds the unparsed value of the header.
For the most part, this is the content before the semi-colon (";")
For the most part, this is the content before the semi-colon (";")
163 164 165 166 167 168 169 170 171 172 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 163 def value if !block_given? return @j_del.java_method(:value, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling value()" end end |
- (Float) weight
Holds the weight specified in the "q" parameter of the header.
If the parameter is not specified, 1.0 is assumed according to rfc7231
If the parameter is not specified, 1.0 is assumed according to rfc7231
120 121 122 123 124 125 126 127 128 129 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 120 def weight if !block_given? return @j_del.java_method(:weight, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling weight()" end end |
- (Fixnum) weightedOrder
An integer that represents the absolute order position of this header
41 42 43 44 45 46 47 48 49 50 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/language_header.rb', line 41 def weighted_order if !block_given? return @j_del.java_method(:weightedOrder, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling weighted_order()" end end |