Running the Sage Webserver on Linux
The following information may be obsolete - Linux Sage v5 now allows JARs to be used, so the install instructions are the same as for Windows
According to this thread on the Sage Forums, the webserver works on the linux version if you follow the following instructions:
- Unpack the webserver zipfile into the /opt/sagetv/app directory
- cd to /opt/sagetv/app
- Execute:
unzip JARs/nielm_sageutls.jar '*.class' unzip JARS/nielm_sagewebserver.jar '*.class' rm JARs/nielm_sageutls.jar JARS/nielm_sagewebserver.jar
Then edit Sage.properties and add the line:
load_at_startup_runnable_classes=net.sf.sageplugins.webserver.StartServer
The remainder of the instructions are the same as the Windows version.
Development on Linux
Because Sage on linux does not use a client/server process architecture, but a server/extender architecture, the webserver can only be installed into the sage Server process.
This means that for every change, the server must be restarted.
As a workaround to this, jreichen has developed a method of triggering a reload of the webserver classes and restart the server.
The following are the comments from the class: WebserverLoader
net.sf.sageplugins.webserver.WebServerLoader
Proxy class for (re)loading webserver classes, eliminating the need to restart SageTV when changing servlet classes. Only the webserver needs to be restarted.
Currently this class is only intended to be used during development. The need to use it during development is higher than for end users because of the frequent number of restarts needed during development and testing.
Instructions:
- Stop SageTV
- Replace
net.sf.sageplugins.webserver.StartServerin the value ofload_at_startup_runnable_classesin Sage.properties withnet.sf.sageplugins.webserver.WebServerLoader - Compile this file and put it in SageTV's classpath. This can be deployed either as a JAR file in the JARs folder in the SageTV home, or in the net/sf/sageplugins/webserver folder in the SageTV home.
- Remove nielm_sagewebserver.jar from the JARs folder. This is very important. If any of the desired classes are in SageTV's classpath, they cannot be reloaded (at least not with the current implementation, which uses the default of parent-first classloading).
- Copy all the .class files from the development location into <SageTV home>/webserver/classes
- Start SageTV.
- When changes are made to the servlets, copy the .class files to the above directories and either 'telnet machinename 8088' and press enter to send a blank line, or point the web browser to http://machinename:8088. A message will be displayed indicating the webserver classes have been reloaded.
there are 2 properties which this classloader uses:
-
nielm/webserver/classloader/classpath (default: webserver/classes)
defining the a ';' separated set of locations where the java class files can be found.
JAR files can also be used by giving a value such as:webserver/classes;webserver/classes/nielm_sagexmlinfo.jar;webserver/classes/nielm_sagewebserver.jar nielm/webserver/classloader/port (default: 8088)This is the port number that the classloader should listen on. It should not be exposed over the Internet.