View | Details | Raw Unified | Return to bug 53553
Collapse All | Expand All

(-)java/org/apache/catalina/manager/ManagerServlet.java (-4 / +32 lines)
Lines 397-409 Link Here
397
        if (path != null) {
397
        if (path != null) {
398
            cn = new ContextName(path, request.getParameter("version"));
398
            cn = new ContextName(path, request.getParameter("version"));
399
        }
399
        }
400
        String config = request.getParameter("config");
400
        String tag = request.getParameter("tag");
401
        String tag = request.getParameter("tag");
401
        boolean update = false;
402
        boolean update = false;
402
        if ((request.getParameter("update") != null)
403
        if ((request.getParameter("update") != null)
403
            && (request.getParameter("update").equals("true"))) {
404
            && (request.getParameter("update").equals("true"))) {
404
            update = true;
405
            update = true;
405
        }
406
        }
406
        // Prepare our output writer to generate the response message
407
        // Prepare our output writer to generate the response message
407
        response.setContentType("text/plain;charset="+Constants.CHARSET);
408
        response.setContentType("text/plain;charset="+Constants.CHARSET);
408
        PrintWriter writer = response.getWriter();
409
        PrintWriter writer = response.getWriter();
Lines 412-418 Link Here
412
        if (command == null) {
413
        if (command == null) {
413
            writer.println(smClient.getString("managerServlet.noCommand"));
414
            writer.println(smClient.getString("managerServlet.noCommand"));
414
        } else if (command.equals("/deploy")) {
415
        } else if (command.equals("/deploy")) {
415
            deploy(writer, cn, tag, update, request, smClient);
416
            deploy(writer, config, cn, tag, update, request, smClient);
416
        } else {
417
        } else {
417
            writer.println(smClient.getString("managerServlet.unknownCommand",
418
            writer.println(smClient.getString("managerServlet.unknownCommand",
418
                    command));
419
                    command));
Lines 581-597 Link Here
581
     * at the specified context path.
582
     * at the specified context path.
582
     *
583
     *
583
     * @param writer Writer to render results to
584
     * @param writer Writer to render results to
585
     * @param config URL of the context configuration file to be installed
584
     * @param cn Name of the application to be installed
586
     * @param cn Name of the application to be installed
585
     * @param tag Tag to be associated with the webapp
587
     * @param tag Tag to be associated with the webapp
586
     * @param request Servlet request we are processing
588
     * @param request Servlet request we are processing
587
     */
589
     */
588
    protected synchronized void deploy
590
    protected synchronized void deploy
589
        (PrintWriter writer, ContextName cn,
591
        (PrintWriter writer, String config, ContextName cn,
590
         String tag, boolean update, HttpServletRequest request,
592
         String tag, boolean update, HttpServletRequest request,
591
         StringManager smClient) {
593
         StringManager smClient) {
594
        if (config != null && config.length() == 0) {
595
            config = null;
596
        }
597
        
592
        if (debug >= 1) {
598
        if (debug >= 1) {
593
            log("deploy: Deploying web application '" + cn + "'");
599
            if (config != null) {                    
600
                log("deploy: Deploying web application '" + cn + "' " +
601
                        "with context configuration at '" + config + "'");
602
            } else {
603
                log("deploy: Deploying web application '" + cn + "'");
604
            }
594
        }
605
        }
595
606
596
        // Validate the requested context path
607
        // Validate the requested context path
Lines 615-620 Link Here
615
                    displayPath));
626
                    displayPath));
616
            return;
627
            return;
617
        }
628
        }
629
630
        if (config != null && (config.startsWith("file:"))) {
631
            config = config.substring("file:".length());
632
        }
618
633
619
        // Calculate the base path
634
        // Calculate the base path
620
        File deployedPath = deployed;
635
        File deployedPath = deployed;
Lines 637-643 Link Here
637
        try {
652
        try {
638
            if (!isServiced(name)) {
653
            if (!isServiced(name)) {
639
                addServiced(name);
654
                addServiced(name);
640
                try {
655
                try { 
656
                    if (config != null) {
657
                        if (!configBase.mkdirs() && !configBase.isDirectory()) {
658
                            writer.println(smClient.getString(
659
                                    "managerServlet.mkdirFail",configBase));
660
                            return;
661
                        }
662
                        if (copy(new File(config),
663
                                new File(configBase, baseName + ".xml")) == false) {
664
                            throw new Exception("Could not copy config file from path '" +
665
                                config + "'");
666
                        }
667
                    }
668
                    
641
                    // Upload WAR
669
                    // Upload WAR
642
                    uploadWar(writer, request, localWar, smClient);
670
                    uploadWar(writer, request, localWar, smClient);
643
                    // Copy WAR and XML to the host app base if needed
671
                    // Copy WAR and XML to the host app base if needed

Return to bug 53553