Class List Method List File List

# Class: VertxWeb::ResponseContentTypeHandler

Inherits:
  Object
  - Object
  - VertxWeb::ResponseContentTypeHandler
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/response_content_type_handler.rb

## Overview

A handler which sets the response content type automatically according to the best `Accept` header match. The header is set only if:

- no object is stored in the routing context under the name DEFAULT_DISABLE_FLAG
- a match is found
- the header is not present already
- content length header is absent or set to something different than zero

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxWeb::ResponseContentTypeHandler) create(disableFlag = nil)
  Create a response content type handler with a custom disable flag.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (void) handle(arg0 = nil)

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    26
    27
    28
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/response_content_type_handler.rb', line 26

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

### + (`::VertxWeb::ResponseContentTypeHandler`) create(disableFlag = nil)

Create a response content type handler with a custom disable flag.

Parameters:

- disableFlag (`String`) (defaults to: `nil`)

Returns:

- (`::VertxWeb::ResponseContentTypeHandler`) —
  the response content type handler

Raises:

- (`ArgumentError`)

    52
    53
    54
    55
    56
    57
    58
    59
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/response_content_type_handler.rb', line 52

    def self.create(disableFlag=nil)
      if !block_given? && disableFlag == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::ResponseContentTypeHandler.java_method(:create, []).call(),::VertxWeb::ResponseContentTypeHandler)
      elsif disableFlag.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::ResponseContentTypeHandler.java_method(:create, [Java::java.lang.String.java_class]).call(disableFlag),::VertxWeb::ResponseContentTypeHandler)
      end
      raise ArgumentError, "Invalid arguments when calling create(#{disableFlag})"
    end

### + (`Object`) j_api_type

    35
    36
    37
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/response_content_type_handler.rb', line 35

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    38
    39
    40
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/response_content_type_handler.rb', line 38

    def self.j_class
      Java::IoVertxExtWebHandler::ResponseContentTypeHandler.java_class
    end

### + (`Object`) unwrap(obj)

    32
    33
    34
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/response_content_type_handler.rb', line 32

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

### + (`Object`) wrap(obj)

    29
    30
    31
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/response_content_type_handler.rb', line 29

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

## Instance Method Details

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

This method returns an undefined value.

Parameters:

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

Raises:

- (`ArgumentError`)

    43
    44
    45
    46
    47
    48
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/response_content_type_handler.rb', line 43

    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