l.s.w.s.VirtualHostRequestPublicationFactory : class documentation

Part of lp.services.webapp.servers View In Hierarchy

Known subclasses: lp.services.webapp.servers.VHostWebServiceRequestPublicationFactory, lp.services.webapp.servers.WebServiceRequestPublicationFactory, lp.services.webapp.servers.XMLRPCRequestPublicationFactory

An IRequestPublicationFactory handling request to a Launchpad vhost.

This factory will accepts requests to a particular Launchpad virtual host that matches a particular port and set of HTTP methods.

Method __init__ Creates a new factory.
Method canHandle See IRequestPublicationFactory.
Method __call__ See IRequestPublicationFactory.
Method getRequestAndPublicationFactories Return the request and publication factories to use.
Method getAcceptableMethods Return the HTTP methods acceptable in this particular environment.
Method checkRequest Makes sure that the incoming HTTP request is of an expected type.
def __init__(self, vhost_name, request_factory, publication_factory, port=None, methods=None, handle_default_host=False):
Creates a new factory.
Parametersvhost_nameThe config section defining the virtual host handled by this factory.
request_factoryThe request factory to use for this virtual host's requests.
publication_factoryThe publication factory to use for this virtual host's requests.
portThe port which is handled by this factory. If this is None, this factory will handle requests that originate on any port.
methodsA sequence of HTTP methods that this factory handles.
handle_default_hostWhether or not this factory is capable of handling requests that specify no hostname.
def canHandle(self, environment):
See IRequestPublicationFactory.

Returns true if the HTTP host and port of the incoming request match the ones this factory is equipped to handle.

def __call__(self):
See IRequestPublicationFactory.

We know that this factory is the right one for the given host and port. But there might be something else wrong with the request. For instance, it might have the wrong HTTP method.

def getRequestAndPublicationFactories(self, environment):
Return the request and publication factories to use.

You can override this method if the request and publication can vary based on the environment.

def getAcceptableMethods(self, environment):
Return the HTTP methods acceptable in this particular environment.
def checkRequest(self, environment):
Makes sure that the incoming HTTP request is of an expected type.

This is different from canHandle() because we know the request went to the right place. It's just that it might be an invalid request for this handler.

ReturnsAn appropriate ProtocolErrorPublicationFactory if the HTTP request doesn't comply with the expected protocol. If the request does comply, (None, None).
API Documentation for Launchpad, generated by pydoctor at 2020-07-03 00:00:04.