New functionnal explanations.

This commit is contained in:
rchantereau 2004-05-12 16:52:10 +00:00
parent a773349b93
commit 95b40a8a18
4 changed files with 192 additions and 1 deletions

View File

@ -37,7 +37,7 @@ A *station* can be accessed from 3 way:
The *internals ways* are nodes pointing to a *station*.
Element
========
=======
This is a XML element node.

View File

@ -0,0 +1,68 @@
Example
=======
We want to access to http://localhost/dir/images/data.jpg.
This file is on the computer at expression/vhosts/myvhost/dir/images/data.jpg.
Order of calls:
Server.py:handleHttpCommand:
- Initialize local web site variables.
- Find the begin point of the walk of this virtual host, the *documentRoot*. This is the first *station*.
Every *station* could be a *documentRoot*. This root *station* is titled *rootDataHolder* instance of
*directoryHolder*.
- Parses the URL.
rootDataHolder.walk(['dir', 'images', 'data.jpg'], 'GET', None):
- *rootDataHolder* is a *station*.
- *walkToEvaluation* returns *self*.
- *walkToContent* to select to correct walk to the content of the requested *station*.
- Call *walkToItem* returns the *directoryHolder* of 'dir' and the left stations sequence.
- returns the correct walk returns.
- The returned *station* is not the same as actual *station*.
- The sequence is not empty.
- *isAccessAuthorized* for the specified command is true.
directoryHolder.walk(['images', 'data.jpg'], 'GET', None):
- *directoryHolder* is a *station*.
- *walkToEvaluation* returns *self*.
- *walkToContent* to select to correct walk to the content of the requested *station*.
- Call *walkToItem* returns the *directoryHolder* of 'images' and the left stations sequence.
- returns the correct walk returns.
- The returned *station* is not the same as actual *station*.
- The sequence is not empty.
- *isAccessAuthorized* for the specified command is true.
directoryHolder.walk(['data.jpg'], 'GET', None):
- *directoryHolder* is a *station*.
- *walkToEvaluation* returns *self*.
- *walkToContent* to select to correct walk to the content of the requested *station*.
- Call *walkToItem* returns the *imageHolder* of 'data.jpg' and an empty sequence.
- returns the correct walk returns.
- The returned *station* is not the same as actual *station*.
- The sequence is empty.
- *isAccessAuthorized* for the specified command is true.
imageHolder.walk([], 'GET', None):
- *imageHolder* is a *station*.
- *walkToEvaluation* returns *self*.
- *walkToContent* return self and the empty sequence.
- The returned *station* is the same as actual *station*.
- The sequence is empty.
- *isAccessAuthorized* for the specified command is true.
- As 'GET' is the command, the *doHttpGet* method is called.
imageHolder.doHttpGet()
- Do nothing.
imageHolder.doHttpGetSource()
- Do nothing.
imageHolder.outputHttpSource()
- Open the image file descriptor.
httpRequestHandler.outputData(imageFD, 'http://localhost/dir/images/data.jpg', mime/type, modificationDate)
The sequence is not empty and the returned *station* is instanciated,

View File

@ -0,0 +1,67 @@
Example
=======
We want to access to http://localhost/dir/data.xml.
This file is on the computer at expression/vhosts/myvhost/dir/data.xml.
Order of calls:
Server.py:handleHttpCommand:
- Initialize local web site variables.
- Find the begin point of the walk of this virtual host, the *documentRoot*. This is the first *station*.
Every *station* could be a *documentRoot*. This root *station* is titled *rootDataHolder* instance of
*directoryHolder*.
- Parses the URL.
rootDataHolder.walk(['dir', 'data.xml'], 'GET', None):
- *rootDataHolder* is a *station*.
- *walkToEvaluation* returns *self*.
- *walkToContent* to select to correct walk to the content of the requested *station*.
- Call *walkToItem* returns the *directoryHolder* of 'dir' and the left stations sequence.
- returns the correct walk returns.
- The returned *station* is not the same as actual *station*.
- The sequence is not empty.
- *isAccessAuthorized* for the specified command is true.
directoryHolder.walk(['data.xml'], 'GET', None):
- *directoryHolder* is a *station*.
- *walkToEvaluation* returns *self*.
- *walkToContent* to select to correct walk to the content of the requested *station*.
- Call *walkToItem* returns the *xmlHolder* of 'data.xml' and an empty sequence.
- returns the correct walk returns.
- The returned *station* is not the same as actual *station*.
- The sequence is empty.
- *isAccessAuthorized* for the specified command is true.
xmlHolder.walk([], 'GET', None):
- *xmlHolder* is a *station*.
- *walkToEvaluation* returns *self*.
- *walkToContent*
*walkToItem* return self.rootElement (*self* is the *xmlHolder* *station*).
- The returned *station* is not the same as actual *station*.
- The sequence is empty.
- *isAccessAuthorized* for the specified command is true.
rootElement.walk([], 'GET', None):
- *element* is a *station*.
- *walkToEvaluation* returns *self*.
- *walkToContent* return self and the empty sequence.
- The returned *station* is the same as actual *station*.
- The sequence is empty.
- *isAccessAuthorized* for the specified command is true.
- As 'GET' is the command, the *doHttpGet* method is called.
rootElement.doHttpGet()
- Do nothing.
rootElement.doHttpGetStyled()
- *generateHtmlDocument* generate a XHTML *document* object with the XML source in 'pre' tags.
- Get the XSLT if applicable.
rootElement.outputHttpHtmlDocument()
- Apply the XSLT if applicable.
httpRequestHandler.outputData(string, 'http://localhost/dir/images/data.jpg', mime/type, modificationDate)
The sequence is not empty and the returned *station* is instanciated,

View File

@ -0,0 +1,56 @@
data.xml
========
<myRoot>
...
...
...
</myRoot>
Request
=======
'data.xml/action'
Explanation
===========
*In this explanation, we are in the xmlHolder of data.xml. The myRoot tag is registered with our class myRootElement.*
xmlHolder.walk(['action'], 'GET', None):
- *xmlHolder* is a *station*.
- *walkToEvaluation* returns *self*.
- *walkToContent*
xmlHolder.walkToItem(['action'], 'GET', None):
- call the next method.
document.getRootElement():
- get the *rootNode* (rootElement) of the libXML2 document.
elements.newElement(*rootNode*):
- Extract the node name and the namespace.
- Lookup the registered corresponding python class, or get the default python class.
- return the chosen class instance (in our case, the *myRootElement*).
- The returned *station* is not the same as actual *station*.
- The sequence is empty.
- *isAccessAuthorized* for the specified command is true.
myRootElement.walk(['action'], 'GET', None):
- *myRootElement* is a *station*.
- *walkToEvaluation* returns *self*.
- *walkToContent*
- *walkToItem*(['action'], 'GET', None):
- do nothing.
- *walkToAction*
- We have overridden the method.
httpRequestHandler.outputData(string, '.../data.xml/action', mime/type, modificationDate)
Notes
=====
In order to access to more than one level, we have to code it for the moment.