Class: VertxWeb::CorsHandler
- Inherits:
-
Object
- Object
- VertxWeb::CorsHandler
show all
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cors_handler.rb
Overview
A handler which implements server side http://www.w3.org/TR/cors/[CORS] support for Vert.x-Web.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
Class Method Details
+ (Boolean) accept?(obj)
18
19
20
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cors_handler.rb', line 18
def @@j_api_type.accept?(obj)
obj.class == CorsHandler
end
|
45
46
47
48
49
50
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cors_handler.rb', line 45
def self.create(allowedOriginPattern=nil)
if allowedOriginPattern.class == String && !block_given?
return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::CorsHandler.java_method(:create, [Java::java.lang.String.java_class]).call(allowedOriginPattern),::VertxWeb::CorsHandler)
end
raise ArgumentError, "Invalid arguments when calling create(#{allowedOriginPattern})"
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/cors_handler.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/cors_handler.rb', line 30
def self.j_class
Java::IoVertxExtWebHandler::CorsHandler.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/cors_handler.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/cors_handler.rb', line 21
def @@j_api_type.wrap(obj)
CorsHandler.new(obj)
end
|
Instance Method Details
- (self) allow_credentials(allow = nil)
Set whether credentials are allowed. Note that user agents will block
requests that use a wildcard as origin and include credentials.
From the MDN documentation you can read:
Important note: when responding to a credentialed request,
server must specify a domain, and cannot use wild carding.
112
113
114
115
116
117
118
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cors_handler.rb', line 112
def allow_credentials(allow=nil)
if (allow.class == TrueClass || allow.class == FalseClass) && !block_given?
@j_del.java_method(:allowCredentials, [Java::boolean.java_class]).call(allow)
return self
end
raise ArgumentError, "Invalid arguments when calling allow_credentials(#{allow})"
end
|
64
65
66
67
68
69
70
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cors_handler.rb', line 64
def (=nil)
if .class == String && !block_given?
@j_del.java_method(:allowedHeader, [Java::java.lang.String.java_class]).call()
return self
end
raise ArgumentError, "Invalid arguments when calling allowed_header(#{})"
end
|
Add a set of allowed headers
74
75
76
77
78
79
80
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cors_handler.rb', line 74
def (=nil)
if .class == Set && !block_given?
@j_del.java_method(:allowedHeaders, [Java::JavaUtil::Set.java_class]).call(Java::JavaUtil::LinkedHashSet.new(.map { |element| element }))
return self
end
raise ArgumentError, "Invalid arguments when calling allowed_headers(#{})"
end
|
- (self) allowed_method(method = nil)
54
55
56
57
58
59
60
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cors_handler.rb', line 54
def allowed_method(method=nil)
if method.class == Symbol && !block_given?
@j_del.java_method(:allowedMethod, [Java::IoVertxCoreHttp::HttpMethod.java_class]).call(Java::IoVertxCoreHttp::HttpMethod.valueOf(method.to_s))
return self
end
raise ArgumentError, "Invalid arguments when calling allowed_method(#{method})"
end
|
84
85
86
87
88
89
90
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cors_handler.rb', line 84
def (=nil)
if .class == String && !block_given?
@j_del.java_method(:exposedHeader, [Java::java.lang.String.java_class]).call()
return self
end
raise ArgumentError, "Invalid arguments when calling exposed_header(#{})"
end
|
Add a set of exposed headers
94
95
96
97
98
99
100
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cors_handler.rb', line 94
def (=nil)
if .class == Set && !block_given?
@j_del.java_method(:exposedHeaders, [Java::JavaUtil::Set.java_class]).call(Java::JavaUtil::LinkedHashSet.new(.map { |element| element }))
return self
end
raise ArgumentError, "Invalid arguments when calling exposed_headers(#{})"
end
|
- (void) handle(event = nil)
This method returns an undefined value.
Something has happened, so handle it.
36
37
38
39
40
41
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cors_handler.rb', line 36
def handle(event=nil)
if event.class.method_defined?(:j_del) && !block_given?
return @j_del.java_method(:handle, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(event.j_del)
end
raise ArgumentError, "Invalid arguments when calling handle(#{event})"
end
|
- (self) max_age_seconds(maxAgeSeconds = nil)
Set how long the browser should cache the information
122
123
124
125
126
127
128
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cors_handler.rb', line 122
def max_age_seconds(maxAgeSeconds=nil)
if maxAgeSeconds.class == Fixnum && !block_given?
@j_del.java_method(:maxAgeSeconds, [Java::int.java_class]).call(maxAgeSeconds)
return self
end
raise ArgumentError, "Invalid arguments when calling max_age_seconds(#{maxAgeSeconds})"
end
|