(HttpServletRequest request, HttpServletResponse response)
| 269 | |
| 270 | |
| 271 | @Override |
| 272 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { |
| 273 | |
| 274 | StringManager smClient = StringManager.getManager(Constants.Package, request.getLocales()); |
| 275 | |
| 276 | // Identify the request parameters that we need |
| 277 | String command = request.getPathInfo(); |
| 278 | if (command == null) { |
| 279 | command = request.getServletPath(); |
| 280 | } |
| 281 | |
| 282 | String path = request.getParameter("path"); |
| 283 | String war = request.getParameter("war"); |
| 284 | String config = request.getParameter("config"); |
| 285 | ContextName cn = null; |
| 286 | if (path != null) { |
| 287 | cn = new ContextName(path, request.getParameter("version")); |
| 288 | } else if (config != null) { |
| 289 | cn = ContextName.extractFromPath(config); |
| 290 | } else if (war != null) { |
| 291 | cn = ContextName.extractFromPath(war); |
| 292 | } |
| 293 | |
| 294 | String type = request.getParameter("type"); |
| 295 | String tag = request.getParameter("tag"); |
| 296 | boolean update = request.getParameter("update") != null && request.getParameter("update").equals("true"); |
| 297 | String tlsHostName = request.getParameter("tlsHostName"); |
| 298 | |
| 299 | boolean statusLine = "true".equals(request.getParameter("statusLine")); |
| 300 | |
| 301 | // Prepare our output writer to generate the response message |
| 302 | response.setContentType("text/plain; charset=" + Constants.CHARSET); |
| 303 | // Stop older versions of IE thinking they know best. We set text/plain |
| 304 | // in the line above for a reason. IE's behaviour is unwanted at best |
| 305 | // and dangerous at worst. |
| 306 | response.setHeader("X-Content-Type-Options", "nosniff"); |
| 307 | PrintWriter writer = response.getWriter(); |
| 308 | |
| 309 | // Process the requested command |
| 310 | if (command == null) { |
| 311 | writer.println(smClient.getString("managerServlet.noCommand")); |
| 312 | } else if (command.equals("/deploy")) { |
| 313 | if (war != null || config != null) { |
| 314 | deploy(writer, config, cn, war, update, smClient); |
| 315 | } else if (tag != null) { |
| 316 | deploy(writer, cn, tag, smClient); |
| 317 | } else { |
| 318 | writer.println(smClient.getString("managerServlet.invalidCommand", command)); |
| 319 | } |
| 320 | } else if (command.equals("/list")) { |
| 321 | list(writer, smClient); |
| 322 | } else if (command.equals("/reload")) { |
| 323 | reload(writer, cn, smClient); |
| 324 | } else if (command.equals("/resources")) { |
| 325 | resources(writer, type, smClient); |
| 326 | } else if (command.equals("/save")) { |
| 327 | save(writer, path, smClient); |
| 328 | } else if (command.equals("/serverinfo")) { |
nothing calls this directly
no test coverage detected