Class List Method List File List

# Class: VertxWeb::TemplateHandler

Inherits:
  Object
  - Object
  - VertxWeb::TemplateHandler
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/template_handler.rb

## Overview

A handler which renders responses using a template engine and where the template name is selected from the URI path.

## Class Method Summary (collapse)

- + (::VertxWeb::TemplateHandler) create(engine = nil, templateDirectory = nil, contentType = nil)
  Create a handler.

## Instance Method Summary (collapse)

- - (void) handle(arg0 = nil)

## Class Method Details

### + (`::VertxWeb::TemplateHandler`) create(engine = nil, templateDirectory = nil, contentType = nil)

Create a handler

Parameters:

- engine (`::VertxWeb::TemplateEngine`) (defaults to: `nil`) —
  the template engine
- templateDirectory (`String`) (defaults to: `nil`) —
  the template directory where templates will be looked for
- contentType (`String`) (defaults to: `nil`) —
  the content type header to be used in the response

Returns:

- (`::VertxWeb::TemplateHandler`) —
  the handler

Raises:

- (`ArgumentError`)

    33
    34
    35
    36
    37
    38
    39
    40
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/template_handler.rb', line 33

    def self.create(engine=nil,templateDirectory=nil,contentType=nil)
      if engine.class.method_defined?(:j_del) && !block_given? && templateDirectory == nil && contentType == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::TemplateHandler.java_method(:create, [Java::IoVertxExtWebTempl::TemplateEngine.java_class]).call(engine.j_del),::VertxWeb::TemplateHandler)
      elsif engine.class.method_defined?(:j_del) && templateDirectory.class == String && contentType.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::TemplateHandler.java_method(:create, [Java::IoVertxExtWebTempl::TemplateEngine.java_class,Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(engine.j_del,templateDirectory,contentType),::VertxWeb::TemplateHandler)
      end
      raise ArgumentError, "Invalid arguments when calling create(engine,templateDirectory,contentType)"
    end

## Instance Method Details

### - (`void`) handle(arg0 = nil)

This method returns an undefined value.

Parameters:

- arg0 (`::VertxWeb::RoutingContext`) (defaults to: `nil`)

Raises:

- (`ArgumentError`)

    22
    23
    24
    25
    26
    27
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/template_handler.rb', line 22

    def handle(arg0=nil)
      if arg0.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:handle, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(arg0.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling handle(arg0)"
    end