crossbar.webservice.base

Classes

ExtReverseProxyResource

Resource that renders the results gotten from another server

RedirectResource

Redirecting Twisted Web resource.

Resource404

Custom error page (404) Twisted Web resource.

RootResource

Root resource when you want one specific resource be the default serving

RouterWebService

A Web service configured on a URL path on a Web transport.

RouterWebServiceNestedPath

Nested sub-URL path (pseudo-)service.

RouterWebServiceRedirect

Redirecting Web service.

RouterWebServiceReverseWeb

Reverse Web proxy service.

RouterWebServiceTwistedWeb

Generic Twisted Web base service.

Functions

Module Contents

class ExtReverseProxyResource(host, port, path, forwarded_port=None, forwarded_proto=None)[source]

Bases: twisted.web.proxy.ReverseProxyResource

Resource that renders the results gotten from another server

Put this resource in the tree to cause everything below it to be relayed to a different server.

@ivar proxyClientFactoryClass: a proxy client factory class, used to create

new connections.

@type proxyClientFactoryClass: L{ClientFactory}

@ivar reactor: the reactor used to create connections. @type reactor: object providing L{twisted.internet.interfaces.IReactorTCP}

_forwarded_port = None[source]
_forwarded_proto = None[source]
getChild(path, request)[source]

Create and return a proxy resource with the same proxy configuration as this one, except that its path also contains the segment given by C{path} at the end.

log[source]
render(request)[source]

Render a request by forwarding it to the proxied server.

class RedirectResource(redirect_url)[source]

Bases: twisted.web.resource.Resource

Redirecting Twisted Web resource.

_redirect_url[source]
isLeaf = True[source]
render_GET(request)[source]
class Resource404(templates, directory)[source]

Bases: twisted.web.resource.Resource

Custom error page (404) Twisted Web resource.

_directory[source]
_page[source]
_pid[source]
render_GET(request)[source]
render_HEAD(request)[source]

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

class RootResource(rootResource, children)[source]

Bases: twisted.web.resource.Resource

Root resource when you want one specific resource be the default serving resource for a Twisted Web site, but have sub-paths served by different resources.

_rootResource[source]
children[source]
getChild(path, request)[source]

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

class RouterWebService(transport, path, config=None, resource=None)[source]

Bases: object

A Web service configured on a URL path on a Web transport.

__contains__(path)[source]
__delitem__(path)[source]
__getitem__(path)[source]
__setitem__(path, webservice)[source]
_config[source]
_path[source]
_paths[source]
_resource[source]
_transport[source]
property config[source]
log[source]
property path[source]
property resource[source]
class RouterWebServiceNestedPath(transport, path, config=None, resource=None)[source]

Bases: RouterWebService

Nested sub-URL path (pseudo-)service.

static create(transport, path, config)[source]
class RouterWebServiceRedirect(transport, path, config=None, resource=None)[source]

Bases: RouterWebService

Redirecting Web service.

static create(transport, path, config)[source]
class RouterWebServiceReverseWeb(transport, path, config=None, resource=None)[source]

Bases: RouterWebService

Reverse Web proxy service.

static create(transport, path, config)[source]
class RouterWebServiceTwistedWeb(transport, path, config=None, resource=None)[source]

Bases: RouterWebService

Generic Twisted Web base service.

static create(transport, path, config)[source]
set_cross_origin_headers(request)[source]