Java/Web Manual
  SoftPLC    Font size:      

Weblets

We use the term Weblet to refer to an HTTP server, a web server. Each SoftPLC can run multiple HTTP servers (Weblets). The default installation of the web server sets up 2 weblets. For example, one can be used for administrative activities, and the other can be used for normal operating personnel activities as you chose.

Because a Weblet is actually an implementation of a Modlet, a Weblet is started by specifying an instance of class com.softplc.Weblet in the MODLET.LST file. This Modlet takes a single command line parameter, the directory path where the Weblet’s dedicated configuration files are to be found. Each Weblet must be given its own configuration directory and associated configuration files.

The configuration files are SERVER.LST and RESOURCE.LST. These are text files that you may edit with a text editor. Assuming you will have two Weblets, then you might have the following directory tree fragment:

+-\LST
. +-\SYS
. | + RESOURCE.LST
. | + SERVER.LST
. +-\USR
. + RESOURCE.LST
. + SERVER.LST

In your MODLET.LST file, in addition to any other entries you might have, you would have the following two entries:

com.softplc.Weblet C:\LST\SYS
com.softplc.Weblet C:\LST\USR

More Weblets can be added as needed. Simply create another subdirectory, say usr2, below the \LST subdirectory shown above, and then add another entry to MODLET.LST.

Weblet Configuration

What makes a Weblet unique are its configuration parameters. Each Weblet listens on a particular TCP/IP port number on a particular TCP/IP interface, has its own document root, and its own name. Your SoftPLC CPU might have more than one TCP/IP interface (ethernet card/port). Each Weblet may only listen on one interface. More than one Weblet can listen on the same interface. Each Weblet needs a unique port number on any given interface. If two Weblets are using different interfaces, only then may they use the same port number.

Each parameter belongs to a specific configuration file, either RESOURCE.LST or SERVER.LST. Remember that each Weblet instance has its own set of these files. These files may be edited by a text editor to modify the desired configuration parameters. The editable text is always to the right of the first semicolon. There are more parameters in these files than are described here. More information can be found in the configuration files themselves. The important parameters are listed here as are the file in which they belong.

Weblet.inetaddress:<IP address> in SERVER.LST

IP address is an optional parameter that is only needed if you have more than one TCP/IP interface. If you have two or more ethernet cards in the SoftPLC and each are on a TCP/IP network, then you have more than one TCP/IP interface. If you don’t supply this parameter, then the first non-loopback interface will be assumed. Otherwise, provide the IP address for the interface in numeric form (e.g. 130.1.1.65) that this Weblet instance is to use. SoftPLC currently supports up to 5 TCP/IP interfaces, the loopback interface, and up to 4 ethernet cards. PPP and SLIP over RS-232 or modem are not supported at this time.

Weblet.port:<port number> in SERVER.LST

Port number is the TCP/IP port number that this Weblet listens on for new connections. The normal port number for the World Wide Web Internet HTTP servers is 80. Each Weblet must have its own unique combination of interface and port number, as described above. Since browsers default to 80, that port number is normally used for the USR Weblet. The SYS Weblet, defined by the configuration files in LST\SYS, defaults to 9090. A port number can be any number between 1 and 65535.

Weblet.name:<server name> in SERVER.LST

This is the name of this Weblet instance. It should generally be set to same name as what the client web browser must use to find this machine on the TCP/IP network. It may also be set to an IP address if there is no Domain Name Server on the network.

Weblet.document.root:<document root> in SERVER.LST

A document root is the directory that the web browser user will perceive as the root directory. He points at the document root directory by providing the shortest URL for this server, with the least amount of path information.

For example, say <document root> is set to \htm\usr, and the client requests from URL http://ipaddress/page.htm. In this example ipaddress is used by the client machine to find the SoftPLC machine from the Domain Name Server on your network, so the only part of the URL pertaining to the filename is page.htm. Notice there is no path information as part of this filename. So the actual file retrieved under these circumstances would be \htm\usr\page.htm.

All file references will have the <document root> path prefixed, so a request for

http://ipaddress/subdir/file.htm

would result in \htm\usr\subdir\file.htm being retrieved.

Weblet.servlet.path:<servlet path> in RESOURCE.LST

Servlet path is a semicolon separated list of directories, each of which will contain one or more *.JAR files. JAR files are not listed in this parameter, but rather the directories in which they reside are listed. For example, a valid <servlet path> would be C:\jar\servlet;C:\myserv; Any and all *.JAR files in these two directories will be searched for servlets that are referenced by a URL.

Weblet.server.admin:<admin email address> in SERVER.LST

Whenever a file not found error comes back to the client because it requests a file that does not exist, the email address of the person that adminstrates this Weblet may be displayed. This way the client can simply click on that hyperlink to be able to send an email message to that administrator. For this to work you need a SMTP server on the network and the client’s browser must be configured to send email through that SMTP server. The default email address is "joeplantengineer@company.com"