Class: VertxWeb::LanguageHeader
- Inherits:
-
Locale
- Object
- Locale
- VertxWeb::LanguageHeader
- Includes:
- ParsedHeaderValue
- Defined in:
- /Users/julien/java/vertx-stack/stack-docs/target/rb/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) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (String) country
Returns the country as reported by the HTTP client.
-
- (String) language
Returns the language as reported by the HTTP client.
-
- (true, false) matched_by?(matchTry = nil)
Test if this header is matched by matchTry header.
-
- (String) parameter(key = nil)
The value of the parameter specified by this key.
-
- (Hash{String => String}) parameters
The parameters specified in this header value.
-
- (true, false) permitted?
Is this an allowed operation as specified by the corresponding header?.
-
- (String) raw_value
Contains the raw value that was received from the user agent.
-
- (String) subtag(level = nil)
A subtag of this language header.
-
- (Fixnum) subtag_count
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.
-
- (String) variant
Returns the variant as reported by the HTTP client.
-
- (Float) weight
Holds the weight specified in the "q" parameter of the header.
-
- (Fixnum) weighted_order
An integer that represents the absolute order position of this header.
Methods inherited from Locale
Class Method Details
+ (Boolean) accept?(obj)
22 23 24 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 22 def @@j_api_type.accept?(obj) obj.class == LanguageHeader end |
+ (Object) j_api_type
31 32 33 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 31 def self.j_api_type @@j_api_type end |
+ (Object) j_class
34 35 36 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 34 def self.j_class Java::IoVertxExtWeb::LanguageHeader.java_class end |
+ (Object) unwrap(obj)
28 29 30 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 28 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
25 26 27 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 25 def @@j_api_type.wrap(obj) LanguageHeader.new(obj) end |
Instance Method Details
- (String) country
Returns the country as reported by the HTTP client.
123 124 125 126 127 128 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 123 def country if !block_given? return @j_del.java_method(:country, []).call() end raise ArgumentError, "Invalid arguments when calling country()" end |
- (String) language
Returns the language as reported by the HTTP client.
115 116 117 118 119 120 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 115 def language if !block_given? return @j_del.java_method(:language, []).call() end raise ArgumentError, "Invalid arguments when calling language()" end |
- (true, false) matched_by?(matchTry = nil)
Test if this header is matched by matchTry header
99 100 101 102 103 104 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 99 def matched_by?(matchTry=nil) if matchTry.class.method_defined?(:j_del) && !block_given? return @j_del.java_method(:isMatchedBy, [Java::IoVertxExtWeb::ParsedHeaderValue.java_class]).call(matchTry.j_del) end raise ArgumentError, "Invalid arguments when calling matched_by?(#{matchTry})" end |
- (String) parameter(key = nil)
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.
73 74 75 76 77 78 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 73 def parameter(key=nil) if key.class == String && !block_given? return @j_del.java_method(:parameter, [Java::java.lang.String.java_class]).call(key) end raise ArgumentError, "Invalid arguments when calling parameter(#{key})" end |
- (Hash{String => String}) parameters
The parameters specified in this header value.
Note: The
q
parameter is never present.
82 83 84 85 86 87 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 82 def parameters if !block_given? return Java::IoVertxLangRuby::Helper.adaptingMap(@j_del.java_method(:parameters, []).call(), Proc.new { |val| ::Vertx::Util::Utils.from_object(val) }, Proc.new { |val| ::Vertx::Util::Utils.to_string(val) }) end raise ArgumentError, "Invalid arguments when calling parameters()" end |
- (true, false) permitted?
Is this an allowed operation as specified by the corresponding header?
90 91 92 93 94 95 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 90 def permitted? if !block_given? return @j_del.java_method(:isPermitted, []).call() end raise ArgumentError, "Invalid arguments when calling permitted?()" end |
- (String) raw_value
Contains the raw value that was received from the user agent
39 40 41 42 43 44 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 39 def raw_value if !block_given? return @j_del.java_method(:rawValue, []).call() end raise ArgumentError, "Invalid arguments when calling raw_value()" end |
- (String) subtag(level = nil)
A subtag of this language header.
+ info: rfc7231#section-3.1.3.1
+ info: rfc7231#section-3.1.3.1
151 152 153 154 155 156 157 158 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 151 def subtag(level=nil) if !block_given? && level == nil return @j_del.java_method(:subtag, []).call() elsif level.class == Fixnum && !block_given? return @j_del.java_method(:subtag, [Java::int.java_class]).call(level) end raise ArgumentError, "Invalid arguments when calling subtag(#{level})" end |
- (Fixnum) subtag_count
Returns the number of subtags this value has
160 161 162 163 164 165 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 160 def subtag_count if !block_given? return @j_del.java_method(:subtagCount, []).call() end raise ArgumentError, "Invalid arguments when calling subtag_count()" end |
- (String) tag
The tag of the language as specified by
rfc7231#section-3.1.3.1.
Equivalent to
Equivalent to
141 142 143 144 145 146 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 141 def tag if !block_given? return @j_del.java_method(:tag, []).call() end raise ArgumentError, "Invalid arguments when calling tag()" 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 (";")
48 49 50 51 52 53 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 48 def value if !block_given? return @j_del.java_method(:value, []).call() end raise ArgumentError, "Invalid arguments when calling value()" end |
- (String) variant
Returns the variant as reported by the HTTP client.
131 132 133 134 135 136 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 131 def variant if !block_given? return @j_del.java_method(:variant, []).call() end raise ArgumentError, "Invalid arguments when calling variant()" 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
58 59 60 61 62 63 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 58 def weight if !block_given? return @j_del.java_method(:weight, []).call() end raise ArgumentError, "Invalid arguments when calling weight()" end |
- (Fixnum) weighted_order
An integer that represents the absolute order position of this header
107 108 109 110 111 112 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/language_header.rb', line 107 def weighted_order if !block_given? return @j_del.java_method(:weightedOrder, []).call() end raise ArgumentError, "Invalid arguments when calling weighted_order()" end |