public class HtmlTemplate {
public static void main(String[] args) {
// Output the header(s).
System.out.print("Content-type: text/html\r\n");
System.out.print("\r\n");
//====================================================================
// Payload will follow.
//--------------------------------------------------------------------
// Set up HTML template.
String html = ""
+ "\n"
+ "\n"
+ "
\n"
+ " \n"
+ " Generated by Java!\n"
+ " \n"
+ "\n"
+ "\n"
+ "\n"
+ " \n"
+ " Hello, PERSON!\n"
+ "
\n"
+ "\n"
+ "\n";
//--------------------------------------------------------------------
// Replace "variables" in our HTML template.
//--------------------------------------------------------------------
// Who is the USER?
String person = System.getenv("REMOTE_USER");
if (person == null) {
person = "you";
}
html = html.replace("PERSON", person);
//====================================================================
// Dump payload and done!
System.out.print(html);
}
}