Class: VertxWeb::ErrorHandler
- Inherits:
-
Object
- Object
- VertxWeb::ErrorHandler
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/error_handler.rb
Overview
A pretty error handler for rendering error pages. When working in development mode
exception details will be returned in the server responses, otherwise or when
manually specified no exception details are returned in the HTTP response.
The reason the display of the exception details is by default dependent of the mode
is to follow the security best practices:
https://www.owasp.org/index.php/Improper_Error_Handling
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::VertxWeb::ErrorHandler) create(param_1 = nil, param_2 = nil)
Create an error handler.
-
+ (Object) DEFAULT_ERROR_HANDLER_TEMPLATE
The default template to use for rendering.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (void) handle(event = nil)
Something has happened, so handle it.
Class Method Details
+ (Boolean) accept?(obj)
24 25 26 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/error_handler.rb', line 24 def @@j_api_type.accept?(obj) obj.class == ErrorHandler end |
+ (::VertxWeb::ErrorHandler) create + (::VertxWeb::ErrorHandler) create(displayExceptionDetails) + (::VertxWeb::ErrorHandler) create(errorTemplateName) + (::VertxWeb::ErrorHandler) create(errorTemplateName, displayExceptionDetails)
Create an error handler
58 59 60 61 62 63 64 65 66 67 68 69 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/error_handler.rb', line 58 def self.create(param_1=nil,param_2=nil) if !block_given? && param_1 == nil && param_2 == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::ErrorHandler.java_method(:create, []).call(),::VertxWeb::ErrorHandler) elsif (param_1.class == TrueClass || param_1.class == FalseClass) && !block_given? && param_2 == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::ErrorHandler.java_method(:create, [Java::boolean.java_class]).call(param_1),::VertxWeb::ErrorHandler) elsif param_1.class == String && !block_given? && param_2 == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::ErrorHandler.java_method(:create, [Java::java.lang.String.java_class]).call(param_1),::VertxWeb::ErrorHandler) elsif param_1.class == String && (param_2.class == TrueClass || param_2.class == FalseClass) && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::ErrorHandler.java_method(:create, [Java::java.lang.String.java_class,Java::boolean.java_class]).call(param_1,param_2),::VertxWeb::ErrorHandler) end raise ArgumentError, "Invalid arguments when calling create(#{param_1},#{param_2})" end |
+ (Object) DEFAULT_ERROR_HANDLER_TEMPLATE
The default template to use for rendering
71 72 73 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/error_handler.rb', line 71 def self.DEFAULT_ERROR_HANDLER_TEMPLATE Java::IoVertxExtWebHandler::ErrorHandler.DEFAULT_ERROR_HANDLER_TEMPLATE end |
+ (Object) j_api_type
33 34 35 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/error_handler.rb', line 33 def self.j_api_type @@j_api_type end |
+ (Object) j_class
36 37 38 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/error_handler.rb', line 36 def self.j_class Java::IoVertxExtWebHandler::ErrorHandler.java_class end |
+ (Object) unwrap(obj)
30 31 32 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/error_handler.rb', line 30 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
27 28 29 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/error_handler.rb', line 27 def @@j_api_type.wrap(obj) ErrorHandler.new(obj) end |
Instance Method Details
- (void) handle(event = nil)
This method returns an undefined value.
Something has happened, so handle it.
42 43 44 45 46 47 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/error_handler.rb', line 42 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 |