Beesnest - Personal Application Server |
Home | Documents | Downloads/Code | Test It | About | Contact Me |
In addition you should set at least one file type that will allow for an
execution of scripts. Set the Exec entry of this file type to yes.
Look at this example for details.
On my server I set just files of type .bns to be executed, that way I save
server resources (Note that the "#include..." command is not a script).
You can also set a file type that will go directly to a script engine. Then this
file should be written in this script language. For example I set the py
files to go directly to the BnPython script engine. look at the example
for that as well.
Important note about the bnscript tag: This is not a regular HTML tag. First, it is case sensitive (so BnScript won't work). Second, it will be executed also if it is in an HTML comment.
If under the Server configuration, you set the entry Default-Engine to "TestEngine", you will be able to use it as:
This feature is really making Beesnest a more complicated software (I need to run
the script in a separate thread), but it is important to have some time limit.
I WILL IMPLEMENT IT JUST IN VERSION 2
There is also a size limit on the response buffer. in the configuration files it sets by the Response-SizeLimit, and you can change it in the same way by using BNI_SizeLimit. Also here zero will cancel the size limit. Every engine has to implement the size limit by it's own.
In addition you can set the status code to other codes than 200 (OK). To set the status code use the SetHeader command of your script engine, with a "header" name of STATUS_CODE. The code should be passed as string in the second argument. Every string that will not represent a number (like empty string) will set the code to 0. You can also get the status code by calling GetHeader with the name STATUS_CODE.
As mentioned, in order to allow a script engine to be stored, you need to configure it in the configuration file of this engine. While an engine is configured to be Storable, it will be stored for a logged in user by default. If you want to release this engine use delete in the closing tag:
If you want to make sure a stored engine will get released after some time it was idle, set the Engine-Time-Limit entry in the Server configuration. This time limit is in seconds, and there is one time limit for all types of engines. If this entry is missing, or it is zero, there is no time limit for the storing of an engine. it will get released just when the user releases it, or when she logs out.
Beesnest keeps track of engines (and adapters) by the name they have in the configuration files. A solution for a situation a programmer needs to use more than one instance of a script engine simultaneously, but still want to store (one of) the engines, is to define two engines that will load from the same library (Dll).
Just to make it clear, on the same page (Request), an engine keep its state whether it is "Storable" or not. For one page you ALWAYS get just one instance of a script engine. However, you can use more then one type of script engines in the same page.
Similar problem is when a logged in user runs two applications at the same time,
and these applications want to use the same script engine, but each one want a
different "Storable" instance (interpreter).
In order to ensure that each application will get it's own interpreter, the
application developer has to use different names for engines that are loaded
from the same library. So all the developer has to do, is to insert a new
engine entry to the configuration, that will point to the same library
(dll) but will have a unique name (and set Storable to yes).
Then always use this name when working with this specific script engine in her
application.
Like in the previous case, this is necessary just for a Storable script
engines
Finally, if the user is logged in, the engine will get also an AdaptersSet
object, for this user. Adapters are pieces of program that can do something,
almost everything a programmer whats to do with an adapter, he can do. Just
store some data, execute some logic, communicate with other software or devices
and so on. With the AdaptersSet object the engine can create new adapters, read
and write from adapters, and delete adapters. Adapter, once created, stay loaded
for the user until he release them, logged out, or a timeout limit is reached
(here the timeout limit is set for each adapter separately).
The exact way to use the Request, Response and AdaptersSet object, is depended on the specific script engine. It cannot be documented here, it should be documented with the engine itself.
Home | Documents | Downloads/Code | Test It | About | Contact Me |