38 lines
1.4 KiB
Plaintext
38 lines
1.4 KiB
Plaintext
/* NetRexx */
|
|
options replace format comments java crossref symbols binary
|
|
|
|
class RHelloWorldWebServer public
|
|
|
|
properties public constant
|
|
isTrue = boolean (1 == 1)
|
|
isFalse = boolean (1 \== 1)
|
|
greeting1 = "Goodbye, World!"
|
|
greeting2 = '' -
|
|
|| 'HTTP/1.1 200 OK\r\n' -
|
|
|| 'Content-Type: text/html; charset=UTF-8\r\n\r\n' -
|
|
|| '<?xml version="1.0" encoding="UTF-8"?>\r\n' -
|
|
|| '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r\n' -
|
|
|| '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\r\n' -
|
|
|| '<header>\r\n' -
|
|
|| '<title>Hello</title>\r\n' -
|
|
|| '<style type="text/css">body {font-family: sans-serif;}</style>\r\n' -
|
|
|| '</header>\r\n' -
|
|
|| '<body>\r\n' -
|
|
|| '<h2 style="text-align: center;">' || greeting1 || '</h2>\r\n' -
|
|
|| '</body>\r\n' -
|
|
|| '</html>\r\n' -
|
|
|| ''
|
|
|
|
properties static inheritable
|
|
terminate = isFalse -- TODO: provide a less draconian means to terminate the listener loop
|
|
|
|
method main(args = String[]) public static signals IOException
|
|
listener = ServerSocket(8080)
|
|
loop label listener forever
|
|
if terminate then leave listener
|
|
sock = listener.accept()
|
|
PrintWriter(sock.getOutputStream(), isTrue).println(greeting2)
|
|
sock.close()
|
|
end listener
|
|
return
|