Class: Vertx::HttpServerRequest

Inherits:
Object
  • Object
show all
Includes:
ReadStream
Defined in:
src/main/api_shim/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:

Instance Method Summary (collapse)

Methods included from ReadStream

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

Instance Method Details

- (Object) _to_java_request



613
614
615
# File 'src/main/api_shim/core/http.rb', line 613

def _to_java_request
  @j_del
end

- (Object) absolute_uri

Get the absolute URI


609
610
611
# File 'src/main/api_shim/core/http.rb', line 609

def absolute_uri
  @j_del.absoluteURI
end

- (Object) body_handler(&hndlr)

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


598
599
600
601
# File 'src/main/api_shim/core/http.rb', line 598

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

- (Object) expect_multipart=(expect)

You must call this function with true before receiving the request body if you expect it to contain a multi-part form


573
574
575
576
# File 'src/main/api_shim/core/http.rb', line 573

def expect_multipart=(expect)
  @j_del.expectMultiPart(expect)
  self
end

- (MultiMap) form_attributes

message should only get called after the endHandler was notified as the map will be filled on-the-fly.

Returns:

  • (MultiMap)
    Returns a map of all form attributes which was found in the request. Be aware that this


581
582
583
584
585
586
# File 'src/main/api_shim/core/http.rb', line 581

def form_attributes
  if !@attrs
    @attrs = MultiMap.new(@j_del.formAttributes)
  end
  @attrs
end

- (MultiMap) headers

The request headers

Returns:



564
565
566
567
568
569
# File 'src/main/api_shim/core/http.rb', line 564

def headers
  if !@headers
    @headers = MultiMap.new(@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


530
531
532
# File 'src/main/api_shim/core/http.rb', line 530

def method
  @j_del.method
end

- (MultiMap) params

The request parameters

Returns:



550
551
552
553
554
555
# File 'src/main/api_shim/core/http.rb', line 550

def params
  if !@params
    @params = MultiMap.new(@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


540
541
542
# File 'src/main/api_shim/core/http.rb', line 540

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


545
546
547
# File 'src/main/api_shim/core/http.rb', line 545

def query
  @j_del.query
end

- (Object) remote_address

Get the remote address


604
605
606
# File 'src/main/api_shim/core/http.rb', line 604

def remote_address
  @j_del.remoteAddress
end

- (HttpServerResponse) response

to send the response back to the client.

Returns:



559
560
561
# File 'src/main/api_shim/core/http.rb', line 559

def response
  @resp
end

- (Object) upload_handler(&hndlr)

Set the upload handler. The handler will get notified once a new file upload was received and so allow to get notified by the upload in progress.


590
591
592
593
594
595
# File 'src/main/api_shim/core/http.rb', line 590

def upload_handler(&hndlr)
  @j_del.uploadHandler do |j_upload|
      hndlr.call(HttpServerFileUpload.new(j_upload))
  end
  self
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'


535
536
537
# File 'src/main/api_shim/core/http.rb', line 535

def uri
  @j_del.uri
end

- (String) version

The Http version

Returns:

  • (String)
    The Http version


522
523
524
525
526
527
# File 'src/main/api_shim/core/http.rb', line 522

def version
  if !@vrsn
    @vrsn = @j_del.version.toString
  end
  @vrsn
end