Package flumotion :: Package component :: Package common :: Package streamer :: Module fragmentedresource :: Class FragmentedResource
[hide private]

Class FragmentedResource

source code

twisted.web.resource.Resource --+    
                                |    
      extern.log.log.Loggable --+    
                                |    
  resources.HTTPStreamingResource --+
                                    |
          extern.log.log.Loggable --+
                                    |
                                   FragmentedResource
Known Subclasses:

Nested Classes [hide private]

Inherited from twisted.web.resource.Resource: entityType

Instance Methods [hide private]
 
__init__(self, streamer, httpauth, secretKey, sessionTimeout)
Initialize.
source code
 
setMountPoint(self, mountPoint) source code
 
isReady(self) source code
 
_addClient(self, id)
Add a request, so it can be used for statistics.
source code
 
_removeClient(self, uid)
Delete a request from the list
source code
 
_renewAuthentication(self, request, sessionID, authResponse) source code
 
_handleNotReady(self, request) source code
dict
_getExtraLogArgs(self, request)
Extra arguments for logging.
source code
 
_checkSession(self, request)
From t.w.s.Request.getSession() Associates the request to a session using the 'flumotion-session' cookie and updates the session's timeout.
source code
 
_createSession(self, request, authExpiracy=None, sessionID=None)
From t.w.s.Site.makeSession() Generates a new Session instance and store it for future reference
source code
 
_generateToken(self, sessionID, clientIP, authExpiracy)
Generate a cryptografic token: PAYLOAD = SESSION_ID||:||AUTH_EXPIRACY PRIVATE = CLIENT_IP||:||MOUNT_POINT SIG=HMAC(SECRET,PAYLOAD||:||PRIVATE) TOKEN=BASE64(PAYLOAD||:||SIG)
source code
 
_cookieIsValid(self, cookie, clientIP, urlSessionID)
Checks whether the cookie is valid against the authentication expiracy time and the signature (and implicitly the client IP and mount point).
source code
 
_errorMessage(self, request, error_code) source code
 
_renderNotFoundResponse(self, failure, request) source code
 
_renderForbidden(self, request) source code
 
_writeHeaders(self, request, content, code=200)
Write out the HTTP headers for the incoming HTTP request.
source code
 
getBytesSent(self) source code
 
getBytesReceived(self) source code
 
render(self, request)
Render a given resource.
source code
 
_logWrite(self, request) source code
 
_logRequest(self, error, request) source code

Inherited from resources.HTTPStreamingResource: getMaxAllowedClients, logWrite, reachedServerLimits, removeAllClients, rotateLogs, setBandwidthLimit, setLogFilter, setRedirectionOnLimits, setRoot, setUserLimit

Inherited from twisted.web.resource.Resource: __providedBy__, __provides__, delEntity, getChild, 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]
  HTTP_NAME = 'FlumotionAppleHTTPLiveServer'
  HTTP_SERVER = 'FlumotionAppleHTTPLiveServer/0.10.0'
  logCategory = 'fragmented-resource'
Implementors can provide a category to log their messages under.

Inherited from resources.HTTPStreamingResource: __reserve_fds__, isLeaf

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

Method Details [hide private]

__init__(self, streamer, httpauth, secretKey, sessionTimeout)
(Constructor)

source code 

Initialize.

Parameters:
Overrides: twisted.web.resource.Resource.__init__

isReady(self)

source code 
Overrides: resources.HTTPStreamingResource.isReady

_addClient(self, id)

source code 

Add a request, so it can be used for statistics.

Parameters:
  • id - the of the client (fd or session id)
Overrides: resources.HTTPStreamingResource._addClient
(inherited documentation)

_removeClient(self, uid)

source code 

Delete a request from the list

Parameters:
  • request - the id of the client
Overrides: resources.HTTPStreamingResource._removeClient
(inherited documentation)

_handleNotReady(self, request)

source code 
Overrides: resources.HTTPStreamingResource._handleNotReady

_getExtraLogArgs(self, request)

source code 

Extra arguments for logging. Should be overriden by subclasses that provide extra arguments for logging

Returns: dict
A dictionary with the extra arguments
Overrides: resources.HTTPStreamingResource._getExtraLogArgs
(inherited documentation)

_checkSession(self, request)

source code 

From t.w.s.Request.getSession() Associates the request to a session using the 'flumotion-session' cookie and updates the session's timeout. If the authentication has expired, re-authenticates the session and updates the cookie with the new authentication's expiracy time. If the cookie is not valid (bad IP or bad signature) or the session has expired, it creates a new session.

_cookieIsValid(self, cookie, clientIP, urlSessionID)

source code 

Checks whether the cookie is valid against the authentication expiracy time and the signature (and implicitly the client IP and mount point). Returns the state of the cookie among 3 options: VALID: the cookie is valid (expiracy and signature are OK) RENEW_AUTH: the cookie is valid but the authentication has expired NOT_VALID: the cookie is not valid

render(self, request)

source code 

Render a given resource. See IResource's render method.

I delegate to methods of self with the form 'render_METHOD' where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

render_METHOD methods are expected to return a string which will be the rendered page, unless the return value is twisted.web.server.NOT_DONE_YET, in which case it is this class's responsibility to write the results to request.write(data), then call request.finish().

Old code that overrides render() directly is likewise expected to return a string or NOT_DONE_YET.

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