Class List Method List File List

# Class: Vertx::HttpServerRequest

Inherits:
  Object
  - Object
  - Vertx::HttpServerRequest
  show all
Includes:
  ReadStream
Defined in:
  src/main/ruby_scripts/core/http.rb

## Overview

Encapsulates a server-side HTTP request. An instance of this class is created for each request that is handled by the server and is passed to the user via the handler specified using Vertx::HttpServer#request_handler. Each instance of this class is associated with a corresponding HttpServerResponse instance via the field #response.

Author:

- Tim Fox

## Instance Method Summary (collapse)

- - (Object) _to_java_request
- - (Object) body_handler(&hndlr)
  Set a handler to receive the entire body in one go - do not use this for large bodies.
- - (Hash) headers
  The request headers.
- - (String) method
  The HTTP method, one of HEAD, OPTIONS, GET, POST, PUT, DELETE, CONNECT, TRACE.
- - (Hash) params
  The request parameters.
- - (String) path
  The path part of the uri.
- - (String) query
  The query part of the uri.
- - (HttpServerResponse) response
  to send the response back to the client.
- - (String) uri
  The uri of the request.

### Methods included from ReadStream

#data_handler, #end_handler, #exception_handler, #pause, #resume

## Instance Method Details

### - (`Object`) _to_java_request

    536
    537
    538
    # File 'src/main/ruby_scripts/core/http.rb', line 536

    def _to_java_request
      @j_del
    end

### - (`Object`) body_handler(&hndlr)

Set a handler to receive the entire body in one go - do not use this for large bodies

    532
    533
    534
    # File 'src/main/ruby_scripts/core/http.rb', line 532

    def body_handler(&hndlr)
      @j_del.bodyHandler(hndlr)
    end

### - (`Hash`) headers

The request headers

Returns:

- (`Hash`) —
  The request headers

    524
    525
    526
    527
    528
    529
    # File 'src/main/ruby_scripts/core/http.rb', line 524

    def headers
      if !@headers
        @headers = @j_del.headers
      end
      @headers
    end

### - (`String`) method

The HTTP method, one of HEAD, OPTIONS, GET, POST, PUT, DELETE, CONNECT, TRACE

Returns:

- (`String`) —
  The HTTP method, one of HEAD, OPTIONS, GET, POST, PUT, DELETE, CONNECT, TRACE

    490
    491
    492
    # File 'src/main/ruby_scripts/core/http.rb', line 490

    def method
      @j_del.method
    end

### - (`Hash`) params

The request parameters

Returns:

- (`Hash`) —
  The request parameters

    510
    511
    512
    513
    514
    515
    # File 'src/main/ruby_scripts/core/http.rb', line 510

    def params
      if !@params
        @params = @j_del.params
      end
      @params
    end

### - (`String`) path

The path part of the uri. For example /somepath/somemorepath/somresource.foo

Returns:

- (`String`) —
  The path part of the uri. For example /somepath/somemorepath/somresource.foo

    500
    501
    502
    # File 'src/main/ruby_scripts/core/http.rb', line 500

    def path
      @j_del.path
    end

### - (`String`) query

The query part of the uri. For example someparam=32&someotherparam=x

Returns:

- (`String`) —
  The query part of the uri. For example someparam=32&someotherparam=x

    505
    506
    507
    # File 'src/main/ruby_scripts/core/http.rb', line 505

    def query
      @j_del.query
    end

### - (`HttpServerResponse`) response

to send the response back to the client.

Returns:

- (`HttpServerResponse`) —
  The response. Each instance of this class has an Vertx::HttpServerResponse instance attached to it. This is used

    519
    520
    521
    # File 'src/main/ruby_scripts/core/http.rb', line 519

    def response
      @resp
    end

### - (`String`) uri

The uri of the request. For example 'http://www.somedomain.com/somepath/somemorepath/somresource.foo?someparam=32&someotherparam=x'

Returns:

- (`String`) —
  The uri of the request. For example 'http://www.somedomain.com/somepath/somemorepath/somresource.foo?someparam=32&someotherparam=x'

    495
    496
    497
    # File 'src/main/ruby_scripts/core/http.rb', line 495

    def uri
      @j_del.uri
    end