Class
responsible for converting between an object and its id.
This, the default implementation, uses an object’s local ObjectSpace
__id__ as its id. This means that an object’s identification over drb remains valid only while that object instance remains alive within the server runtime.
For alternative mechanisms, see DRb::TimerIdConv
in drb/timeridconv.rb and DRbNameIdConv in sample/name.rb in the full drb distribution.
Error raised by the DRb
module when an attempt is made to refer to the context’s current drb server but the context does not have one. See current_server.
An exception wrapping a DRb::DRbUnknown
object
Class
wrapping a marshalled object whose type is unknown locally.
If an object is returned by a method invoked over drb, but the class of the object is unknown in the client namespace, or the object is a constant unknown in the client namespace, then the still-marshalled object is returned wrapped in a DRbUnknown
instance.
If this object is passed as an argument to a method invoked over drb, then the wrapped object is passed instead.
The class or constant name of the object can be read from the name
attribute. The marshalled object is held in the buf
attribute.
Object
wrapping a reference to a remote drb object.
Method
calls on this object are relayed to the remote object that this object is a stub for.
Class
handling the connection between a DRbObject
and the server the real object lives on.
This class maintains a pool of connections, to reduce the overhead of starting and closing down connections for each method call.
This class is used internally by DRbObject
. The user does not normally need to deal with it directly.
Object
wrapping a reference to a remote drb object.
Method
calls on this object are relayed to the remote object that this object is a stub for.
Class
responsible for converting between an object and its id.
This, the default implementation, uses an object’s local ObjectSpace
__id__ as its id. This means that an object’s identification over drb remains valid only while that object instance remains alive within the server runtime.
For alternative mechanisms, see DRb::TimerIdConv
in drb/timeridconv.rb and DRbNameIdConv in sample/name.rb in the full drb distribution.
Gateway id conversion forms a gateway between different DRb
protocols or networks.
The gateway needs to install this id conversion and create servers for each of the protocols or networks it will be a gateway between. It then needs to create a server that attaches to each of these networks. For example:
require 'drb/drb' require 'drb/unix' require 'drb/gw' DRb.install_id_conv DRb::GWIdConv.new gw = DRb::GW.new s1 = DRb::DRbServer.new 'drbunix:/path/to/gateway', gw s2 = DRb::DRbServer.new 'druby://example:10000', gw s1.thread.join s2.thread.join
Each client must register services with the gateway, for example:
DRb.start_service 'drbunix:', nil # an anonymous server gw = DRbObject.new nil, 'drbunix:/path/to/gateway' gw[:unix] = some_service DRb.thread.join
Implements DRb
over a UNIX socket
DRb
UNIX socket URIs look like drbunix:<path>?<option>
. The option is optional.
This class is the base class for Net::HTTP response classes.
Method Net::HTTP.get_response
returns an instance of one of the subclasses of Net::HTTPResponse:
Net::HTTP.get_response(uri) # => #<Net::HTTPOK 200 OK readbody=true> Net::HTTP.get_response(hostname, '/nosuch') # => #<Net::HTTPNotFound 404 Not Found readbody=true>
As does method Net::HTTP#request
:
req = Net::HTTP::Get.new(uri) Net::HTTP.start(hostname) do |http| http.request(req) end # => #<Net::HTTPOK 200 OK readbody=true>
Class Net::HTTPResponse includes module Net::HTTPHeader
, which provides access to response header values via (among others):
Hash-like method []
.
Specific reader methods, such as content_type
.
Examples:
res = Net::HTTP.get_response(uri) # => #<Net::HTTPOK 200 OK readbody=true> res['Content-Type'] # => "text/html; charset=UTF-8" res.content_type # => "text/html"
Class Net::HTTPResponse has a subclass for each HTTP status code. You can look up the response class for a given code:
Net::HTTPResponse::CODE_TO_OBJ['200'] # => Net::HTTPOK Net::HTTPResponse::CODE_TO_OBJ['400'] # => Net::HTTPBadRequest Net::HTTPResponse::CODE_TO_OBJ['404'] # => Net::HTTPNotFound
And you can retrieve the status code for a response object:
Net::HTTP.get_response(uri).code # => "200" Net::HTTP.get_response(hostname, '/nosuch').code # => "404"
The response subclasses (indentation shows class hierarchy):
Net::HTTPUnknownResponse
(for unhandled HTTP extensions).
Net::HTTPContinue
(100)
Net::HTTPSwitchProtocol
(101)
Net::HTTPProcessing
(102)
Net::HTTPEarlyHints
(103)
Net::HTTPOK
(200)
Net::HTTPCreated
(201)
Net::HTTPAccepted
(202)
Net::HTTPNoContent
(204)
Net::HTTPResetContent
(205)
Net::HTTPPartialContent
(206)
Net::HTTPMultiStatus
(207)
Net::HTTPAlreadyReported
(208)
Net::HTTPIMUsed
(226)
Net::HTTPMultipleChoices
(300)
Net::HTTPFound
(302)
Net::HTTPSeeOther
(303)
Net::HTTPNotModified
(304)
Net::HTTPUseProxy
(305)
Net::HTTPBadRequest
(400)
Net::HTTPUnauthorized
(401)
Net::HTTPPaymentRequired
(402)
Net::HTTPForbidden
(403)
Net::HTTPNotFound
(404)
Net::HTTPNotAcceptable
(406)
Net::HTTPRequestTimeOut
(408)
Net::HTTPConflict
(409)
Net::HTTPGone
(410)
Net::HTTPLengthRequired
(411)
Net::HTTPLocked
(423)
Net::HTTPUpgradeRequired
(426)
Net::HTTPTooManyRequests
(429)
Net::HTTPNotImplemented
(501)
Net::HTTPBadGateway
(502)
Net::HTTPGatewayTimeOut
(504)
Net::HTTPLoopDetected
(508)
Net::HTTPNotExtended
(510)
There is also the Net::HTTPBadResponse exception which is raised when there is a protocol error.
Response class for No Content
responses (status code 204).
The No Content
response indicates that the server successfully processed the request, and is not returning any content.
References:
Response class for Reset Content
responses (status code 205).
The Reset Content
response indicates that the server successfully processed the request, asks that the client reset its document view, and is not returning any content.
References:
Response class for Found
responses (status code 302).
The Found
response indicates that the client should look at (browse to) another URL.
References:
Response class for Temporary Redirect
responses (status code 307).
The request should be repeated with another URI
; however, future requests should still use the original URI
.
References:
Response class for Permanent Redirect
responses (status code 308).
This and all future requests should be directed to the given URI
.
References:
Response class for Unauthorized
responses (status code 401).
Authentication is required, but either was not provided or failed.
References:
Response class for Not Found
responses (status code 404).
The requested resource could not be found but may be available in the future.
References:
Response class for Request Timeout
responses (status code 408).
The server timed out waiting for the request.
References:
Response class for Request Timeout
responses (status code 408).
The server timed out waiting for the request.
References:
Response class for Gone
responses (status code 410).
The resource requested was previously in use but is no longer available and will not be available again.
References:
Response class for Payload Too Large
responses (status code 413).
The request is larger than the server is willing or able to process.
References: