Serving web pages and responding to HTTP requests: Difference between revisions

From Planimate Knowledge Base
Jump to navigation Jump to search
m (1 revision(s))
No edit summary
Line 1: Line 1:
<font face="MS Sans Serif">Planimate has a basic web server which will serve simple web pages but its primary purpose is to facilitate Planimate being triggered via a URL, the completion of forms etc.
Planimate has a basic web server which will serve simple web pages but its primary purpose is to facilitate Planimate being triggered via a URL, the completion of forms etc.




Line 11: Line 11:




1. At the moment, just entering the address of the machine (I'll use<br /> loopback here, 127.0.0.1, assuming local testing) will yield debug<br /> diagnostics.
1. At the moment, just entering the address of the machine (I'll use loopback here, 127.0.0.1, assuming local testing) will yield debug diagnostics.




http://127.0.0.1/
http://127.0.0.1/




Eventually this will retrieve a model-default page instead and the debug<br /> will have a specific token to retrieve it.
Eventually this will retrieve a model-default page instead and the debug will have a specific token to retrieve it.




2. Entering the name of a file in the current Planimate working directory<br /> (or a subdirectory thereof) will retrieve the file
2. Entering the name of a file in the current Planimate working directory (or a subdirectory thereof) will retrieve the file




http://127.0.0.1/index.htm -&gt; retrieves index.htm if it exists
http://127.0.0.1/index.htm -&gt; retrieves index.htm if it exists




Line 29: Line 29:




3. Entering a parameterised string as follows will trigger a Planimate<br /> broadcast (the model must be running)
3. Entering a parameterised string as follows will trigger a Planimate broadcast (the model must be running)




http://127.0.0.1/bc?name=mybroadcast&amp;class=item&amp;attribute1=12345
http://127.0.0.1/bc?name=mybroadcast&amp;class=item&amp;attribute1=12345




In this case broadcast "mybroadcast" will be sent using item class<br /> "item" and if an item attribute called "attribute1" exists, it will<br /> be set to 12345. Many attributes can be set using '&amp;' to append further<br /> assignments.
In this case broadcast "mybroadcast" will be sent using item class "item" and if an item attribute called "attribute1" exists, it will be set to 12345. Many attributes can be set using '&amp;' to append further assignments.




If during processing a broadcast, the model creates/writes to _www.htm<br /> in its home directory, this file will be sent back to the client. Otherwise<br /> a default _www.htm is generated and served back.
If during processing a broadcast, the model creates/writes to _www.htm in its home directory, this file will be sent back to the client. Otherwise a default _www.htm is generated and served back.
 
 
</font>
----
----
[[Category:Socket (TCPIP)]]
[[Category:Socket (TCPIP)]]
[[Category:Broadcast]]
[[Category:Broadcast]]
<font size="2">idkbase note 46</font>
<font size="2">idkbase note 46</font>

Revision as of 20:58, 10 January 2008

Planimate has a basic web server which will serve simple web pages but its primary purpose is to facilitate Planimate being triggered via a URL, the completion of forms etc.


It will not cope with heavy loads (or complex pages loading multiple images) as it doesn't multi-thread its processing of requests.


To start the server, select Edit/Sockets and enable the HTTP server. Its disabled by default. If you have IIS running on your machine (or any other program already using port 80 to serve) you will have to use a different port #.


Once running the server responds during edit and run mode.


1. At the moment, just entering the address of the machine (I'll use loopback here, 127.0.0.1, assuming local testing) will yield debug diagnostics.


http://127.0.0.1/


Eventually this will retrieve a model-default page instead and the debug will have a specific token to retrieve it.


2. Entering the name of a file in the current Planimate working directory (or a subdirectory thereof) will retrieve the file


http://127.0.0.1/index.htm -> retrieves index.htm if it exists


The server will only serve htm,gif,jpg and txt files, for security


3. Entering a parameterised string as follows will trigger a Planimate broadcast (the model must be running)


http://127.0.0.1/bc?name=mybroadcast&class=item&attribute1=12345


In this case broadcast "mybroadcast" will be sent using item class "item" and if an item attribute called "attribute1" exists, it will be set to 12345. Many attributes can be set using '&' to append further assignments.


If during processing a broadcast, the model creates/writes to _www.htm in its home directory, this file will be sent back to the client. Otherwise a default _www.htm is generated and served back.


idkbase note 46