Class: Vertx::HttpServerRequest
- Inherits:
-
Object
- Object
- Vertx::HttpServerRequest
- Includes:
- ReadStream
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb
Overview
Instances are created for each request and passed to the user via a handler.
Each instance of this class is associated with a corresponding HttpServerResponse instance via #response.
It implements ReadStream so it can be used with Pump to pump data with flow control.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (String) absolute_uri
The absolute URI corresponding to the the HTTP request.
-
- (self) body_handler { ... }
Convenience method for receiving the entire request body in one piece.
-
- (Fixnum) bytes_read
The total number of bytes read for the body of the request.
-
- (::Vertx::HttpConnection) connection
The HttpConnection associated with this request.
-
- (Fixnum) cookie_count
The number of cookieMap.
-
- (self) custom_frame_handler { ... }
Set a custom frame handler.
- - (self) end_handler { ... }
-
- (true, false) ended?
Has the request ended? I.e.
- - (self) exception_handler { ... }
-
- (true, false) expect_multipart?
True if we are expecting a multi-part body for this request.
- - (self) fetch(amount = nil)
-
- (::Vertx::MultiMap) form_attributes
Returns a map of all form attributes in the request.
-
- (::Vertx::Cookie) get_cookie(name = nil)
Get the cookie with the specified name.
-
- (String) get_form_attribute(attributeName = nil)
Return the first form attribute value with the specified name.
-
- (String) get_header(headerName = nil)
Return the first header value with the specified name.
-
- (String) get_param(paramName = nil)
Return the first param value with the specified name.
- - (self) handler { ... }
-
- (::Vertx::MultiMap) headers
The headers in the request.
-
- (String) host
The request host.
-
- (::Vertx::SocketAddress) local_address
The local address for this connection, possibly null (e.g a server bound on a domain socket).
-
- (:OPTIONS, ...) method
The HTTP method for the request.
-
- (::Vertx::NetSocket) net_socket
Get a net socket for the underlying connection of this request.
-
- (::Vertx::MultiMap) params
The query parameters in the request.
-
- (String) path
The path part of the uri.
- - (self) pause
-
- (::Vertx::Pipe) pipe
Pause this stream and return a to transfer the elements of this stream to a destination .
-
- (void) pipe_to(dst = nil) { ... }
Pipe this ReadStream to the WriteStream.
-
- (String) query
The query part of the uri.
-
- (String) raw_method
The HTTP method as sent by the client.
-
- (::Vertx::SocketAddress) remote_address
The remote address for this connection, possibly null (e.g a server bound on a domain socket).
-
- (::Vertx::HttpServerResponse) response
The response.
- - (self) resume
-
- (String) scheme
The scheme of the request.
-
- (self) set_expect_multipart(expect = nil)
Call this with true if you are expecting a multi-part body to be submitted in the request.
-
- (true, false) ssl?
True if this NetSocket is encrypted via SSL/TLS.
-
- (Hash) stream_priority
The priority of the associated HTTP/2 stream for HTTP/2 otherwise null.
-
- (self) stream_priority_handler { ... }
Set an handler for stream priority changes This is not implemented for HTTP/1.x.
-
- (void) to_net_socket { ... }
Establish a TCP tunnel with the client.
-
- (void) to_web_socket { ... }
Upgrade the connection of the current request to a WebSocket.
-
- (::Vertx::ServerWebSocket) upgrade
Upgrade the connection to a WebSocket connection.
-
- (self) upload_handler { ... }
Set an upload handler.
-
- (String) uri
The URI of the request.
-
- (:HTTP_1_0, ...) version
The HTTP version of the request.
Class Method Details
+ (Boolean) accept?(obj)
39 40 41 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 39 def @@j_api_type.accept?(obj) obj.class == HttpServerRequest end |
+ (Object) j_api_type
48 49 50 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 48 def self.j_api_type @@j_api_type end |
+ (Object) j_class
51 52 53 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 51 def self.j_class Java::IoVertxCoreHttp::HttpServerRequest.java_class end |
+ (Object) unwrap(obj)
45 46 47 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 45 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
42 43 44 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 42 def @@j_api_type.wrap(obj) HttpServerRequest.new(obj) end |
Instance Method Details
- (String) absolute_uri
272 273 274 275 276 277 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 272 def absolute_uri if !block_given? return @j_del.java_method(:absoluteURI, []).call() end raise ArgumentError, "Invalid arguments when calling absolute_uri()" end |
- (self) body_handler { ... }
This saves the user having to manually setting a data and end handler and append the chunks of the body until the whole body received. Don't use this if your request body is large - you could potentially run out of RAM.
284 285 286 287 288 289 290 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 284 def body_handler if block_given? @j_del.java_method(:bodyHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Buffer)) })) return self end raise ArgumentError, "Invalid arguments when calling body_handler()" end |
- (Fixnum) bytes_read
197 198 199 200 201 202 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 197 def bytes_read if !block_given? return @j_del.java_method(:bytesRead, []).call() end raise ArgumentError, "Invalid arguments when calling bytes_read()" end |
- (::Vertx::HttpConnection) connection
460 461 462 463 464 465 466 467 468 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 460 def connection if !block_given? if @cached_connection != nil return @cached_connection end return @cached_connection = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:connection, []).call(),::Vertx::HttpConnection) end raise ArgumentError, "Invalid arguments when calling connection()" end |
- (Fixnum) cookie_count
498 499 500 501 502 503 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 498 def if !block_given? return @j_del.java_method(:cookieCount, []).call() end raise ArgumentError, "Invalid arguments when calling cookie_count()" end |
- (self) custom_frame_handler { ... }
452 453 454 455 456 457 458 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 452 def custom_frame_handler if block_given? @j_del.java_method(:customFrameHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::HttpFrame)) })) return self end raise ArgumentError, "Invalid arguments when calling custom_frame_handler()" end |
- (self) end_handler { ... }
126 127 128 129 130 131 132 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 126 def end_handler if block_given? @j_del.java_method(:endHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield }) return self end raise ArgumentError, "Invalid arguments when calling end_handler()" end |
- (true, false) ended?
442 443 444 445 446 447 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 442 def ended? if !block_given? return @j_del.java_method(:isEnded, []).call() end raise ArgumentError, "Invalid arguments when calling ended?()" end |
- (self) exception_handler { ... }
83 84 85 86 87 88 89 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 83 def exception_handler if block_given? @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) })) return self end raise ArgumentError, "Invalid arguments when calling exception_handler()" end |
- (true, false) expect_multipart?
368 369 370 371 372 373 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 368 def expect_multipart? if !block_given? return @j_del.java_method(:isExpectMultipart, []).call() end raise ArgumentError, "Invalid arguments when calling expect_multipart?()" end |
- (self) fetch(amount = nil)
117 118 119 120 121 122 123 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 117 def fetch(amount=nil) if amount.class == Fixnum && !block_given? @j_del.java_method(:fetch, [Java::long.java_class]).call(amount) return self end raise ArgumentError, "Invalid arguments when calling fetch(#{amount})" end |
- (::Vertx::MultiMap) form_attributes
Be aware that the attributes will only be available after the whole body has been received, i.e. after the request end handler has been called.
#set_expect_multipart must be called first before trying to get the form attributes.
392 393 394 395 396 397 398 399 400 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 392 def form_attributes if !block_given? if @cached_form_attributes != nil return @cached_form_attributes end return @cached_form_attributes = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:formAttributes, []).call(),::Vertx::MultiMap) end raise ArgumentError, "Invalid arguments when calling form_attributes()" end |
- (::Vertx::Cookie) get_cookie(name = nil)
491 492 493 494 495 496 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 491 def (name=nil) if name.class == String && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getCookie, [Java::java.lang.String.java_class]).call(name),::Vertx::Cookie) end raise ArgumentError, "Invalid arguments when calling get_cookie(#{name})" end |
- (String) get_form_attribute(attributeName = nil)
404 405 406 407 408 409 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 404 def get_form_attribute(attributeName=nil) if attributeName.class == String && !block_given? return @j_del.java_method(:getFormAttribute, [Java::java.lang.String.java_class]).call(attributeName) end raise ArgumentError, "Invalid arguments when calling get_form_attribute(#{attributeName})" end |
- (String) get_header(headerName = nil)
226 227 228 229 230 231 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 226 def get_header(headerName=nil) if headerName.class == String && !block_given? return @j_del.java_method(:getHeader, [Java::java.lang.String.java_class]).call(headerName) end raise ArgumentError, "Invalid arguments when calling get_header(#{headerName})" end |
- (String) get_param(paramName = nil)
245 246 247 248 249 250 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 245 def get_param(paramName=nil) if paramName.class == String && !block_given? return @j_del.java_method(:getParam, [Java::java.lang.String.java_class]).call(paramName) end raise ArgumentError, "Invalid arguments when calling get_param(#{paramName})" end |
- (self) handler { ... }
92 93 94 95 96 97 98 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 92 def handler if block_given? @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Buffer)) })) return self end raise ArgumentError, "Invalid arguments when calling handler()" end |
- (::Vertx::MultiMap) headers
214 215 216 217 218 219 220 221 222 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 214 def headers if !block_given? if @cached_headers != nil return @cached_headers end return @cached_headers = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:headers, []).call(),::Vertx::MultiMap) end raise ArgumentError, "Invalid arguments when calling headers()" end |
- (String) host
190 191 192 193 194 195 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 190 def host if !block_given? return @j_del.java_method(:host, []).call() end raise ArgumentError, "Invalid arguments when calling host()" end |
- (::Vertx::SocketAddress) local_address
null
(e.g a server bound on a domain socket)
262 263 264 265 266 267 268 269 270 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 262 def local_address if !block_given? if @cached_local_address != nil return @cached_local_address end return @cached_local_address = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:localAddress, []).call(),::Vertx::SocketAddress) end raise ArgumentError, "Invalid arguments when calling local_address()" end |
- (:OPTIONS, ...) method
141 142 143 144 145 146 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 141 def method if !block_given? return @j_del.java_method(:method, []).call().name.intern end raise ArgumentError, "Invalid arguments when calling method()" end |
- (::Vertx::NetSocket) net_socket
CONNECT
requests, a 200
response is sent with no content-length
header set
before returning the socket.
server.requestHandler(req -> {
if (req.method() == HttpMethod.CONNECT) {
// Send a 200 response to accept the connect
NetSocket socket = req.netSocket();
socket.handler(buff -> {
socket.write(buff);
});
}
...
});
For other HTTP/1 requests once you have called this method, you must handle writing to the connection yourself using
the net socket, the server request instance will no longer be usable as normal. USE THIS WITH CAUTION! Writing to the socket directly if you don't know what you're
doing can easily break the HTTP protocol.
With HTTP/2, a 200
response is always sent with no content-length
header set before returning the socket
like in the CONNECT
case above.
319 320 321 322 323 324 325 326 327 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 319 def net_socket if !block_given? if @cached_net_socket != nil return @cached_net_socket end return @cached_net_socket = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:netSocket, []).call(),::Vertx::NetSocket) end raise ArgumentError, "Invalid arguments when calling net_socket()" end |
- (::Vertx::MultiMap) params
233 234 235 236 237 238 239 240 241 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 233 def params if !block_given? if @cached_params != nil return @cached_params end return @cached_params = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:params, []).call(),::Vertx::MultiMap) end raise ArgumentError, "Invalid arguments when calling params()" end |
- (String) path
176 177 178 179 180 181 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 176 def path if !block_given? return @j_del.java_method(:path, []).call() end raise ArgumentError, "Invalid arguments when calling path()" end |
- (self) pause
100 101 102 103 104 105 106 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 100 def pause if !block_given? @j_del.java_method(:pause, []).call() return self end raise ArgumentError, "Invalid arguments when calling pause()" end |
- (::Vertx::Pipe) pipe
WriteStream
.
58 59 60 61 62 63 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 58 def pipe if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:pipe, []).call(),::Vertx::Pipe,::Vertx::Buffer.j_api_type) end raise ArgumentError, "Invalid arguments when calling pipe()" end |
- (void) pipe_to(dst = nil) { ... }
This method returns an undefined value.
Pipe thisReadStream
to the WriteStream
.
Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the handler
will be
called with the result.
73 74 75 76 77 78 79 80 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 73 def pipe_to(dst=nil) if dst.class.method_defined?(:j_del) && !block_given? return @j_del.java_method(:pipeTo, [Java::IoVertxCoreStreams::WriteStream.java_class]).call(dst.j_del) elsif dst.class.method_defined?(:j_del) && block_given? return @j_del.java_method(:pipeTo, [Java::IoVertxCoreStreams::WriteStream.java_class,Java::IoVertxCore::Handler.java_class]).call(dst.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) })) end raise ArgumentError, "Invalid arguments when calling pipe_to(#{dst})" end |
- (String) query
183 184 185 186 187 188 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 183 def query if !block_given? return @j_del.java_method(:query, []).call() end raise ArgumentError, "Invalid arguments when calling query()" end |
- (String) raw_method
148 149 150 151 152 153 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 148 def raw_method if !block_given? return @j_del.java_method(:rawMethod, []).call() end raise ArgumentError, "Invalid arguments when calling raw_method()" end |
- (::Vertx::SocketAddress) remote_address
null
(e.g a server bound on a domain socket)
252 253 254 255 256 257 258 259 260 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 252 def remote_address if !block_given? if @cached_remote_address != nil return @cached_remote_address end return @cached_remote_address = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:remoteAddress, []).call(),::Vertx::SocketAddress) end raise ArgumentError, "Invalid arguments when calling remote_address()" end |
- (::Vertx::HttpServerResponse) response
204 205 206 207 208 209 210 211 212 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 204 def response if !block_given? if @cached_response != nil return @cached_response end return @cached_response = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:response, []).call(),::Vertx::HttpServerResponse) end raise ArgumentError, "Invalid arguments when calling response()" end |
- (self) resume
108 109 110 111 112 113 114 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 108 def resume if !block_given? @j_del.java_method(:resume, []).call() return self end raise ArgumentError, "Invalid arguments when calling resume()" end |
- (String) scheme
162 163 164 165 166 167 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 162 def scheme if !block_given? return @j_del.java_method(:scheme, []).call() end raise ArgumentError, "Invalid arguments when calling scheme()" end |
- (self) set_expect_multipart(expect = nil)
360 361 362 363 364 365 366 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 360 def set_expect_multipart(expect=nil) if (expect.class == TrueClass || expect.class == FalseClass) && !block_given? @j_del.java_method(:setExpectMultipart, [Java::boolean.java_class]).call(expect) return self end raise ArgumentError, "Invalid arguments when calling set_expect_multipart(#{expect})" end |
- (true, false) ssl?
155 156 157 158 159 160 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 155 def ssl? if !block_given? return @j_del.java_method(:isSSL, []).call() end raise ArgumentError, "Invalid arguments when calling ssl?()" end |
- (Hash) stream_priority
null
470 471 472 473 474 475 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 470 def stream_priority if !block_given? return @j_del.java_method(:streamPriority, []).call() != nil ? JSON.parse(@j_del.java_method(:streamPriority, []).call().toJson.encode) : nil end raise ArgumentError, "Invalid arguments when calling stream_priority()" end |
- (self) stream_priority_handler { ... }
This is not implemented for HTTP/1.x.
481 482 483 484 485 486 487 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 481 def stream_priority_handler if block_given? @j_del.java_method(:streamPriorityHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) })) return self end raise ArgumentError, "Invalid arguments when calling stream_priority_handler()" end |
- (void) to_net_socket { ... }
This method returns an undefined value.
Establish a TCP tunnel with the client. This must be called only for CONNECT
HTTP method and before any response is sent.
Calling this sends a 200
response with no content-length
header set and
then provides the NetSocket
for handling the created tunnel. Any HTTP header set on the
response before calling this method will be sent.
server.requestHandler(req -> {
if (req.method() == HttpMethod.CONNECT) {
// Send a 200 response to accept the connect
NetSocket socket = req.netSocket();
socket.handler(buff -> {
socket.write(buff);
});
}
...
});
350 351 352 353 354 355 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 350 def to_net_socket if block_given? return @j_del.java_method(:toNetSocket, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::NetSocket) : nil) })) end raise ArgumentError, "Invalid arguments when calling to_net_socket()" end |
- (void) to_web_socket { ... }
This method returns an undefined value.
Upgrade the connection of the current request to a WebSocket.
This is an alternative way of handling WebSockets and can only be used if no WebSocket handler is set on the
HttpServer
, and can only be used during the upgrade request during the WebSocket handshake.
Both #handler and #end_handler will be set to get the full body of the request that is necessary to perform the WebSocket handshake.
If you need to do an asynchronous upgrade, i.e not performed immediately in your request handler, you need to #pause the request in order to not lose HTTP events necessary to upgrade the request.
434 435 436 437 438 439 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 434 def to_web_socket if block_given? return @j_del.java_method(:toWebSocket, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::ServerWebSocket) : nil) })) end raise ArgumentError, "Invalid arguments when calling to_web_socket()" end |
- (::Vertx::ServerWebSocket) upgrade
This is an alternative way of handling WebSockets and can only be used if no WebSocket handler is set on the
HttpServer
, and can only be used during the upgrade request during the WebSocket handshake.
415 416 417 418 419 420 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 415 def upgrade if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:upgrade, []).call(),::Vertx::ServerWebSocket) end raise ArgumentError, "Invalid arguments when calling upgrade()" end |
- (self) upload_handler { ... }
378 379 380 381 382 383 384 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 378 def upload_handler if block_given? @j_del.java_method(:uploadHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::HttpServerFileUpload)) })) return self end raise ArgumentError, "Invalid arguments when calling upload_handler()" end |
- (String) uri
169 170 171 172 173 174 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 169 def uri if !block_given? return @j_del.java_method(:uri, []).call() end raise ArgumentError, "Invalid arguments when calling uri()" end |
- (:HTTP_1_0, ...) version
134 135 136 137 138 139 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_request.rb', line 134 def version if !block_given? return @j_del.java_method(:version, []).call().name.intern end raise ArgumentError, "Invalid arguments when calling version()" end |