Package flumotion :: Package component :: Package misc :: Package httpserver :: Module httpfile :: Class File
[hide private]

Class File

source code

twisted.web.resource.Resource --+
                                |
      extern.log.log.Loggable --+
                                |
                               File
Known Subclasses:

this file is inspired by/adapted from twisted.web.static

Nested Classes [hide private]

Inherited from twisted.web.resource.Resource: entityType

Instance Methods [hide private]
 
__init__(self, path, httpauth, mimeToResource=None, rateController=None, requestModifiers=None, metadataProvider=None)
Initialize.
source code
 
getChild(self, path, request)
Retrieve a 'child' resource from me.
source code
 
render(self, request)
The request gets rendered by asking the httpauth object for authentication, which returns a deferred.
source code
 
_authenticationFailed(self, failure, request) source code
 
_requestAuthenticated(self, result, request) source code
 
_terminateRequest(self, body, request) source code
 
_renderRequest(self, _, request) source code
 
_fileOpenFailure(self, failure, request) source code
 
_gotProvider(self, provider, request) source code
 
_startRequest(self, request, header, provider, first, last) source code
 
_configureTransfer(self, metadata, request, header, provider, first, last) source code
 
do_prepareBody(self, request, provider, first, last)
I am called before the body of the response gets written, and after generic header setting has been done.
source code

Inherited from twisted.web.resource.Resource: __providedBy__, __provides__, delEntity, getChildForRequest, getChildWithDefault, getDynamicEntity, getStaticEntity, listDynamicEntities, listDynamicNames, listEntities, listNames, listStaticEntities, listStaticNames, putChild, reallyPutEntity, render_HEAD

Inherited from extern.log.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure, writeMarker

Class Variables [hide private]
  logCategory = 'httpserver'
Implementors can provide a category to log their messages under.
  defaultType = 'application/octet-stream'
  childNotFound = errorpage.NoResource("File not found.")
  forbiddenerrorpage = errorpage.ForbiddenResource("Access forbi...
  badRequest = BadRequest()
  internalServerError = InternalServerError()
  serviceUnavailable = ServiceUnavailableError()

Inherited from twisted.web.resource.Resource: __implemented__, isLeaf, server

Method Details [hide private]

__init__(self, path, httpauth, mimeToResource=None, rateController=None, requestModifiers=None, metadataProvider=None)
(Constructor)

source code 

Initialize.

Overrides: twisted.web.resource.Resource.__init__
(inherited documentation)

getChild(self, path, request)

source code 

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:
  • path - a string, describing the child
  • request - a twisted.web.server.Request specifying meta-information about the request that is being made for this child.
Overrides: twisted.web.resource.Resource.getChild
(inherited documentation)

render(self, request)

source code 

The request gets rendered by asking the httpauth object for authentication, which returns a deferred. This deferred will callback when the request gets authenticated.

Overrides: twisted.web.resource.Resource.render

do_prepareBody(self, request, provider, first, last)

source code 

I am called before the body of the response gets written, and after generic header setting has been done.

I set Content-Length.

Override me to send additional headers, or to prefix the body with data headers.

I can return a Deferred, that should fire with a string header. That header will be written to the request.


Class Variable Details [hide private]

forbiddenerrorpage

Value:
errorpage.ForbiddenResource("Access forbidden")