All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.jonas.ant.jonasbase.web.Jetty Maven / Gradle / Ivy

/**
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 2006-2008 Bull S.A.S.
 * Contact: [email protected]
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id: Jetty.java 15428 2008-10-07 11:20:29Z sauthieg $
 * --------------------------------------------------------------------------
 */
package org.ow2.jonas.ant.jonasbase.web;

import org.ow2.jonas.ant.JOnASBaseTask;
import org.ow2.jonas.ant.jonasbase.JReplace;
import org.ow2.jonas.ant.jonasbase.Tasks;


/**
 * Support Jetty Connector Configuration.
 *
 * @author Guillaume Sauthier
 */
public class Jetty extends Tasks {

    /**
     * Info for the logger.
     */
    private static final String INFO = "[Jetty] ";

    /**
     * HTTPS TOKEN.
     */
    private static final String HTTPS_TOKEN = "\n");
        value.append("  \n");
        value.append("  \n");
        value.append("    \n");
        if (Https.IBM_VM.equalsIgnoreCase(https.getVm())) {
            value.append("      \n");
        } else {
                // default to Sun
            value.append("      \n");
        }
        value.append("        " + https.getPort() + "\n");
        value.append("        5\n");
        value.append("        100\n");
        value.append("        30000\n");
        value.append("        2000\n");
        if (https.getKeystoreFile() != null) {
            value.append("        " + https.getKeystoreFile() + "\n");
        }
        if (https.getKeystorePass() != null) {
            value.append("        " + https.getKeystorePass() + "\n");
        }
        if (https.getKeyPassword() != null) {
            value.append("  " + https.getKeyPassword() + "\n");
        }
        value.append("      \n");
        value.append("    \n");
        value.append("  \n\n");
        value.append("  \n");
        value.append("  " + HTTPS_TOKEN);
        propertyReplace.setValue(value.toString());
        propertyReplace.setLogInfo(INFO + "Setting HTTPS port number to : " + https.getPort());
        addTask(propertyReplace);

        propertyReplace = new JReplace();
        propertyReplace.setConfigurationFile(JOnASBaseTask.JETTY_CONF_FILE);
        propertyReplace.setToken(Https.DEFAULT_PORT);
        propertyReplace.setValue(https.getPort());
        propertyReplace.setLogInfo(INFO + "Fix HTTP redirect port number to : " + https.getPort());
        addTask(propertyReplace);


    }

    /**
     * Configure an AJP Connector.
     * @param ajp AJP Configuration.
     */
    public void addConfiguredAjp(final Ajp ajp) {
        JReplace propertyReplace = new JReplace();
        propertyReplace.setConfigurationFile(JOnASBaseTask.JETTY_CONF_FILE);
        propertyReplace.setToken(AJP_TOKEN);
        StringBuffer value = new StringBuffer();
        value.append("\n");
        value.append("  \n");
        value.append("  \n");
        value.append("  \n");
        value.append("    \n");
        value.append("      \n");
        value.append("        " + ajp.getPort() + "\n");
        value.append("        5\n");
        value.append("        20\n");
        value.append("        0\n");
        value.append("        9043\n");
        value.append("      \n");
        value.append("    \n");
        value.append("  \n\n");
        value.append("  \n");
        value.append("  " + AJP_TOKEN);
        propertyReplace.setValue(value.toString());
        propertyReplace.setLogInfo(INFO + "Setting AJP Connector to : " + ajp.getPort());
        addTask(propertyReplace);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy