Class: VertxWeb::MIMEHeader

Inherits:
Object
  • Object
show all
Includes:
ParsedHeaderValue
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


18
19
20
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 18

def @@j_api_type.accept?(obj)
  obj.class == MIMEHeader
end

+ (Object) DEFAULT_WEIGHT

If no "q" parameter is present, the default weight is 1.


128
129
130
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 128

def self.DEFAULT_WEIGHT
  Java::IoVertxExtWeb::MIMEHeader.DEFAULT_WEIGHT
end

+ (Object) j_api_type



27
28
29
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 27

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



30
31
32
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 30

def self.j_class
  Java::IoVertxExtWeb::MIMEHeader.java_class
end

+ (Object) unwrap(obj)



24
25
26
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 24

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



21
22
23
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 21

def @@j_api_type.wrap(obj)
  MIMEHeader.new(obj)
end

Instance Method Details

- (String) component

Gets the parsed component part of the MIME. This is the string between the beginning and the first '/' of the MIME

Returns:

  • (String)
    The component of the MIME this represents

Raises:

  • (ArgumentError)


112
113
114
115
116
117
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 112

def component
  if !block_given?
    return @j_del.java_method(:component, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling component()"
end

- (true, false) matched_by?(matchTry = nil)

Test if this header is matched by matchTry header

Parameters:

Returns:

  • (true, false)
    true if this header represents a subset of matchTry, otherwise, false

Raises:

  • (ArgumentError)


95
96
97
98
99
100
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 95

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:
  1. null <- That key was not specified
  2. ParsedHeaderValue.EMPTY (tested using ==) <- The value was not specified
  3. [Other] <- The value of the parameter
Note: The q parameter is never present.

Parameters:

  • key (String) (defaults to: nil)

Returns:

  • (String)

Raises:

  • (ArgumentError)


69
70
71
72
73
74
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 69

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.

Returns:

  • (Hash{String => String})
    Unmodifiable Map of parameters of this header value

Raises:

  • (ArgumentError)


78
79
80
81
82
83
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 78

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?

Returns:

  • (true, false)

Raises:

  • (ArgumentError)


86
87
88
89
90
91
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 86

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

Returns:

  • (String)

Raises:

  • (ArgumentError)


35
36
37
38
39
40
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 35

def raw_value
  if !block_given?
    return @j_del.java_method(:rawValue, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling raw_value()"
end

- (String) sub_component

Gets the parsed subcomponent part of the MIME. This is the string between the first '/' and the ';' or the end of the MIME

Returns:

  • (String)
    The subcomponent of the MIME this represents

Raises:

  • (ArgumentError)


121
122
123
124
125
126
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 121

def sub_component
  if !block_given?
    return @j_del.java_method(:subComponent, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling sub_component()"
end

- (String) value

Holds the unparsed value of the header.
For the most part, this is the content before the semi-colon (";")

Returns:

  • (String)

Raises:

  • (ArgumentError)


44
45
46
47
48
49
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 44

def value
  if !block_given?
    return @j_del.java_method(:value, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling value()"
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

Returns:

  • (Float)

Raises:

  • (ArgumentError)


54
55
56
57
58
59
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 54

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

Returns:

  • (Fixnum)

Raises:

  • (ArgumentError)


103
104
105
106
107
108
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/mime_header.rb', line 103

def weighted_order
  if !block_given?
    return @j_del.java_method(:weightedOrder, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling weighted_order()"
end