use of org.apache.tomcat.util.res.StringManager in project tomcat by apache.
the class HTMLHostManagerServlet method doPost.
/**
* Process a POST request for the specified resource.
*
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet-specified error occurs
*/
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
StringManager smClient = StringManager.getManager(Constants.Package, request.getLocales());
// Identify the request parameters that we need
String command = request.getPathInfo();
String name = request.getParameter("name");
// Prepare our output writer to generate the response message
response.setContentType("text/html; charset=" + Constants.CHARSET);
String message = "";
// Process the requested command
if (command == null) {
// No command == list
} else if (command.equals("/add")) {
message = add(request, name, smClient);
} else if (command.equals("/remove")) {
message = remove(name, smClient);
} else if (command.equals("/start")) {
message = start(name, smClient);
} else if (command.equals("/stop")) {
message = stop(name, smClient);
} else if (command.equals("/persist")) {
message = persist(smClient);
} else {
// Try GET
doGet(request, response);
}
list(request, response, message, smClient);
}
use of org.apache.tomcat.util.res.StringManager in project tomcat by apache.
the class HTMLHostManagerServlet method doGet.
// --------------------------------------------------------- Public Methods
/**
* Process a GET request for the specified resource.
*
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet-specified error occurs
*/
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
StringManager smClient = StringManager.getManager(Constants.Package, request.getLocales());
// Identify the request parameters that we need
String command = request.getPathInfo();
// Prepare our output writer to generate the response message
response.setContentType("text/html; charset=" + Constants.CHARSET);
String message = "";
// Process the requested command
if (command == null) {
// No command == list
} else if (command.equals("/list")) {
// Nothing to do - always generate list
} else if (command.equals("/add") || command.equals("/remove") || command.equals("/start") || command.equals("/stop") || command.equals("/persist")) {
message = smClient.getString("hostManagerServlet.postCommand", command);
} else {
message = smClient.getString("hostManagerServlet.unknownCommand", command);
}
list(request, response, message, smClient);
}
Aggregations