Writing web applications with quorum

The quorum programming language has a little known feature which you can use to create web applications. The quorum program is translated into a java servlet. Quorum masks the complexities of creating the servlet. You can then call the program from a form. You can pass the program parameters via get or post requests. You will have to generate the output dynamically in the form of a HTML page or whatever other end point format you want to use. Most of your code can remain unchanged. The key differences between a web and desktop application are below.

  • you need to use the following libraries.
    • use Libraries.Web.WebResponder
    • use Libraries.Web.WebResponse
  • The main class will have to be derived from the webresponder class.
    class Main is WebResponder
  • The main function changes. You need to use the following function.
    action Respond(WebRequest request) returns WebResponse
    WebResponse response
    //your code
  • You output data to the client by using the following function.

    response:SetPageText("text to output")

The other thing you need to do is to account for situations where web aparameters are not specified. This can happen if you are using a form and the user specifies a blank parameter. You do this using the HasParameter function of the request object.

if request:HasParameter("name of parameter")
//code for handling blank parameter
//do something

Creating the program

If you are using sodbeans, go into the project’s properties and set the application to web server. Build the program and you will get a war file. You may want to change the name of the war file before building it. You can do this from the project properties dialogue. The edit box containing the name of the final project has the value of default. You can change this to whatever name you like. Once you have the war file, you move it to Tomcat’s webapps folder. In its default configuration, tomcat will deploy the web application automatically.

Calling the program

You can call the program by using its name. See the beginning of the

tag below.

The name is the same name you specified in sodbeans in the project pproperties.

Handling static resources

Your program can refer to static resources. These are not included by default in the war. You need to upload them separately. The root folder for servlets changes depends on a variety of settings. Use the
GetWorkingDirectory() method of the File class to get the servlet path. You can then copy your resources accordingly to that path and reference them as you do regularly. One of the challenges in this process is seeing the value of the working directory. You can either output it in HTML or use an output statement. The items printed by the output statement are recorded in catalina.out in the tomcat/logs folder on Linux and in the tomcat9-stdout.date.log file on Microsoft Windows.

Debugging web applications

The biggest strength when using quorum to write web server applications lies in debugging. You can change the application type to standard and then manually pass parameters via the request object. You get a jar file instead of a war file. Beware that the main action is called instead of the Respond action. See the below code from my chat bot application.

action Main

output("main method invoked")
text qt=""
WebResponse wr
WebRequest wq
output("about to invoke input")


Once again, the main function is ignored when you switch to a web application.


Quorum is one of the few languages where transitions to different program running contexts is almost seemless. You can run your programs as web servers, as desktop applications, as mobile apps and as client side java script. The key differences like in the plugin architecture and in the way you reference resources. One of the key advantages of a web application is that you can continue using the same plugin infrastructure and no rewriting is required in the majority of cases.


Thanks to Professor Andreas Stefik, the lead creator of quorum for helping understand key aspects of the web application framework.
Thanks also to the members of the quorum list who continue to answer my questions about quorum queries.

Filed under: commonTasks — Tags: , , , , , — security-writer @ June 3, 2017 23:26