public class BackEndServer extends Object
Constructor and Description |
---|
BackEndServer()
Method: Constructor
-------------------
All this method does is create an object that could be used to handle
HTTP requests (but at the time of construction does nothing).
|
BackEndServer(int port)
Method: Constructor
-------------------
All this method does is create an object that could be used to handle
HTTP requests (but at the time of construction does nothing).
|
Modifier and Type | Method and Description |
---|---|
static BackEndServer |
getInstance() |
static BackEndServer |
getInstance(int port) |
int |
getPort() |
boolean |
isRunning() |
static String |
renderTemplate(String templatePath,
Map<String,String> args)
Method: Render Template
-----------------------
OPTIONAL: This method takes in a template (currently it takes the path to a template)
and provides functionality for (a) importing other slivers of HTML and (b) inserting
values from a map into all places in the template with the sequence {{key}}.
|
void |
sendResponse(int requestID,
int httpErrorCode,
String contentType,
String responseText) |
void |
sendResponseFile(int requestID,
int httpErrorCode,
String contentType,
String responseFilePath) |
void |
setJavaBackEnd(stanford.spl.JavaBackEnd javaBackEnd) |
void |
start()
Method: Start
-------------
This method starts a server on the given port.
|
void |
stop()
...
|
public BackEndServer()
public BackEndServer(int port)
public static BackEndServer getInstance()
public static BackEndServer getInstance(int port)
public int getPort()
public boolean isRunning()
public void sendResponse(int requestID, int httpErrorCode, String contentType, String responseText)
public void sendResponseFile(int requestID, int httpErrorCode, String contentType, String responseFilePath)
public void setJavaBackEnd(stanford.spl.JavaBackEnd javaBackEnd)
public void start()
public void stop()
public static String renderTemplate(String templatePath, Map<String,String> args)