File Information
Library: RemotingNG
Package: Transport
Header: Poco/RemotingNG/Listener.h
Description
Inheritance
Direct Base Classes: Poco::RefCountedObject
All Base Classes: Poco::RefCountedObject
Known Derived Classes: Poco::RemotingNG::TCP::Listener, Poco::RemotingNG::REST::Listener, Poco::RemotingNG::HTTP::Listener, Poco::RemotingNG::SOAP::Listener, EventListener, Poco::RemotingNG::JSONRPC::Listener
Member Summary
Member Functions: createURI, endPoint, getAuthenticator, getAuthorizer, handlesURI, protocol, registerObject, setAuthenticator, setAuthorizer, start, stop, unregisterObject
Inherited Functions: duplicate, referenceCount, release
Types Aliases
Ptr
using Ptr = Poco::AutoPtr < Listener >;
Constructors
Listener
Listener(
const std::string & endPoint
);
Creates a Listener.
Takes a local endpoint address as input. For network based listener, this will typically be a port number or socket address in the form <host>:<port>.
Destructor
~Listener
virtual ~Listener();
Destroys the Listener.
Member Functions
createURI
virtual std::string createURI(
const Identifiable::TypeId & typeId,
const Identifiable::ObjectId & objectId
) = 0;
Create an URI for accessing the object with the given TypeId and ObjectId through the Listener.
Must return a complete URI for the object. URI scheme and authority can be freely chosen by the Listener; however the URI path must be in format /<protocol>/<typeId>/<objectId>.
endPoint
const std::string & endPoint() const;
Returns the local endpoint of the Listener, as given in the constructor.
getAuthenticator
Authenticator::Ptr getAuthenticator() const;
Returns the Authenticator instance for this Listener.
getAuthorizer
Authorizer::Ptr getAuthorizer() const;
Returns the Authorizer instance for this Listener.
handlesURI
virtual bool handlesURI(
const std::string & uri
) = 0;
Check whether the given URI can be handled by this Listener instance.
This is used by the ORB to check whether a given remote service object identified by the URI is actually located on the same ORB.
In some cases, simply comparing the URI against all locally registered URIs does not work, as URI may be different even if they reference the same object. For example, the URIs http://localhost/a/b/c and http://127.0.0.1/a/b/c are different, but actually reference the same resource.
An implementation of this function should examine the authority part (host and port) of the URI and check if it is equivalent to the endpoint handled by the Listener.
A simple implementation can always return false. In this case, local objects will only be recognized if the URI exactly matches the URI created by the Listener when the object was registered.
protocol
virtual const std::string & protocol() const = 0;
registerObject
virtual void registerObject(
RemoteObject::Ptr pRemoteObject,
Skeleton::Ptr pSkeleton
) = 0;
Registers a RemoteObject and its Skeleton with the Listener.
Depending on the protocol, the Listener can opt to let the ORB handle all invocations (i.e. with a protocol that sends the full URI with each request), which allows to implement a request handler that simply calls ORB::invoke(). In this case the Listener does not need to actually register the RemoteObject and Listener internally.
Note that registerObject() is called from inside the ORB, and thus is not allowed to call back into the ORB (danger of dead-lock).
setAuthenticator
virtual void setAuthenticator(
Authenticator::Ptr pAuthenticator
);
Sets the Authenticator instance for this Listener.
An Authenticator should be set immediately after creating the Listener, before registering it with the ORB and accepting requests.
Can be overridden by subclasses, but overriders should call the base class implementation.
setAuthorizer
virtual void setAuthorizer(
Authorizer::Ptr pAuthorizer
);
Sets the Authorizer instance for this Listener.
An Authorizer should be set immediately after creating the Listener, before registering it with the ORB and accepting requests.
Can be overridden by subclasses, but overriders should call the base class implementation.
start
virtual void start() = 0;
Start accepting requests.
stop
virtual void stop() = 0;
Stop accepting requests.
unregisterObject
virtual void unregisterObject(
RemoteObject::Ptr pRemoteObject
) = 0;
Unregisters a RemoteObject from the Listener.