Methods Summary |
---|
public void | doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
returnClientError(res, "GET Operation not supported: " + "Can only forward POST requests.");
|
public void | doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)Execute the command given in the servlet request query string.
The string before the first '=' in the queryString is
interpreted as the command name, and the string after the first
'=' is the parameters to the command.
try {
String queryString = req.getQueryString();
String command, param;
int delim = queryString.indexOf("=");
if (delim == -1) {
command = queryString;
param = "";
} else {
command = queryString.substring(0, delim);
param = queryString.substring(delim + 1);
}
if (command.equalsIgnoreCase("forward")) {
try {
LoggingServletForwardCommand.execute(req, res, param);
} catch (ServletClientException e) {
returnClientError(res, "client error: " + e.getMessage());
e.printStackTrace();
} catch (ServletServerException e) {
returnServerError(res, "internal server error: " + e.getMessage());
e.printStackTrace();
}
} else {
returnClientError(res, "invalid command: " + command);
}
} catch (Exception e) {
returnServerError(res, "internal error: " + e.getMessage());
e.printStackTrace();
}
|
public void | doPut(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
returnClientError(res, "PUT Operation not supported: " + "Can only forward POST requests.");
|
public java.lang.String | getServletInfo()
return "RMI Call Forwarding Servlet Servlet.<br>\n";
|
public void | init(javax.servlet.ServletConfig config)
super.init(config);
System.out.println("Simplified RMI Servlet Handler loaded sucessfully.");
|
private static void | returnClientError(javax.servlet.http.HttpServletResponse res, java.lang.String message)
res.sendError(HttpServletResponse.SC_BAD_REQUEST,
"<HTML><HEAD>" +
"<TITLE>Java RMI Client Error</TITLE>" +
"</HEAD>" +
"<BODY>" +
"<H1>Java RMI Client Error</H1>" +
message +
"</BODY></HTML>");
System.err.println(HttpServletResponse.SC_BAD_REQUEST +
"Java RMI Client Error" + message);
|
private static void | returnServerError(javax.servlet.http.HttpServletResponse res, java.lang.String message)
res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"<HTML><HEAD>" +
"<TITLE>Java RMI Server Error</TITLE>" +
"</HEAD>" +
"<BODY>" +
"<H1>Java RMI Server Error</H1>" +
message +
"</BODY></HTML>");
System.err.println(HttpServletResponse.SC_INTERNAL_SERVER_ERROR +
"Java RMI Server Error: " + message);
|