diff --git a/jetty-ee10/jetty-ee10-ant/pom.xml b/jetty-ee10/jetty-ee10-ant/pom.xml deleted file mode 100644 index 09c78afbfb60..000000000000 --- a/jetty-ee10/jetty-ee10-ant/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - org.eclipse.jetty.ee10 - jetty-ee10 - 12.0.0-SNAPSHOT - - 4.0.0 - jetty-ee10-ant - jar - EE10 :: Ant Plugin - - - ${project.groupId}.ant - true - - - - - org.apache.felix - maven-bundle-plugin - true - - - - osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)" - - - osgi.serviceloader; osgi.serviceloader=org.eclipse.jetty.ee10.webapp.Configuration - - - - - - maven-dependency-plugin - - - copy-lib-deps - process-test-resources - - copy-dependencies - - - org.eclipse.jetty - org.eclipse.jetty.websocket - jetty-start - jar - ${project.build.directory}/test-lib - - - - - - - - - org.eclipse.jetty.toolchain - jetty-test-helper - test - - - org.apache.ant - ant - - - org.apache.ant - ant-launcher - - - org.eclipse.jetty.ee10 - jetty-ee10-plus - - - org.eclipse.jetty.ee10 - jetty-ee10-webapp - - - org.eclipse.jetty.ee10 - jetty-ee10-annotations - - - org.slf4j - slf4j-api - - - org.eclipse.jetty - jetty-slf4j-impl - test - - - diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/AntMetaInfConfiguration.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/AntMetaInfConfiguration.java deleted file mode 100644 index 31603eed6f90..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/AntMetaInfConfiguration.java +++ /dev/null @@ -1,81 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant; - -import java.io.File; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.List; - -import org.apache.tools.ant.AntClassLoader; -import org.eclipse.jetty.ee10.webapp.Configuration; -import org.eclipse.jetty.ee10.webapp.MetaInfConfiguration; -import org.eclipse.jetty.ee10.webapp.WebAppContext; - -public class AntMetaInfConfiguration extends MetaInfConfiguration -{ - - @Override - public Class replaces() - { - return MetaInfConfiguration.class; - } - - @Override - public void findAndFilterContainerPaths(WebAppContext context) throws Exception - { - // TODO Auto-generated method stub - super.findAndFilterContainerPaths(context); - } - - @Override - protected List getAllContainerJars(final WebAppContext context) throws URISyntaxException - { - List uris = new ArrayList<>(); - if (context.getClassLoader() != null) - { - ClassLoader loader = context.getClassLoader().getParent(); - while (loader != null) - { - if (loader instanceof URLClassLoader) - { - URL[] urls = ((URLClassLoader)loader).getURLs(); - if (urls != null) - for (URL url : urls) - { - uris.add(new URI(url.toString().replaceAll(" ", "%20"))); - } - } - else if (loader instanceof AntClassLoader) - { - AntClassLoader antLoader = (AntClassLoader)loader; - String[] paths = antLoader.getClasspath().split(new String(new char[]{File.pathSeparatorChar})); - if (paths != null) - { - for (String p : paths) - { - File f = new File(p); - uris.add(f.toURI()); - } - } - } - loader = loader.getParent(); - } - } - return uris; - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/AntWebAppContext.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/AntWebAppContext.java deleted file mode 100644 index 90878b15f876..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/AntWebAppContext.java +++ /dev/null @@ -1,691 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLClassLoader; -import java.security.CodeSource; -import java.security.PermissionCollection; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.jar.Manifest; - -import jakarta.servlet.Servlet; -import org.apache.tools.ant.AntClassLoader; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.types.FileSet; -import org.eclipse.jetty.ee10.ant.types.Attribute; -import org.eclipse.jetty.ee10.ant.types.Attributes; -import org.eclipse.jetty.ee10.ant.types.FileMatchingConfiguration; -import org.eclipse.jetty.ee10.ant.utils.TaskLog; -import org.eclipse.jetty.ee10.plus.webapp.EnvConfiguration; -import org.eclipse.jetty.ee10.servlet.FilterHolder; -import org.eclipse.jetty.ee10.servlet.FilterMapping; -import org.eclipse.jetty.ee10.servlet.ServletHandler; -import org.eclipse.jetty.ee10.servlet.ServletHolder; -import org.eclipse.jetty.ee10.servlet.ServletMapping; -import org.eclipse.jetty.ee10.servlet.Source; -import org.eclipse.jetty.ee10.webapp.MetaInfConfiguration; -import org.eclipse.jetty.ee10.webapp.WebAppClassLoader; -import org.eclipse.jetty.ee10.webapp.WebAppContext; -import org.eclipse.jetty.util.resource.PathResource; -import org.eclipse.jetty.util.resource.Resource; -import org.eclipse.jetty.xml.XmlConfiguration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Extension of WebAppContext to allow configuration via Ant environment. - */ -public class AntWebAppContext extends WebAppContext -{ - private static final Logger LOG = LoggerFactory.getLogger(WebAppContext.class); - - public static final String DEFAULT_CONTAINER_INCLUDE_JAR_PATTERN = - ".*/.*jsp-api-[^/]*\\.jar$|.*/.*jsp-[^/]*\\.jar$|.*/.*taglibs[^/]*\\.jar$|.*/.*jstl[^/]*\\.jar$|.*/.*jsf-impl-[^/]*\\.jar$|.*/.*javax.faces-[^/]*\\.jar$|.*/.*myfaces-impl-[^/]*\\.jar$"; - - /** - * Location of jetty-env.xml file. - */ - private File jettyEnvXml; - - /** - * List of web application libraries. - */ - private List libraries = new ArrayList<>(); - - /** - * List of web application class directories. - */ - private List classes = new ArrayList<>(); - - /** - * context xml file to apply to the webapp - */ - private File contextXml; - - /** - * List of extra scan targets for this web application. - */ - private FileSet scanTargets; - - /** - * context attributes to set - **/ - private Attributes attributes; - - private Project project; - - private List scanFiles; - - private FileMatchingConfiguration librariesConfiguration; - - public static void dump(ClassLoader loader) - { - while (loader != null) - { - System.err.println(loader); - if (loader instanceof URLClassLoader) - { - URL[] urls = ((URLClassLoader)loader).getURLs(); - if (urls != null) - { - for (URL u : urls) - { - System.err.println("\t" + u + "\n"); - } - } - } - loader = loader.getParent(); - } - } - - /** - * AntURLClassLoader - * - * Adapt the AntClassLoader which is not a URLClassLoader - this is needed for - * jsp to be able to search the classpath. - */ - public static class AntURLClassLoader extends URLClassLoader - { - private AntClassLoader antLoader; - - public AntURLClassLoader(AntClassLoader antLoader) - { - super(new URL[]{}, antLoader); - this.antLoader = antLoader; - } - - @Override - public InputStream getResourceAsStream(String name) - { - return super.getResourceAsStream(name); - } - - @Override - public void close() throws IOException - { - super.close(); - } - - @Override - protected void addURL(URL url) - { - super.addURL(url); - } - - @Override - public URL[] getURLs() - { - Set urls = new HashSet(); - - //convert urls from antLoader - String[] paths = antLoader.getClasspath().split(new String(new char[]{File.pathSeparatorChar})); - if (paths != null) - { - for (String p : paths) - { - File f = new File(p); - try - { - urls.add(f.toURI().toURL()); - } - catch (Exception e) - { - LOG.trace("IGNORED", e); - } - } - } - - //add in any that may have been added to us as a URL directly - URL[] ourURLS = super.getURLs(); - if (ourURLS != null) - { - for (URL u : ourURLS) - { - urls.add(u); - } - } - - return urls.toArray(new URL[urls.size()]); - } - - @Override - protected Class findClass(String name) throws ClassNotFoundException - { - return super.findClass(name); - } - - @Override - public URL findResource(String name) - { - return super.findResource(name); - } - - @Override - public Enumeration findResources(String name) throws IOException - { - return super.findResources(name); - } - - @Override - protected PermissionCollection getPermissions(CodeSource codesource) - { - return super.getPermissions(codesource); - } - - @Override - public Class loadClass(String name) throws ClassNotFoundException - { - return super.loadClass(name); - } - - @Override - protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException - { - return super.loadClass(name, resolve); - } - - @Override - protected Object getClassLoadingLock(String className) - { - return super.getClassLoadingLock(className); - } - - @Override - public URL getResource(String name) - { - return super.getResource(name); - } - - @Override - public Enumeration getResources(String name) throws IOException - { - return super.getResources(name); - } - - @Override - protected Package definePackage(String name, Manifest man, URL url) throws IllegalArgumentException - { - return super.definePackage(name, man, url); - } - - @Override - protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, - String implVendor, URL sealBase) throws IllegalArgumentException - { - return super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase); - } - - @Override - protected Package[] getPackages() - { - return super.getPackages(); - } - - @Override - protected String findLibrary(String libname) - { - return super.findLibrary(libname); - } - - @Override - public void setDefaultAssertionStatus(boolean enabled) - { - super.setDefaultAssertionStatus(enabled); - } - - @Override - public void setPackageAssertionStatus(String packageName, boolean enabled) - { - super.setPackageAssertionStatus(packageName, enabled); - } - - @Override - public void setClassAssertionStatus(String className, boolean enabled) - { - super.setClassAssertionStatus(className, enabled); - } - - @Override - public void clearAssertionStatus() - { - super.clearAssertionStatus(); - } - } - - /** - * AntServletHolder - */ - public static class AntServletHolder extends ServletHolder - { - - public AntServletHolder() - { - super(); - } - - public AntServletHolder(Class servlet) - { - super(servlet); - } - - public AntServletHolder(Servlet servlet) - { - super(servlet); - } - - public AntServletHolder(String name, Class servlet) - { - super(name, servlet); - } - - public AntServletHolder(String name, Servlet servlet) - { - super(name, servlet); - } - - protected String getSystemClassPath(ClassLoader loader) throws Exception - { - StringBuilder classpath = new StringBuilder(); - while (loader != null) - { - if (loader instanceof URLClassLoader) - { - URL[] urls = ((URLClassLoader)loader).getURLs(); - if (urls != null) - { - for (int i = 0; i < urls.length; i++) - { - Resource resource = Resource.newResource(urls[i]); - File file = resource.getFile(); - if (file != null && file.exists()) - { - if (classpath.length() > 0) - classpath.append(File.pathSeparatorChar); - classpath.append(file.getAbsolutePath()); - } - } - } - } - else if (loader instanceof AntClassLoader) - { - classpath.append(((AntClassLoader)loader).getClasspath()); - } - - loader = loader.getParent(); - } - - return classpath.toString(); - } - } - - /** - * AntServletHandler - */ - public static class AntServletHandler extends ServletHandler - { - - @Override - public ServletHolder newServletHolder(Source source) - { - return new AntServletHolder(); - } - } - - /** - * Default constructor. Takes project as an argument - * - * @param project the project. - * @throws Exception if unable to create webapp context - */ - public AntWebAppContext(Project project) throws Exception - { - super(); - this.project = project; - setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN, DEFAULT_CONTAINER_INCLUDE_JAR_PATTERN); - setParentLoaderPriority(true); - addConfiguration(new AntWebInfConfiguration(), new AntWebXmlConfiguration(), new AntMetaInfConfiguration()); - } - - /** - * Adds a new Ant's attributes tag object if it have not been created yet. - * - * @param atts the attributes - */ - public void addAttributes(Attributes atts) - { - if (this.attributes != null) - { - throw new BuildException("Only one tag is allowed!"); - } - - this.attributes = atts; - } - - public void addLib(FileSet lib) - { - libraries.add(lib); - } - - public void addClasses(FileSet classes) - { - this.classes.add(classes); - } - - @Override - protected ServletHandler newServletHandler() - { - return new AntServletHandler(); - } - - public void setJettyEnvXml(File jettyEnvXml) - { - this.jettyEnvXml = jettyEnvXml; - TaskLog.log("jetty-env.xml file: = " + (jettyEnvXml == null ? null : jettyEnvXml.getAbsolutePath())); - } - - public File getJettyEnvXml() - { - return this.jettyEnvXml; - } - - public List getLibraries() - { - return librariesConfiguration.getBaseDirectories(); - } - - public void addScanTargets(FileSet scanTargets) - { - if (this.scanTargets != null) - { - throw new BuildException("Only one tag is allowed!"); - } - - this.scanTargets = scanTargets; - } - - public List getScanTargetFiles() - { - if (this.scanTargets == null) - return null; - - FileMatchingConfiguration configuration = new FileMatchingConfiguration(); - configuration.addDirectoryScanner(scanTargets.getDirectoryScanner(project)); - return configuration.getBaseDirectories(); - } - - public List getScanFiles() - { - if (scanFiles == null) - scanFiles = initScanFiles(); - return scanFiles; - } - - public boolean isScanned(File file) - { - List files = getScanFiles(); - if (files == null || files.isEmpty()) - return false; - return files.contains(file); - } - - public List initScanFiles() - { - List scanList = new ArrayList(); - - if (getDescriptor() != null) - { - try (Resource r = Resource.newResource(getDescriptor());) - { - scanList.add(r.getFile()); - } - catch (IOException e) - { - throw new BuildException(e); - } - } - - if (getJettyEnvXml() != null) - { - try (Resource r = Resource.newResource(getJettyEnvXml());) - { - scanList.add(r.getFile()); - } - catch (IOException e) - { - throw new BuildException("Problem configuring scanner for jetty-env.xml", e); - } - } - - if (getDefaultsDescriptor() != null) - { - try (Resource r = Resource.newResource(getDefaultsDescriptor());) - { - if (!WebAppContext.WEB_DEFAULTS_XML.equals(getDefaultsDescriptor())) - { - scanList.add(r.getFile()); - } - } - catch (IOException e) - { - throw new BuildException("Problem configuring scanner for webdefaults.xml", e); - } - } - - if (getOverrideDescriptor() != null) - { - try - { - Resource r = Resource.newResource(getOverrideDescriptor()); - scanList.add(r.getFile()); - } - catch (IOException e) - { - throw new BuildException("Problem configuring scanner for webdefaults.xml", e); - } - } - - //add any extra classpath and libs - List cpFiles = getClassPathFiles(); - if (cpFiles != null) - scanList.addAll(cpFiles); - - //any extra scan targets - List scanFiles = (List)getScanTargetFiles(); - if (scanFiles != null) - scanList.addAll(scanFiles); - - return scanList; - } - - @Override - public void setWar(String path) - { - super.setWar(path); - - try - { - Resource war = Resource.newResource(path); - if (war.exists() && war.isDirectory() && getDescriptor() == null) - { - Resource webXml = war.addPath("WEB-INF/web.xml"); - setDescriptor(webXml.toString()); - } - } - catch (IOException e) - { - throw new BuildException(e); - } - } - - @Override - public void doStart() - { - try - { - TaskLog.logWithTimestamp("Starting web application " + this.getDescriptor()); - - if (jettyEnvXml != null && jettyEnvXml.exists()) - getConfiguration(EnvConfiguration.class).setJettyEnvResource(new PathResource(jettyEnvXml)); - - ClassLoader parentLoader = this.getClass().getClassLoader(); - if (parentLoader instanceof AntClassLoader) - parentLoader = new AntURLClassLoader((AntClassLoader)parentLoader); - - setClassLoader(new WebAppClassLoader(parentLoader, this)); - if (attributes != null && attributes.getAttributes() != null) - { - for (Attribute a : attributes.getAttributes()) - { - setAttribute(a.getName(), a.getValue()); - } - } - - //apply a context xml file if one was supplied - if (contextXml != null) - { - XmlConfiguration xmlConfiguration = new XmlConfiguration(new PathResource(contextXml)); - TaskLog.log("Applying context xml file " + contextXml); - xmlConfiguration.configure(this); - } - - super.doStart(); - } - catch (Exception e) - { - TaskLog.log(e.toString()); - } - } - - @Override - public void doStop() - { - try - { - scanFiles = null; - TaskLog.logWithTimestamp("Stopping web application " + this); - Thread.currentThread().sleep(500L); - super.doStop(); - // remove all filters and servlets. They will be recreated - // either via application of a context xml file or web.xml or annotation or servlet api. - // Event listeners are reset in ContextHandler.doStop() - getServletHandler().setFilters(new FilterHolder[0]); - getServletHandler().setFilterMappings(new FilterMapping[0]); - getServletHandler().setServlets(new ServletHolder[0]); - getServletHandler().setServletMappings(new ServletMapping[0]); - } - catch (InterruptedException e) - { - TaskLog.log(e.toString()); - } - catch (Exception e) - { - TaskLog.log(e.toString()); - } - } - - /** - * @return a list of classpath files (libraries and class directories). - */ - public List getClassPathFiles() - { - List classPathFiles = new ArrayList(); - Iterator classesIterator = classes.iterator(); - while (classesIterator.hasNext()) - { - FileSet clazz = classesIterator.next(); - classPathFiles.add(clazz.getDirectoryScanner(project).getBasedir()); - } - - Iterator iterator = libraries.iterator(); - while (iterator.hasNext()) - { - FileSet library = iterator.next(); - String[] includedFiles = library.getDirectoryScanner(project).getIncludedFiles(); - File baseDir = library.getDirectoryScanner(project).getBasedir(); - - for (int i = 0; i < includedFiles.length; i++) - { - classPathFiles.add(new File(baseDir, includedFiles[i])); - } - } - - return classPathFiles; - } - - /** - * @return a FileMatchingConfiguration object describing the - * configuration of all libraries added to this particular web app - * (both classes and libraries). - */ - public FileMatchingConfiguration getLibrariesConfiguration() - { - FileMatchingConfiguration config = new FileMatchingConfiguration(); - - Iterator classesIterator = classes.iterator(); - while (classesIterator.hasNext()) - { - FileSet clazz = classesIterator.next(); - config.addDirectoryScanner(clazz.getDirectoryScanner(project)); - } - - Iterator librariesIterator = libraries.iterator(); - while (librariesIterator.hasNext()) - { - FileSet library = librariesIterator.next(); - config.addDirectoryScanner(library.getDirectoryScanner(project)); - } - - return config; - } - - public File getContextXml() - { - return contextXml; - } - - public void setContextXml(File contextXml) - { - this.contextXml = contextXml; - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/AntWebInfConfiguration.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/AntWebInfConfiguration.java deleted file mode 100644 index 52e43032f853..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/AntWebInfConfiguration.java +++ /dev/null @@ -1,59 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant; - -import java.io.File; -import java.util.List; - -import org.eclipse.jetty.ee10.webapp.Configuration; -import org.eclipse.jetty.ee10.webapp.WebAppClassLoader; -import org.eclipse.jetty.ee10.webapp.WebAppContext; -import org.eclipse.jetty.ee10.webapp.WebInfConfiguration; -import org.eclipse.jetty.ee10.webapp.WebXmlConfiguration; - -public class AntWebInfConfiguration extends WebInfConfiguration -{ - - @Override - public Class replaces() - { - return WebInfConfiguration.class; - } - - /** - * Adds classpath files into web application classloader, and - * sets web.xml and base directory for the configured web application. - * - * @see WebXmlConfiguration#configure(WebAppContext) - */ - @Override - public void configure(WebAppContext context) throws Exception - { - if (context instanceof AntWebAppContext) - { - List classPathFiles = ((AntWebAppContext)context).getClassPathFiles(); - if (classPathFiles != null) - { - for (File cpFile : classPathFiles) - { - if (cpFile.exists()) - { - ((WebAppClassLoader)context.getClassLoader()).addClassPath(cpFile.getCanonicalPath()); - } - } - } - } - super.configure(context); - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/AntWebXmlConfiguration.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/AntWebXmlConfiguration.java deleted file mode 100644 index 7599f50e8084..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/AntWebXmlConfiguration.java +++ /dev/null @@ -1,64 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant; - -import java.io.File; -import java.util.List; - -import org.eclipse.jetty.ee10.webapp.Configuration; -import org.eclipse.jetty.ee10.webapp.WebXmlConfiguration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * This configuration object provides additional way to inject application - * properties into the configured web application. The list of classpath files, - * the application base directory and web.xml file could be specified in this - * way. - */ -public class AntWebXmlConfiguration extends WebXmlConfiguration -{ - private static final Logger LOG = LoggerFactory.getLogger(WebXmlConfiguration.class); - - /** - * List of classpath files. - */ - private List classPathFiles; - - /** - * Web application root directory. - */ - private File webAppBaseDir; - - public AntWebXmlConfiguration() - { - super(); - } - - @Override - public Class replaces() - { - return WebXmlConfiguration.class; - } - - public void setClassPathFiles(List classPathFiles) - { - this.classPathFiles = classPathFiles; - } - - public void setWebAppBaseDir(File webAppBaseDir) - { - this.webAppBaseDir = webAppBaseDir; - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/JettyRunTask.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/JettyRunTask.java deleted file mode 100644 index 6c015478143f..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/JettyRunTask.java +++ /dev/null @@ -1,310 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant; - -import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.Property; -import org.eclipse.jetty.ee10.ant.types.Connector; -import org.eclipse.jetty.ee10.ant.types.Connectors; -import org.eclipse.jetty.ee10.ant.types.ContextHandlers; -import org.eclipse.jetty.ee10.ant.types.LoginServices; -import org.eclipse.jetty.ee10.ant.types.SystemProperties; -import org.eclipse.jetty.ee10.ant.utils.TaskLog; -import org.eclipse.jetty.ee10.servlet.security.LoginService; -import org.eclipse.jetty.ee10.webapp.WebAppContext; -import org.eclipse.jetty.server.RequestLog; - -/** - * Ant task for running a Jetty server. - */ -public class JettyRunTask extends Task -{ - private int scanIntervalSeconds; - - /** - * Temporary files directory. - */ - private File tempDirectory; - - /** - * List of web applications to be deployed. - */ - private List webapps = new ArrayList<>(); - - /** - * Location of jetty.xml file. - */ - private File jettyXml; - - /** - * List of server connectors. - */ - private Connectors connectors = null; - - /** - * Server request logger object. - */ - private RequestLog requestLog; - - /** - * List of login services. - */ - private LoginServices loginServices; - - /** - * List of system properties to be set. - */ - private SystemProperties systemProperties; - - /** - * List of other contexts to deploy - */ - private ContextHandlers contextHandlers; - - /** - * Port Jetty will use for the default connector - */ - private int jettyPort = 8080; - - private int stopPort; - - private String stopKey; - - private boolean daemon; - - public JettyRunTask() - { - TaskLog.setTask(this); - } - - /** - * Creates a new WebApp Ant object. - * - * @param webapp the webapp context - */ - public void addWebApp(AntWebAppContext webapp) - { - webapps.add(webapp); - } - - /** - * Adds a new Ant's connector tag object if it have not been created yet. - * - * @param connectors the connectors - */ - public void addConnectors(Connectors connectors) - { - if (this.connectors != null) - throw new BuildException("Only one tag is allowed!"); - this.connectors = connectors; - } - - public void addLoginServices(LoginServices services) - { - if (this.loginServices != null) - throw new BuildException("Only one tag is allowed!"); - this.loginServices = services; - } - - public void addSystemProperties(SystemProperties systemProperties) - { - if (this.systemProperties != null) - throw new BuildException("Only one tag is allowed!"); - this.systemProperties = systemProperties; - } - - public void addContextHandlers(ContextHandlers handlers) - { - if (this.contextHandlers != null) - throw new BuildException("Only one tag is allowed!"); - this.contextHandlers = handlers; - } - - public File getTempDirectory() - { - return tempDirectory; - } - - public void setTempDirectory(File tempDirectory) - { - this.tempDirectory = tempDirectory; - } - - public File getJettyXml() - { - return jettyXml; - } - - public void setJettyXml(File jettyXml) - { - this.jettyXml = jettyXml; - } - - public void setRequestLog(String className) - { - try - { - this.requestLog = (RequestLog)Class.forName(className).getDeclaredConstructor().newInstance(); - } - catch (ClassNotFoundException e) - { - throw new BuildException("Unknown request logger class: " + className); - } - catch (Exception e) - { - throw new BuildException("Request logger instantiation exception: " + e); - } - } - - public String getRequestLog() - { - if (requestLog != null) - { - return requestLog.getClass().getName(); - } - - return ""; - } - - /** - * Sets the port Jetty uses for the default connector. - * - * @param jettyPort The port Jetty will use for the default connector - */ - public void setJettyPort(final int jettyPort) - { - this.jettyPort = jettyPort; - } - - /** - * Executes this Ant task. The build flow is being stopped until Jetty - * server stops. - * - * @throws BuildException if unable to build - */ - @Override - public void execute() throws BuildException - { - - TaskLog.log("Configuring Jetty for project: " + getProject().getName()); - - setSystemProperties(); - - List connectorsList = null; - - if (connectors != null) - connectorsList = connectors.getConnectors(); - else - connectorsList = new Connectors(jettyPort, 30000).getDefaultConnectors(); - - List loginServicesList = (loginServices != null ? loginServices.getLoginServices() : new ArrayList()); - ServerProxyImpl server = new ServerProxyImpl(); - server.setConnectors(connectorsList); - server.setLoginServices(loginServicesList); - server.setRequestLog(requestLog); - server.setJettyXml(jettyXml); - server.setDaemon(daemon); - server.setStopPort(stopPort); - server.setStopKey(stopKey); - server.setContextHandlers(contextHandlers); - server.setTempDirectory(tempDirectory); - server.setScanIntervalSecs(scanIntervalSeconds); - - try - { - for (WebAppContext webapp : webapps) - { - server.addWebApplication((AntWebAppContext)webapp); - } - } - catch (Exception e) - { - throw new BuildException(e); - } - - server.start(); - } - - public int getStopPort() - { - return stopPort; - } - - public void setStopPort(int stopPort) - { - this.stopPort = stopPort; - TaskLog.log("stopPort=" + stopPort); - } - - public String getStopKey() - { - return stopKey; - } - - public void setStopKey(String stopKey) - { - this.stopKey = stopKey; - TaskLog.log("stopKey=" + stopKey); - } - - /** - * @return the daemon - */ - public boolean isDaemon() - { - return daemon; - } - - /** - * @param daemon the daemon to set - */ - public void setDaemon(boolean daemon) - { - this.daemon = daemon; - TaskLog.log("Daemon=" + daemon); - } - - public int getScanIntervalSeconds() - { - return scanIntervalSeconds; - } - - public void setScanIntervalSeconds(int secs) - { - scanIntervalSeconds = secs; - TaskLog.log("scanIntervalSecs=" + secs); - } - - /** - * Sets the system properties. - */ - private void setSystemProperties() - { - if (systemProperties != null) - { - Iterator propertiesIterator = systemProperties.getSystemProperties().iterator(); - while (propertiesIterator.hasNext()) - { - Property property = ((Property)propertiesIterator.next()); - SystemProperties.setIfNotSetAlready(property); - } - } - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/JettyStopTask.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/JettyStopTask.java deleted file mode 100644 index b8249d6d4451..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/JettyStopTask.java +++ /dev/null @@ -1,114 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant; - -import java.io.InputStreamReader; -import java.io.LineNumberReader; -import java.io.OutputStream; -import java.net.ConnectException; -import java.net.InetAddress; -import java.net.Socket; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import org.eclipse.jetty.ee10.ant.utils.TaskLog; - -/** - * JettyStopTask - */ -public class JettyStopTask extends Task -{ - - private int stopPort; - - private String stopKey; - - private int stopWait; - - /** - * - */ - public JettyStopTask() - { - TaskLog.setTask(this); - } - - @Override - public void execute() throws BuildException - { - try - { - Socket s = new Socket(InetAddress.getByName("127.0.0.1"), stopPort); - if (stopWait > 0) - s.setSoTimeout(stopWait * 1000); - try - { - OutputStream out = s.getOutputStream(); - out.write((stopKey + "\r\nstop\r\n").getBytes()); - out.flush(); - - if (stopWait > 0) - { - TaskLog.log("Waiting" + (stopWait > 0 ? (" " + stopWait + "sec") : "") + " for jetty to stop"); - LineNumberReader lin = new LineNumberReader(new InputStreamReader(s.getInputStream())); - String response = lin.readLine(); - if ("Stopped".equals(response)) - System.err.println("Stopped"); - } - } - finally - { - s.close(); - } - } - catch (ConnectException e) - { - TaskLog.log("Jetty not running!"); - } - catch (Exception e) - { - TaskLog.log(e.getMessage()); - } - } - - public int getStopPort() - { - return stopPort; - } - - public void setStopPort(int stopPort) - { - this.stopPort = stopPort; - } - - public String getStopKey() - { - return stopKey; - } - - public void setStopKey(String stopKey) - { - this.stopKey = stopKey; - } - - public int getStopWait() - { - return stopWait; - } - - public void setStopWait(int stopWait) - { - this.stopWait = stopWait; - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/ServerProxyImpl.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/ServerProxyImpl.java deleted file mode 100644 index ab0858117574..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/ServerProxyImpl.java +++ /dev/null @@ -1,491 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant; - -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.jetty.ee10.ant.types.Connector; -import org.eclipse.jetty.ee10.ant.types.ContextHandlers; -import org.eclipse.jetty.ee10.ant.utils.ServerProxy; -import org.eclipse.jetty.ee10.ant.utils.TaskLog; -import org.eclipse.jetty.ee10.servlet.security.LoginService; -import org.eclipse.jetty.server.Handler; -import org.eclipse.jetty.server.RequestLog; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.server.ShutdownMonitor; -import org.eclipse.jetty.server.handler.ContextHandler; -import org.eclipse.jetty.server.handler.ContextHandlerCollection; -import org.eclipse.jetty.server.handler.DefaultHandler; -import org.eclipse.jetty.util.Scanner; -import org.eclipse.jetty.util.resource.PathResource; -import org.eclipse.jetty.util.resource.Resource; -import org.eclipse.jetty.xml.XmlConfiguration; -import org.xml.sax.SAXException; - -/** - * A proxy class for interaction with Jetty server object. Used to have some - * level of abstraction over standard Jetty classes. - */ -public class ServerProxyImpl implements ServerProxy -{ - - /** - * Proxied Jetty server object. - */ - private Server server; - - /** - * Temporary files directory. - */ - private File tempDirectory; - - /** - * Collection of context handlers (web application contexts). - */ - private ContextHandlerCollection contexts; - - /** - * Location of jetty.xml file. - */ - private File jettyXml; - - /** - * List of connectors. - */ - private List connectors; - - /** - * Request logger. - */ - private RequestLog requestLog; - - /** - * User realms. - */ - private List loginServices; - - /** - * List of added web applications. - */ - private List webApplications = new ArrayList(); - - /** - * other contexts to deploy - */ - private ContextHandlers contextHandlers; - - /** - * scan interval for changed files - */ - private int scanIntervalSecs; - - /** - * port to listen for stop command - */ - private int stopPort; - - /** - * security key for stop command - */ - private String stopKey; - - /** - * wait for all jetty threads to exit or continue - */ - private boolean daemon; - - private boolean configured = false; - - /** - * WebAppScannerListener - * - * Handle notifications that files we are interested in have changed - * during execution. - */ - public static class WebAppScannerListener implements Scanner.BulkListener - { - AntWebAppContext awc; - - public WebAppScannerListener(AntWebAppContext awc) - { - this.awc = awc; - } - - @Override - public void filesChanged(Set changedFileNames) - { - boolean isScanned = false; - try - { - Iterator itor = changedFileNames.iterator(); - while (!isScanned && itor.hasNext()) - { - isScanned = awc.isScanned(Resource.newResource(itor.next()).getFile()); - } - if (isScanned) - { - awc.stop(); - awc.start(); - } - } - catch (Exception e) - { - TaskLog.log(e.getMessage()); - } - } - } - - /** - * Default constructor. Creates a new Jetty server with a standard connector - * listening on a given port. - */ - public ServerProxyImpl() - { - server = new Server(); - server.setStopAtShutdown(true); - } - - @Override - public void addWebApplication(AntWebAppContext webApp) - { - webApplications.add(webApp); - } - - public int getStopPort() - { - return stopPort; - } - - public void setStopPort(int stopPort) - { - this.stopPort = stopPort; - } - - public String getStopKey() - { - return stopKey; - } - - public void setStopKey(String stopKey) - { - this.stopKey = stopKey; - } - - public File getJettyXml() - { - return jettyXml; - } - - public void setJettyXml(File jettyXml) - { - this.jettyXml = jettyXml; - } - - public List getConnectors() - { - return connectors; - } - - public void setConnectors(List connectors) - { - this.connectors = connectors; - } - - public RequestLog getRequestLog() - { - return requestLog; - } - - public void setRequestLog(RequestLog requestLog) - { - this.requestLog = requestLog; - } - - public List getLoginServices() - { - return loginServices; - } - - public void setLoginServices(List loginServices) - { - this.loginServices = loginServices; - } - - public List getWebApplications() - { - return webApplications; - } - - public void setWebApplications(List webApplications) - { - this.webApplications = webApplications; - } - - public File getTempDirectory() - { - return tempDirectory; - } - - public void setTempDirectory(File tempDirectory) - { - this.tempDirectory = tempDirectory; - } - - @Override - public void start() - { - try - { - configure(); - - configureWebApps(); - - server.start(); - - System.setProperty("jetty.ant.server.port", "" + ((ServerConnector)server.getConnectors()[0]).getLocalPort()); - - String host = ((ServerConnector)server.getConnectors()[0]).getHost(); - - if (host == null) - { - System.setProperty("jetty.ant.server.host", "localhost"); - } - else - { - System.setProperty("jetty.ant.server.host", host); - } - - startScanners(); - - TaskLog.log("Jetty AntTask Started"); - - if (!daemon) - server.join(); - } - catch (InterruptedException e) - { - new RuntimeException(e); - } - catch (Exception e) - { - e.printStackTrace(); - new RuntimeException(e); - } - } - - @Override - public Object getProxiedObject() - { - return server; - } - - /** - * @return the daemon - */ - public boolean isDaemon() - { - return daemon; - } - - /** - * @param daemon the daemon to set - */ - public void setDaemon(boolean daemon) - { - this.daemon = daemon; - } - - /** - * @return the contextHandlers - */ - public ContextHandlers getContextHandlers() - { - return contextHandlers; - } - - /** - * @param contextHandlers the contextHandlers to set - */ - public void setContextHandlers(ContextHandlers contextHandlers) - { - this.contextHandlers = contextHandlers; - } - - public int getScanIntervalSecs() - { - return scanIntervalSecs; - } - - public void setScanIntervalSecs(int scanIntervalSecs) - { - this.scanIntervalSecs = scanIntervalSecs; - } - - /** - * Configures Jetty server before adding any web applications to it. - */ - private void configure() - { - if (configured) - return; - - configured = true; - - if (stopPort > 0 && stopKey != null) - { - ShutdownMonitor monitor = ShutdownMonitor.getInstance(); - monitor.setPort(stopPort); - monitor.setKey(stopKey); - monitor.setExitVm(false); - } - - if (tempDirectory != null && !tempDirectory.exists()) - tempDirectory.mkdirs(); - - // Applies external configuration via jetty.xml - applyJettyXml(); - - // Configures connectors for this server instance. - if (connectors != null) - { - for (Connector c : connectors) - { - ServerConnector jc = new ServerConnector(server); - - jc.setPort(c.getPort()); - jc.setIdleTimeout(c.getMaxIdleTime()); - - server.addConnector(jc); - } - } - - // Configures login services - if (loginServices != null) - { - for (LoginService ls : loginServices) - { - server.addBean(ls); - } - } - - // Does not cache resources, to prevent Windows from locking files - Resource.setDefaultUseCaches(false); - - // Set default server handlers - configureHandlers(); - } - - /** - * - */ - private void configureHandlers() - { - if (requestLog != null) - server.setRequestLog(requestLog); - - contexts = server.getDescendant(ContextHandlerCollection.class); - if (contexts == null) - { - contexts = new ContextHandlerCollection(); - Handler.Collection handlers = server.getDescendant(Handler.Collection.class); - if (handlers == null) - server.setHandler(new Handler.Collection(contexts, new DefaultHandler())); - else - handlers.addHandler(contexts); - } - - //if there are any extra contexts to deploy - if (contextHandlers != null && contextHandlers.getContextHandlers() != null) - { - for (ContextHandler c : contextHandlers.getContextHandlers()) - { - contexts.addHandler(c); - } - } - } - - /** - * Applies jetty.xml configuration to the Jetty server instance. - */ - private void applyJettyXml() - { - if (jettyXml != null && jettyXml.exists()) - { - TaskLog.log("Configuring jetty from xml configuration file = " + jettyXml.getAbsolutePath()); - XmlConfiguration configuration; - try - { - configuration = new XmlConfiguration(new PathResource(jettyXml)); - configuration.configure(server); - } - catch (MalformedURLException e) - { - throw new RuntimeException(e); - } - catch (SAXException e) - { - throw new RuntimeException(e); - } - catch (IOException e) - { - throw new RuntimeException(e); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - } - - /** - * Starts web applications' scanners. - */ - private void startScanners() throws Exception - { - for (AntWebAppContext awc : webApplications) - { - if (scanIntervalSecs <= 0) - return; - - TaskLog.log("Web application '" + awc + "': starting scanner at interval of " + scanIntervalSecs + " seconds."); - Scanner.Listener changeListener = new WebAppScannerListener(awc); - Scanner scanner = new Scanner(); - scanner.setScanInterval(scanIntervalSecs); - scanner.addListener(changeListener); - scanner.setScanDirs(awc.getScanFiles()); - scanner.setReportExistingFilesOnStartup(false); - scanner.start(); - } - } - - /** - * - */ - private void configureWebApps() - { - for (AntWebAppContext awc : webApplications) - { - awc.setAttribute(AntWebAppContext.BASETEMPDIR, tempDirectory); - if (contexts != null) - contexts.addHandler(awc); - } - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/package-info.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/package-info.java deleted file mode 100644 index 02e73ad568e4..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -/** - * Jetty Ant : Ant Tasks and Configuration - */ -package org.eclipse.jetty.ee10.ant; - diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/Attribute.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/Attribute.java deleted file mode 100644 index 028d39521c8e..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/Attribute.java +++ /dev/null @@ -1,42 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant.types; - -public class Attribute -{ - - String name; - - String value; - - public void setName(String name) - { - this.name = name; - } - - public void setValue(String value) - { - this.value = value; - } - - public String getName() - { - return name; - } - - public String getValue() - { - return value; - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/Attributes.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/Attributes.java deleted file mode 100644 index 461024ee6349..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/Attributes.java +++ /dev/null @@ -1,33 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant.types; - -import java.util.ArrayList; -import java.util.List; - -public class Attributes -{ - - List _attributes = new ArrayList(); - - public void addAttribute(Attribute attr) - { - _attributes.add(attr); - } - - public List getAttributes() - { - return _attributes; - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/Connector.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/Connector.java deleted file mode 100644 index 901fe24c7f5e..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/Connector.java +++ /dev/null @@ -1,54 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant.types; - -/** - * Connector - */ -public class Connector -{ - private int port; - private int maxIdleTime; - - public Connector() - { - - } - - public Connector(int port, int maxIdleTime) - { - this.port = port; - this.maxIdleTime = maxIdleTime; - } - - public int getPort() - { - return port; - } - - public void setPort(int port) - { - this.port = port; - } - - public int getMaxIdleTime() - { - return maxIdleTime; - } - - public void setMaxIdleTime(int maxIdleTime) - { - this.maxIdleTime = maxIdleTime; - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/Connectors.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/Connectors.java deleted file mode 100644 index 3b7bc4e9ec69..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/Connectors.java +++ /dev/null @@ -1,76 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant.types; - -import java.util.ArrayList; -import java.util.List; - -/** - * Specifies a jetty configuration <connectors/> element for Ant build file. - */ -public class Connectors -{ - private List connectors = new ArrayList(); - private List defaultConnectors = new ArrayList(); - - /** - * Default constructor. - */ - public Connectors() - { - this(8080, 30000); - } - - /** - * Constructor. - * - * @param port The port that the default connector will listen on - * @param maxIdleTime The maximum idle time for the default connector - */ - public Connectors(int port, int maxIdleTime) - { - defaultConnectors.add(new Connector(port, maxIdleTime)); - } - - /** - * Adds a connector to the list of connectors to deploy. - * - * @param connector A connector to add to the list - */ - public void add(Connector connector) - { - connectors.add(connector); - } - - /** - * Returns the list of known connectors to deploy. - * - * @return The list of known connectors - */ - public List getConnectors() - { - return connectors; - } - - /** - * Gets the default list of connectors to deploy when no connectors - * were explicitly added to the list. - * - * @return The list of default connectors - */ - public List getDefaultConnectors() - { - return defaultConnectors; - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/ContextHandlers.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/ContextHandlers.java deleted file mode 100644 index 7fec12413fc2..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/ContextHandlers.java +++ /dev/null @@ -1,37 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant.types; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jetty.server.handler.ContextHandler; - -/** - * Specifies <contextHandlers/> element in web app configuration. - */ -public class ContextHandlers -{ - private List contextHandlers = new ArrayList(); - - public void add(ContextHandler handler) - { - contextHandlers.add(handler); - } - - public List getContextHandlers() - { - return contextHandlers; - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/FileMatchingConfiguration.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/FileMatchingConfiguration.java deleted file mode 100644 index 7617d16b9450..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/FileMatchingConfiguration.java +++ /dev/null @@ -1,91 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant.types; - -import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.tools.ant.DirectoryScanner; - -/** - * Describes set of files matched by <fileset/> elements in ant configuration - * file. It is used to group application classes, libraries, and scannedTargets - * elements. - */ -public class FileMatchingConfiguration -{ - - private List directoryScanners; - - public FileMatchingConfiguration() - { - this.directoryScanners = new ArrayList<>(); - } - - /** - * @param directoryScanner new directory scanner retrieved from the - * <fileset/> element. - */ - public void addDirectoryScanner(DirectoryScanner directoryScanner) - { - this.directoryScanners.add(directoryScanner); - } - - /** - * @return a list of base directories denoted by a list of directory - * scanners. - */ - public List getBaseDirectories() - { - List baseDirs = new ArrayList<>(); - Iterator scanners = directoryScanners.iterator(); - while (scanners.hasNext()) - { - DirectoryScanner scanner = (DirectoryScanner)scanners.next(); - baseDirs.add(scanner.getBasedir()); - } - - return baseDirs; - } - - /** - * Checks if passed file is scanned by any of the directory scanners. - * - * @param pathToFile a fully qualified path to tested file. - * @return true if so, false otherwise. - */ - public boolean isIncluded(String pathToFile) - { - Iterator scanners = directoryScanners.iterator(); - while (scanners.hasNext()) - { - DirectoryScanner scanner = (DirectoryScanner)scanners.next(); - scanner.scan(); - String[] includedFiles = scanner.getIncludedFiles(); - - for (int i = 0; i < includedFiles.length; i++) - { - File includedFile = new File(scanner.getBasedir(), includedFiles[i]); - if (pathToFile.equalsIgnoreCase(includedFile.getAbsolutePath())) - { - return true; - } - } - } - - return false; - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/LoginServices.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/LoginServices.java deleted file mode 100644 index d803da438ec0..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/LoginServices.java +++ /dev/null @@ -1,37 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant.types; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jetty.ee10.servlet.security.LoginService; - -/** - * Specifies a jetty configuration <loginServices/> element for Ant build file. - */ -public class LoginServices -{ - private List loginServices = new ArrayList(); - - public void add(LoginService service) - { - loginServices.add(service); - } - - public List getLoginServices() - { - return loginServices; - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/SystemProperties.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/SystemProperties.java deleted file mode 100644 index c746dea86f5d..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/SystemProperties.java +++ /dev/null @@ -1,59 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant.types; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tools.ant.taskdefs.Property; -import org.eclipse.jetty.ee10.ant.utils.TaskLog; - -/** - * SystemProperties - *

- * Ant <systemProperties/> tag definition. - */ -public class SystemProperties -{ - - private List systemProperties = new ArrayList(); - - public List getSystemProperties() - { - return systemProperties; - } - - public void addSystemProperty(Property property) - { - systemProperties.add(property); - } - - /** - * Set a System.property with this value if it is not already set. - * - * @param property the property to test - * @return true if property has been set - */ - public static boolean setIfNotSetAlready(Property property) - { - if (System.getProperty(property.getName()) == null) - { - System.setProperty(property.getName(), (property.getValue() == null ? "" : property.getValue())); - TaskLog.log("Setting property '" + property.getName() + "' to value '" + property.getValue() + "'"); - return true; - } - - return false; - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/package-info.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/package-info.java deleted file mode 100644 index b41b3e779fd1..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/types/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -/** - * Jetty Ant : Ant Wrappers of Jetty Internals - */ -package org.eclipse.jetty.ee10.ant.types; - diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/utils/ServerProxy.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/utils/ServerProxy.java deleted file mode 100644 index 49c0bf6ad76e..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/utils/ServerProxy.java +++ /dev/null @@ -1,34 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant.utils; - -import org.eclipse.jetty.ee10.ant.AntWebAppContext; - -public interface ServerProxy -{ - - /** - * Adds a new web application to this server. - * - * @param awc a AntWebAppContext object. - */ - public void addWebApplication(AntWebAppContext awc); - - /** - * Starts this server. - */ - public void start(); - - public Object getProxiedObject(); -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/utils/TaskLog.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/utils/TaskLog.java deleted file mode 100644 index 6cb086483331..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/utils/TaskLog.java +++ /dev/null @@ -1,52 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant.utils; - -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.apache.tools.ant.Task; - -/** - * Provides logging functionality for classes without access to the Ant project - * variable. - */ -public class TaskLog -{ - - private static Task task; - - private static final SimpleDateFormat format = new SimpleDateFormat( - "yyyy-MM-dd HH:mm:ss.SSS"); - - public static void setTask(Task task) - { - TaskLog.task = task; - } - - public static void log(String message) - { - task.log(message); - } - - public static void logWithTimestamp(String message) - { - String date; - synchronized (format) - { - date = format.format(new Date()); - } - task.log(date + ": " + message); - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/utils/package-info.java b/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/utils/package-info.java deleted file mode 100644 index e9ca73c9a479..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/java/org/eclipse/jetty/ee10/ant/utils/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -/** - * Jetty Ant : Utility Classes - */ -package org.eclipse.jetty.ee10.ant.utils; - diff --git a/jetty-ee10/jetty-ee10-ant/src/main/resources/META-INF/services/org.eclipse.jetty.ee10.webapp.Configuration b/jetty-ee10/jetty-ee10-ant/src/main/resources/META-INF/services/org.eclipse.jetty.ee10.webapp.Configuration deleted file mode 100644 index 817ad816933e..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/resources/META-INF/services/org.eclipse.jetty.ee10.webapp.Configuration +++ /dev/null @@ -1,2 +0,0 @@ -org.eclipse.jetty.ee10.ant.AntWebInfConfiguration -org.eclipse.jetty.ee10.ant.AntWebXmlConfiguration diff --git a/jetty-ee10/jetty-ee10-ant/src/main/resources/tasks.properties b/jetty-ee10/jetty-ee10-ant/src/main/resources/tasks.properties deleted file mode 100644 index 8a3d090bf0fc..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/main/resources/tasks.properties +++ /dev/null @@ -1,2 +0,0 @@ -jetty.run=org.eclipse.jetty.ee10.ant.JettyRunTask -jetty.stop=org.eclipse.jetty.ee10.ant.JettyStopTask \ No newline at end of file diff --git a/jetty-ee10/jetty-ee10-ant/src/test/config/build.xml b/jetty-ee10/jetty-ee10-ant/src/test/config/build.xml deleted file mode 100644 index fd80592ab9ab..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/config/build.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/java/org/eclipse/jetty/ee10/ant/AntBuild.java b/jetty-ee10/jetty-ee10-ant/src/test/java/org/eclipse/jetty/ee10/ant/AntBuild.java deleted file mode 100644 index a21362f55d4c..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/java/org/eclipse/jetty/ee10/ant/AntBuild.java +++ /dev/null @@ -1,289 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; -import java.io.PrintStream; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.tools.ant.DefaultLogger; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.ProjectHelper; -import org.eclipse.jetty.toolchain.test.IO; -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; - -public class AntBuild -{ - private Thread _process; - private String _ant; - - private int _port; - private String _host; - - public AntBuild(String ant) - { - _ant = ant; - } - - private class AntBuildProcess implements Runnable - { - List connList; - - @Override - public void run() - { - File buildFile = new File(_ant); - - Project antProject = new Project(); - try - { - antProject.setBaseDir(MavenTestingUtils.getBaseDir()); - antProject.setUserProperty("ant.file", buildFile.getAbsolutePath()); - DefaultLogger logger = new DefaultLogger(); - - ConsoleParser parser = new ConsoleParser(); - //connList = parser.newPattern(".*([0-9]+\\.[0-9]*\\.[0-9]*\\.[0-9]*):([0-9]*)",1); - connList = parser.newPattern("Jetty AntTask Started", 1); - - PipedOutputStream pos = new PipedOutputStream(); - PipedInputStream pis = new PipedInputStream(pos); - - PipedOutputStream pose = new PipedOutputStream(); - PipedInputStream pise = new PipedInputStream(pose); - - startPump("STDOUT", parser, pis); - startPump("STDERR", parser, pise); - - logger.setErrorPrintStream(new PrintStream(pos)); - logger.setOutputPrintStream(new PrintStream(pose)); - logger.setMessageOutputLevel(Project.MSG_VERBOSE); - antProject.addBuildListener(logger); - - antProject.fireBuildStarted(); - antProject.init(); - - ProjectHelper helper = ProjectHelper.getProjectHelper(); - - antProject.addReference("ant.projectHelper", helper); - - helper.parse(antProject, buildFile); - - antProject.executeTarget("jetty.run"); - - parser.waitForDone(10000, TimeUnit.MILLISECONDS); - } - catch (Exception e) - { - antProject.fireBuildFinished(e); - } - } - - public void waitForStarted() throws Exception - { - while (connList == null || connList.isEmpty()) - { - Thread.sleep(10); - } - } - } - - public void start() throws Exception - { - System.out.println("Starting Ant Build ..."); - AntBuildProcess abp = new AntBuildProcess(); - _process = new Thread(abp); - - _process.start(); - - abp.waitForStarted(); - - // once this has returned we should have the connection info we need - //_host = abp.getConnectionList().get(0)[0]; - //_port = Integer.parseInt(abp.getConnectionList().get(0)[1]); - - } - - public int getJettyPort() - { - return Integer.parseInt(System.getProperty("jetty.ant.server.port")); - } - - public String getJettyHost() - { - return System.getProperty("jetty.ant.server.host"); - } - - /** - * Stop the jetty server - */ - public void stop() - { - System.out.println("Stopping Ant Build ..."); - _process.interrupt(); - } - - private static class ConsoleParser - { - private List patterns = new ArrayList(); - private CountDownLatch latch; - private int count; - - public List newPattern(String exp, int cnt) - { - ConsolePattern pat = new ConsolePattern(exp, cnt); - patterns.add(pat); - count += cnt; - - return pat.getMatches(); - } - - public void parse(String line) - { - for (ConsolePattern pat : patterns) - { - Matcher mat = pat.getMatcher(line); - if (mat.find()) - { - int num = 0; - int count = mat.groupCount(); - String[] match = new String[count]; - while (num++ < count) - { - match[num - 1] = mat.group(num); - } - pat.getMatches().add(match); - - if (pat.getCount() > 0) - { - getLatch().countDown(); - } - } - } - } - - public void waitForDone(long timeout, TimeUnit unit) throws InterruptedException - { - getLatch().await(timeout, unit); - } - - private CountDownLatch getLatch() - { - synchronized (this) - { - if (latch == null) - { - latch = new CountDownLatch(count); - } - } - - return latch; - } - } - - private static class ConsolePattern - { - private Pattern pattern; - private List matches; - private int count; - - ConsolePattern(String exp, int cnt) - { - pattern = Pattern.compile(exp); - matches = new ArrayList(); - count = cnt; - } - - public Matcher getMatcher(String line) - { - return pattern.matcher(line); - } - - public List getMatches() - { - return matches; - } - - public int getCount() - { - return count; - } - } - - private void startPump(String mode, ConsoleParser parser, InputStream inputStream) - { - ConsoleStreamer pump = new ConsoleStreamer(mode, inputStream); - pump.setParser(parser); - Thread thread = new Thread(pump, "ConsoleStreamer/" + mode); - thread.start(); - } - - /** - * Simple streamer for the console output from a Process - */ - private static class ConsoleStreamer implements Runnable - { - private String mode; - private BufferedReader reader; - private ConsoleParser parser; - - public ConsoleStreamer(String mode, InputStream is) - { - this.mode = mode; - this.reader = new BufferedReader(new InputStreamReader(is)); - } - - public void setParser(ConsoleParser connector) - { - this.parser = connector; - } - - @Override - public void run() - { - String line; - //System.out.printf("ConsoleStreamer/%s initiated%n",mode); - try - { - while ((line = reader.readLine()) != (null)) - { - if (parser != null) - { - parser.parse(line); - } - System.out.println("[" + mode + "] " + line); - } - } - catch (IOException ignore) - { - /* ignore */ - } - finally - { - IO.close(reader); - } - //System.out.printf("ConsoleStreamer/%s finished%n",mode); - } - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/test/java/org/eclipse/jetty/ee10/ant/JettyAntTaskTest.java b/jetty-ee10/jetty-ee10-ant/src/test/java/org/eclipse/jetty/ee10/ant/JettyAntTaskTest.java deleted file mode 100644 index 1fc38e101fbc..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/java/org/eclipse/jetty/ee10/ant/JettyAntTaskTest.java +++ /dev/null @@ -1,66 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee10.ant; - -import java.net.HttpURLConnection; -import java.net.URI; - -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; - -public class JettyAntTaskTest -{ - - @Test - public void testConnectorTask() throws Exception - { - AntBuild build = new AntBuild(MavenTestingUtils.getTestResourceFile("connector-test.xml").getAbsolutePath()); - - build.start(); - - URI uri = new URI("http://" + build.getJettyHost() + ":" + build.getJettyPort()); - - HttpURLConnection connection = (HttpURLConnection)uri.toURL().openConnection(); - - connection.connect(); - - assertThat("response code is 404", connection.getResponseCode(), is(404)); - - build.stop(); - } - - @Disabled //TODO - @Test - public void testWebApp() throws Exception - { - AntBuild build = new AntBuild(MavenTestingUtils.getTestResourceFile("webapp-test.xml").getAbsolutePath()); - - build.start(); - - URI uri = new URI("http://" + build.getJettyHost() + ":" + build.getJettyPort() + "/"); - - HttpURLConnection connection = (HttpURLConnection)uri.toURL().openConnection(); - - connection.connect(); - - assertThat("response code is 200", connection.getResponseCode(), is(200)); - - System.err.println("Stop build!"); - build.stop(); - } -} diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/connector-test.xml b/jetty-ee10/jetty-ee10-ant/src/test/resources/connector-test.xml deleted file mode 100644 index 78a0b8b29490..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/connector-test.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/WEB-INF/acme-taglib.tld b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/WEB-INF/acme-taglib.tld deleted file mode 100644 index 09b70aece57c..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/WEB-INF/acme-taglib.tld +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - 1.0 - 1.2 - acme - http://www.acme.com/taglib - taglib example - - com.acme.TagListener - - - - date - com.acme.DateTag - TAGDEPENDENT - Display Date - - tz - false - - - - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/WEB-INF/acme-taglib2.tld b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/WEB-INF/acme-taglib2.tld deleted file mode 100644 index 3edb7bb14f35..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/WEB-INF/acme-taglib2.tld +++ /dev/null @@ -1,35 +0,0 @@ - - - - Acme JSP2 tags - 1.0 - acme2 - http://www.acme.com/taglib2 - - Simple Date formatting - date2 - com.acme.Date2Tag - scriptless - - Day of the Month - day - - - Month of the Year - month - - - Year - year - - - format - true - true - - - - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/WEB-INF/tags/panel.tag b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/WEB-INF/tags/panel.tag deleted file mode 100644 index fa0540a61dbd..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/WEB-INF/tags/panel.tag +++ /dev/null @@ -1,17 +0,0 @@ -<%-- - - Copyright (c) 2002 The Apache Software Foundation. All rights - - reserved. ---%> -<%@ attribute name="color" %> -<%@ attribute name="bgcolor" %> -<%@ attribute name="title" %> - - - - - - - -
${title}
- -
diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/WEB-INF/web.xml b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/WEB-INF/web.xml deleted file mode 100644 index b3b1176cac8b..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/WEB-INF/web.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Test WebApp - - - org.eclipse.jetty.server.context.ManagedAttributes - QoSFilter,TransparentProxy.ThreadPool,TransparentProxy.HttpClient - - - - - foo.jsp - /jsp/foo/foo.jsp - - - foo.jsp - /jsp/foo/ - - - - - - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/index.html b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/index.html deleted file mode 100644 index bab0d7c3a912..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/index.html +++ /dev/null @@ -1,5 +0,0 @@ - - -

INDEX!

- - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/bean1.jsp b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/bean1.jsp deleted file mode 100644 index 0c15da2ca4e3..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/bean1.jsp +++ /dev/null @@ -1,15 +0,0 @@ - -<%@ page session="true"%> - - - -

JSP1.2 Beans: 1

- -Counter accessed times.
-Counter last accessed by
- - -Goto bean2.jsp - - - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/bean2.jsp b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/bean2.jsp deleted file mode 100644 index 624dc2e59d4b..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/bean2.jsp +++ /dev/null @@ -1,15 +0,0 @@ - -<%@ page session="true"%> - - - -

JSP1.2 Beans: 2

- -Counter accessed times.
-Counter last accessed by
- - -Goto bean1.jsp - - - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/dump.jsp b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/dump.jsp deleted file mode 100644 index fb73b0b00026..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/dump.jsp +++ /dev/null @@ -1,23 +0,0 @@ - -<%@ page import="java.util.Enumeration" %> - -

JSP Dump

- - - - - - -<% - Enumeration e =request.getParameterNames(); - while(e.hasMoreElements()) - { - String name = (String)e.nextElement(); -%> - - - -<% } %> - -
Request URI:<%= request.getRequestURI() %>
ServletPath:<%= request.getServletPath() %>
PathInfo:<%= request.getPathInfo() %>
getParameter("<%= name %>")<%= request.getParameter(name) %>
- diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/expr.jsp b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/expr.jsp deleted file mode 100644 index e0b25e202031..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/expr.jsp +++ /dev/null @@ -1,23 +0,0 @@ - -

JSP2.0 Expressions

- - - - - - - - - - - - - - - - - - - -
ExpressionResult
\${param["A"]}${param["A"]} 
\${header["host"]}${header["host"]}
\${header["user-agent"]}${header["user-agent"]}
\${1+1}${1+1}
\${param["A"] * 2}${param["A"] * 2} 
- diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/foo/foo.jsp b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/foo/foo.jsp deleted file mode 100644 index 7ec8955932d2..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/foo/foo.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - - - -

FOO Example

-
-

A trivial FOO example -


- - -
-
- - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/index.html b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/index.html deleted file mode 100644 index 644ebc7ff409..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - -

JSP Examples

- - -Main Menu - - - - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/jstl.jsp b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/jstl.jsp deleted file mode 100644 index 9fa7b57e96c6..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/jstl.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - - - -

JSTL Example

-
-

A trivial jstl example -


- - -
-
- - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/tag.jsp b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/tag.jsp deleted file mode 100644 index 069d8c67b172..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/tag.jsp +++ /dev/null @@ -1,16 +0,0 @@ - - - -<%@ taglib uri="http://www.acme.com/taglib" prefix="acme" %> - -<acme:date tz="GMT">EEE, dd/MMM/yyyy HH:mm:ss ZZZ</acme:date> -==> -EEE, dd/MMM/yyyy HH:mm:ss ZZZ -
-<acme:date tz="EST">EEE, dd-MMM-yyyy HH:mm:ss ZZZ</acme:date> -==> -EEE, dd-MMM-yyyy HH:mm:ss ZZZ -
- - - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/tag2.jsp b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/tag2.jsp deleted file mode 100644 index 8071927562a4..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/tag2.jsp +++ /dev/null @@ -1,19 +0,0 @@ - - - -<%@ taglib uri="http://www.acme.com/taglib2" prefix="acme" %> - - - On ${day} of ${month} in the year ${year} - - -
- - - ${day} - ${month} - ${year} - - -
- - - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/tagfile.jsp b/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/tagfile.jsp deleted file mode 100644 index 67299f0229c7..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/foo/jsp/tagfile.jsp +++ /dev/null @@ -1,37 +0,0 @@ -<%@ taglib prefix="acme" tagdir="/WEB-INF/tags" %> - - - - -

JSP 2.0 Tag File Example

-
-

Panel tag created from JSP fragment file in WEB-INF/tags -


- - - - - - -
- - First panel.
-
-
- - Second panel.
- Second panel.
- Second panel.
- Second panel.
-
-
- - Third panel.
- - A panel in a panel. - - Third panel.
-
-
- - diff --git a/jetty-ee10/jetty-ee10-ant/src/test/resources/webapp-test.xml b/jetty-ee10/jetty-ee10-ant/src/test/resources/webapp-test.xml deleted file mode 100644 index fe7023df6698..000000000000 --- a/jetty-ee10/jetty-ee10-ant/src/test/resources/webapp-test.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/jetty-ee10/pom.xml b/jetty-ee10/pom.xml index 1903f86fee6a..ecc9eb3660b8 100644 --- a/jetty-ee10/pom.xml +++ b/jetty-ee10/pom.xml @@ -45,8 +45,6 @@ jetty-ee10-apache-jsp jetty-ee10-glassfish-jstl jetty-ee10-annotations - - jetty-ee10-cdi jetty-ee10-jaas jetty-ee10-jaspi diff --git a/jetty-ee9/jetty-ee9-ant/pom.xml b/jetty-ee9/jetty-ee9-ant/pom.xml deleted file mode 100644 index 4b7a010b1056..000000000000 --- a/jetty-ee9/jetty-ee9-ant/pom.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - org.eclipse.jetty.ee9 - jetty-ee9 - 12.0.0-SNAPSHOT - - 4.0.0 - jetty-ee9-ant - jar - EE9 :: Ant Plugin - - - ${project.groupId}.ant - true - - - - - org.apache.felix - maven-bundle-plugin - true - - - - osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)" - - - osgi.serviceloader; osgi.serviceloader=org.eclipse.jetty.ee9.webapp.Configuration - - - - - - maven-dependency-plugin - - - copy-lib-deps - process-test-resources - - copy-dependencies - - - org.eclipse.jetty - org.eclipse.jetty.orbit,org.eclipse.jetty.websocket - jetty-start - jar - ${project.build.directory}/test-lib - - - - - - - - - org.eclipse.jetty.toolchain - jetty-test-helper - test - - - org.apache.ant - ant - - - org.apache.ant - ant-launcher - - - org.eclipse.jetty.ee9 - jetty-ee9-security - - - org.eclipse.jetty.ee9 - jetty-ee9-plus - - - org.eclipse.jetty.ee9 - jetty-ee9-webapp - - - org.eclipse.jetty.ee9 - jetty-ee9-annotations - - - org.slf4j - slf4j-api - - - org.eclipse.jetty - jetty-slf4j-impl - test - - - diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/AntMetaInfConfiguration.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/AntMetaInfConfiguration.java deleted file mode 100644 index b19da2629556..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/AntMetaInfConfiguration.java +++ /dev/null @@ -1,81 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant; - -import java.io.File; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.List; - -import org.apache.tools.ant.AntClassLoader; -import org.eclipse.jetty.ee9.webapp.Configuration; -import org.eclipse.jetty.ee9.webapp.MetaInfConfiguration; -import org.eclipse.jetty.ee9.webapp.WebAppContext; - -public class AntMetaInfConfiguration extends MetaInfConfiguration -{ - - @Override - public Class replaces() - { - return MetaInfConfiguration.class; - } - - @Override - public void findAndFilterContainerPaths(WebAppContext context) throws Exception - { - // TODO Auto-generated method stub - super.findAndFilterContainerPaths(context); - } - - @Override - protected List getAllContainerJars(final WebAppContext context) throws URISyntaxException - { - List uris = new ArrayList<>(); - if (context.getClassLoader() != null) - { - ClassLoader loader = context.getClassLoader().getParent(); - while (loader != null) - { - if (loader instanceof URLClassLoader) - { - URL[] urls = ((URLClassLoader)loader).getURLs(); - if (urls != null) - for (URL url : urls) - { - uris.add(new URI(url.toString().replaceAll(" ", "%20"))); - } - } - else if (loader instanceof AntClassLoader) - { - AntClassLoader antLoader = (AntClassLoader)loader; - String[] paths = antLoader.getClasspath().split(new String(new char[]{File.pathSeparatorChar})); - if (paths != null) - { - for (String p : paths) - { - File f = new File(p); - uris.add(f.toURI()); - } - } - } - loader = loader.getParent(); - } - } - return uris; - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/AntWebAppContext.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/AntWebAppContext.java deleted file mode 100644 index c139d1ade6be..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/AntWebAppContext.java +++ /dev/null @@ -1,691 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLClassLoader; -import java.security.CodeSource; -import java.security.PermissionCollection; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.jar.Manifest; - -import jakarta.servlet.Servlet; -import org.apache.tools.ant.AntClassLoader; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.types.FileSet; -import org.eclipse.jetty.ee9.ant.types.Attribute; -import org.eclipse.jetty.ee9.ant.types.Attributes; -import org.eclipse.jetty.ee9.ant.types.FileMatchingConfiguration; -import org.eclipse.jetty.ee9.ant.utils.TaskLog; -import org.eclipse.jetty.ee9.plus.webapp.EnvConfiguration; -import org.eclipse.jetty.ee9.servlet.FilterHolder; -import org.eclipse.jetty.ee9.servlet.FilterMapping; -import org.eclipse.jetty.ee9.servlet.ServletHandler; -import org.eclipse.jetty.ee9.servlet.ServletHolder; -import org.eclipse.jetty.ee9.servlet.ServletMapping; -import org.eclipse.jetty.ee9.servlet.Source; -import org.eclipse.jetty.ee9.webapp.MetaInfConfiguration; -import org.eclipse.jetty.ee9.webapp.WebAppClassLoader; -import org.eclipse.jetty.ee9.webapp.WebAppContext; -import org.eclipse.jetty.util.resource.PathResource; -import org.eclipse.jetty.util.resource.Resource; -import org.eclipse.jetty.xml.XmlConfiguration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Extension of WebAppContext to allow configuration via Ant environment. - */ -public class AntWebAppContext extends WebAppContext -{ - private static final Logger LOG = LoggerFactory.getLogger(WebAppContext.class); - - public static final String DEFAULT_CONTAINER_INCLUDE_JAR_PATTERN = - ".*/.*jsp-api-[^/]*\\.jar$|.*/.*jsp-[^/]*\\.jar$|.*/.*taglibs[^/]*\\.jar$|.*/.*jstl[^/]*\\.jar$|.*/.*jsf-impl-[^/]*\\.jar$|.*/.*javax.faces-[^/]*\\.jar$|.*/.*myfaces-impl-[^/]*\\.jar$"; - - /** - * Location of jetty-env.xml file. - */ - private File jettyEnvXml; - - /** - * List of web application libraries. - */ - private List libraries = new ArrayList<>(); - - /** - * List of web application class directories. - */ - private List classes = new ArrayList<>(); - - /** - * context xml file to apply to the webapp - */ - private File contextXml; - - /** - * List of extra scan targets for this web application. - */ - private FileSet scanTargets; - - /** - * context attributes to set - **/ - private Attributes attributes; - - private Project project; - - private List scanFiles; - - private FileMatchingConfiguration librariesConfiguration; - - public static void dump(ClassLoader loader) - { - while (loader != null) - { - System.err.println(loader); - if (loader instanceof URLClassLoader) - { - URL[] urls = ((URLClassLoader)loader).getURLs(); - if (urls != null) - { - for (URL u : urls) - { - System.err.println("\t" + u + "\n"); - } - } - } - loader = loader.getParent(); - } - } - - /** - * AntURLClassLoader - * - * Adapt the AntClassLoader which is not a URLClassLoader - this is needed for - * jsp to be able to search the classpath. - */ - public static class AntURLClassLoader extends URLClassLoader - { - private AntClassLoader antLoader; - - public AntURLClassLoader(AntClassLoader antLoader) - { - super(new URL[]{}, antLoader); - this.antLoader = antLoader; - } - - @Override - public InputStream getResourceAsStream(String name) - { - return super.getResourceAsStream(name); - } - - @Override - public void close() throws IOException - { - super.close(); - } - - @Override - protected void addURL(URL url) - { - super.addURL(url); - } - - @Override - public URL[] getURLs() - { - Set urls = new HashSet(); - - //convert urls from antLoader - String[] paths = antLoader.getClasspath().split(new String(new char[]{File.pathSeparatorChar})); - if (paths != null) - { - for (String p : paths) - { - File f = new File(p); - try - { - urls.add(f.toURI().toURL()); - } - catch (Exception e) - { - LOG.trace("IGNORED", e); - } - } - } - - //add in any that may have been added to us as a URL directly - URL[] ourURLS = super.getURLs(); - if (ourURLS != null) - { - for (URL u : ourURLS) - { - urls.add(u); - } - } - - return urls.toArray(new URL[urls.size()]); - } - - @Override - protected Class findClass(String name) throws ClassNotFoundException - { - return super.findClass(name); - } - - @Override - public URL findResource(String name) - { - return super.findResource(name); - } - - @Override - public Enumeration findResources(String name) throws IOException - { - return super.findResources(name); - } - - @Override - protected PermissionCollection getPermissions(CodeSource codesource) - { - return super.getPermissions(codesource); - } - - @Override - public Class loadClass(String name) throws ClassNotFoundException - { - return super.loadClass(name); - } - - @Override - protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException - { - return super.loadClass(name, resolve); - } - - @Override - protected Object getClassLoadingLock(String className) - { - return super.getClassLoadingLock(className); - } - - @Override - public URL getResource(String name) - { - return super.getResource(name); - } - - @Override - public Enumeration getResources(String name) throws IOException - { - return super.getResources(name); - } - - @Override - protected Package definePackage(String name, Manifest man, URL url) throws IllegalArgumentException - { - return super.definePackage(name, man, url); - } - - @Override - protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, - String implVendor, URL sealBase) throws IllegalArgumentException - { - return super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase); - } - - @Override - protected Package[] getPackages() - { - return super.getPackages(); - } - - @Override - protected String findLibrary(String libname) - { - return super.findLibrary(libname); - } - - @Override - public void setDefaultAssertionStatus(boolean enabled) - { - super.setDefaultAssertionStatus(enabled); - } - - @Override - public void setPackageAssertionStatus(String packageName, boolean enabled) - { - super.setPackageAssertionStatus(packageName, enabled); - } - - @Override - public void setClassAssertionStatus(String className, boolean enabled) - { - super.setClassAssertionStatus(className, enabled); - } - - @Override - public void clearAssertionStatus() - { - super.clearAssertionStatus(); - } - } - - /** - * AntServletHolder - */ - public static class AntServletHolder extends ServletHolder - { - - public AntServletHolder() - { - super(); - } - - public AntServletHolder(Class servlet) - { - super(servlet); - } - - public AntServletHolder(Servlet servlet) - { - super(servlet); - } - - public AntServletHolder(String name, Class servlet) - { - super(name, servlet); - } - - public AntServletHolder(String name, Servlet servlet) - { - super(name, servlet); - } - - protected String getSystemClassPath(ClassLoader loader) throws Exception - { - StringBuilder classpath = new StringBuilder(); - while (loader != null) - { - if (loader instanceof URLClassLoader) - { - URL[] urls = ((URLClassLoader)loader).getURLs(); - if (urls != null) - { - for (int i = 0; i < urls.length; i++) - { - Resource resource = Resource.newResource(urls[i]); - File file = resource.getFile(); - if (file != null && file.exists()) - { - if (classpath.length() > 0) - classpath.append(File.pathSeparatorChar); - classpath.append(file.getAbsolutePath()); - } - } - } - } - else if (loader instanceof AntClassLoader) - { - classpath.append(((AntClassLoader)loader).getClasspath()); - } - - loader = loader.getParent(); - } - - return classpath.toString(); - } - } - - /** - * AntServletHandler - */ - public static class AntServletHandler extends ServletHandler - { - - @Override - public ServletHolder newServletHolder(Source source) - { - return new AntServletHolder(); - } - } - - /** - * Default constructor. Takes project as an argument - * - * @param project the project. - * @throws Exception if unable to create webapp context - */ - public AntWebAppContext(Project project) throws Exception - { - super(); - this.project = project; - setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN, DEFAULT_CONTAINER_INCLUDE_JAR_PATTERN); - setParentLoaderPriority(true); - addConfiguration(new AntWebInfConfiguration(), new AntWebXmlConfiguration(), new AntMetaInfConfiguration()); - } - - /** - * Adds a new Ant's attributes tag object if it have not been created yet. - * - * @param atts the attributes - */ - public void addAttributes(Attributes atts) - { - if (this.attributes != null) - { - throw new BuildException("Only one tag is allowed!"); - } - - this.attributes = atts; - } - - public void addLib(FileSet lib) - { - libraries.add(lib); - } - - public void addClasses(FileSet classes) - { - this.classes.add(classes); - } - - @Override - protected ServletHandler newServletHandler() - { - return new AntServletHandler(); - } - - public void setJettyEnvXml(File jettyEnvXml) - { - this.jettyEnvXml = jettyEnvXml; - TaskLog.log("jetty-env.xml file: = " + (jettyEnvXml == null ? null : jettyEnvXml.getAbsolutePath())); - } - - public File getJettyEnvXml() - { - return this.jettyEnvXml; - } - - public List getLibraries() - { - return librariesConfiguration.getBaseDirectories(); - } - - public void addScanTargets(FileSet scanTargets) - { - if (this.scanTargets != null) - { - throw new BuildException("Only one tag is allowed!"); - } - - this.scanTargets = scanTargets; - } - - public List getScanTargetFiles() - { - if (this.scanTargets == null) - return null; - - FileMatchingConfiguration configuration = new FileMatchingConfiguration(); - configuration.addDirectoryScanner(scanTargets.getDirectoryScanner(project)); - return configuration.getBaseDirectories(); - } - - public List getScanFiles() - { - if (scanFiles == null) - scanFiles = initScanFiles(); - return scanFiles; - } - - public boolean isScanned(File file) - { - List files = getScanFiles(); - if (files == null || files.isEmpty()) - return false; - return files.contains(file); - } - - public List initScanFiles() - { - List scanList = new ArrayList(); - - if (getDescriptor() != null) - { - try (Resource r = Resource.newResource(getDescriptor());) - { - scanList.add(r.getFile()); - } - catch (IOException e) - { - throw new BuildException(e); - } - } - - if (getJettyEnvXml() != null) - { - try (Resource r = Resource.newResource(getJettyEnvXml());) - { - scanList.add(r.getFile()); - } - catch (IOException e) - { - throw new BuildException("Problem configuring scanner for jetty-env.xml", e); - } - } - - if (getDefaultsDescriptor() != null) - { - try (Resource r = Resource.newResource(getDefaultsDescriptor());) - { - if (!WebAppContext.WEB_DEFAULTS_XML.equals(getDefaultsDescriptor())) - { - scanList.add(r.getFile()); - } - } - catch (IOException e) - { - throw new BuildException("Problem configuring scanner for webdefaults.xml", e); - } - } - - if (getOverrideDescriptor() != null) - { - try - { - Resource r = Resource.newResource(getOverrideDescriptor()); - scanList.add(r.getFile()); - } - catch (IOException e) - { - throw new BuildException("Problem configuring scanner for webdefaults.xml", e); - } - } - - //add any extra classpath and libs - List cpFiles = getClassPathFiles(); - if (cpFiles != null) - scanList.addAll(cpFiles); - - //any extra scan targets - List scanFiles = (List)getScanTargetFiles(); - if (scanFiles != null) - scanList.addAll(scanFiles); - - return scanList; - } - - @Override - public void setWar(String path) - { - super.setWar(path); - - try - { - Resource war = Resource.newResource(path); - if (war.exists() && war.isDirectory() && getDescriptor() == null) - { - Resource webXml = war.addPath("WEB-INF/web.xml"); - setDescriptor(webXml.toString()); - } - } - catch (IOException e) - { - throw new BuildException(e); - } - } - - @Override - public void doStart() - { - try - { - TaskLog.logWithTimestamp("Starting web application " + this.getDescriptor()); - - if (jettyEnvXml != null && jettyEnvXml.exists()) - getConfiguration(EnvConfiguration.class).setJettyEnvResource(new PathResource(jettyEnvXml)); - - ClassLoader parentLoader = this.getClass().getClassLoader(); - if (parentLoader instanceof AntClassLoader) - parentLoader = new AntURLClassLoader((AntClassLoader)parentLoader); - - setClassLoader(new WebAppClassLoader(parentLoader, this)); - if (attributes != null && attributes.getAttributes() != null) - { - for (Attribute a : attributes.getAttributes()) - { - setAttribute(a.getName(), a.getValue()); - } - } - - //apply a context xml file if one was supplied - if (contextXml != null) - { - XmlConfiguration xmlConfiguration = new XmlConfiguration(new PathResource(contextXml)); - TaskLog.log("Applying context xml file " + contextXml); - xmlConfiguration.configure(this); - } - - super.doStart(); - } - catch (Exception e) - { - TaskLog.log(e.toString()); - } - } - - @Override - public void doStop() - { - try - { - scanFiles = null; - TaskLog.logWithTimestamp("Stopping web application " + this); - Thread.currentThread().sleep(500L); - super.doStop(); - // remove all filters and servlets. They will be recreated - // either via application of a context xml file or web.xml or annotation or servlet api. - // Event listeners are reset in ContextHandler.doStop() - getServletHandler().setFilters(new FilterHolder[0]); - getServletHandler().setFilterMappings(new FilterMapping[0]); - getServletHandler().setServlets(new ServletHolder[0]); - getServletHandler().setServletMappings(new ServletMapping[0]); - } - catch (InterruptedException e) - { - TaskLog.log(e.toString()); - } - catch (Exception e) - { - TaskLog.log(e.toString()); - } - } - - /** - * @return a list of classpath files (libraries and class directories). - */ - public List getClassPathFiles() - { - List classPathFiles = new ArrayList(); - Iterator classesIterator = classes.iterator(); - while (classesIterator.hasNext()) - { - FileSet clazz = classesIterator.next(); - classPathFiles.add(clazz.getDirectoryScanner(project).getBasedir()); - } - - Iterator iterator = libraries.iterator(); - while (iterator.hasNext()) - { - FileSet library = iterator.next(); - String[] includedFiles = library.getDirectoryScanner(project).getIncludedFiles(); - File baseDir = library.getDirectoryScanner(project).getBasedir(); - - for (int i = 0; i < includedFiles.length; i++) - { - classPathFiles.add(new File(baseDir, includedFiles[i])); - } - } - - return classPathFiles; - } - - /** - * @return a FileMatchingConfiguration object describing the - * configuration of all libraries added to this particular web app - * (both classes and libraries). - */ - public FileMatchingConfiguration getLibrariesConfiguration() - { - FileMatchingConfiguration config = new FileMatchingConfiguration(); - - Iterator classesIterator = classes.iterator(); - while (classesIterator.hasNext()) - { - FileSet clazz = classesIterator.next(); - config.addDirectoryScanner(clazz.getDirectoryScanner(project)); - } - - Iterator librariesIterator = libraries.iterator(); - while (librariesIterator.hasNext()) - { - FileSet library = librariesIterator.next(); - config.addDirectoryScanner(library.getDirectoryScanner(project)); - } - - return config; - } - - public File getContextXml() - { - return contextXml; - } - - public void setContextXml(File contextXml) - { - this.contextXml = contextXml; - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/AntWebInfConfiguration.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/AntWebInfConfiguration.java deleted file mode 100644 index 8cfe2775e008..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/AntWebInfConfiguration.java +++ /dev/null @@ -1,59 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant; - -import java.io.File; -import java.util.List; - -import org.eclipse.jetty.ee9.webapp.Configuration; -import org.eclipse.jetty.ee9.webapp.WebAppClassLoader; -import org.eclipse.jetty.ee9.webapp.WebAppContext; -import org.eclipse.jetty.ee9.webapp.WebInfConfiguration; -import org.eclipse.jetty.ee9.webapp.WebXmlConfiguration; - -public class AntWebInfConfiguration extends WebInfConfiguration -{ - - @Override - public Class replaces() - { - return WebInfConfiguration.class; - } - - /** - * Adds classpath files into web application classloader, and - * sets web.xml and base directory for the configured web application. - * - * @see WebXmlConfiguration#configure(WebAppContext) - */ - @Override - public void configure(WebAppContext context) throws Exception - { - if (context instanceof AntWebAppContext) - { - List classPathFiles = ((AntWebAppContext)context).getClassPathFiles(); - if (classPathFiles != null) - { - for (File cpFile : classPathFiles) - { - if (cpFile.exists()) - { - ((WebAppClassLoader)context.getClassLoader()).addClassPath(cpFile.getCanonicalPath()); - } - } - } - } - super.configure(context); - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/AntWebXmlConfiguration.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/AntWebXmlConfiguration.java deleted file mode 100644 index cbd4abb422d8..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/AntWebXmlConfiguration.java +++ /dev/null @@ -1,64 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant; - -import java.io.File; -import java.util.List; - -import org.eclipse.jetty.ee9.webapp.Configuration; -import org.eclipse.jetty.ee9.webapp.WebXmlConfiguration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * This configuration object provides additional way to inject application - * properties into the configured web application. The list of classpath files, - * the application base directory and web.xml file could be specified in this - * way. - */ -public class AntWebXmlConfiguration extends WebXmlConfiguration -{ - private static final Logger LOG = LoggerFactory.getLogger(WebXmlConfiguration.class); - - /** - * List of classpath files. - */ - private List classPathFiles; - - /** - * Web application root directory. - */ - private File webAppBaseDir; - - public AntWebXmlConfiguration() - { - super(); - } - - @Override - public Class replaces() - { - return WebXmlConfiguration.class; - } - - public void setClassPathFiles(List classPathFiles) - { - this.classPathFiles = classPathFiles; - } - - public void setWebAppBaseDir(File webAppBaseDir) - { - this.webAppBaseDir = webAppBaseDir; - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/JettyRunTask.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/JettyRunTask.java deleted file mode 100644 index d0b879836e2a..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/JettyRunTask.java +++ /dev/null @@ -1,310 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant; - -import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.Property; -import org.eclipse.jetty.ee9.ant.types.Connector; -import org.eclipse.jetty.ee9.ant.types.Connectors; -import org.eclipse.jetty.ee9.ant.types.ContextHandlers; -import org.eclipse.jetty.ee9.ant.types.LoginServices; -import org.eclipse.jetty.ee9.ant.types.SystemProperties; -import org.eclipse.jetty.ee9.ant.utils.TaskLog; -import org.eclipse.jetty.ee9.security.LoginService; -import org.eclipse.jetty.ee9.webapp.WebAppContext; -import org.eclipse.jetty.server.RequestLog; - -/** - * Ant task for running a Jetty server. - */ -public class JettyRunTask extends Task -{ - private int scanIntervalSeconds; - - /** - * Temporary files directory. - */ - private File tempDirectory; - - /** - * List of web applications to be deployed. - */ - private List webapps = new ArrayList<>(); - - /** - * Location of jetty.xml file. - */ - private File jettyXml; - - /** - * List of server connectors. - */ - private Connectors connectors = null; - - /** - * Server request logger object. - */ - private RequestLog requestLog; - - /** - * List of login services. - */ - private LoginServices loginServices; - - /** - * List of system properties to be set. - */ - private SystemProperties systemProperties; - - /** - * List of other contexts to deploy - */ - private ContextHandlers contextHandlers; - - /** - * Port Jetty will use for the default connector - */ - private int jettyPort = 8080; - - private int stopPort; - - private String stopKey; - - private boolean daemon; - - public JettyRunTask() - { - TaskLog.setTask(this); - } - - /** - * Creates a new WebApp Ant object. - * - * @param webapp the webapp context - */ - public void addWebApp(AntWebAppContext webapp) - { - webapps.add(webapp); - } - - /** - * Adds a new Ant's connector tag object if it have not been created yet. - * - * @param connectors the connectors - */ - public void addConnectors(Connectors connectors) - { - if (this.connectors != null) - throw new BuildException("Only one tag is allowed!"); - this.connectors = connectors; - } - - public void addLoginServices(LoginServices services) - { - if (this.loginServices != null) - throw new BuildException("Only one tag is allowed!"); - this.loginServices = services; - } - - public void addSystemProperties(SystemProperties systemProperties) - { - if (this.systemProperties != null) - throw new BuildException("Only one tag is allowed!"); - this.systemProperties = systemProperties; - } - - public void addContextHandlers(ContextHandlers handlers) - { - if (this.contextHandlers != null) - throw new BuildException("Only one tag is allowed!"); - this.contextHandlers = handlers; - } - - public File getTempDirectory() - { - return tempDirectory; - } - - public void setTempDirectory(File tempDirectory) - { - this.tempDirectory = tempDirectory; - } - - public File getJettyXml() - { - return jettyXml; - } - - public void setJettyXml(File jettyXml) - { - this.jettyXml = jettyXml; - } - - public void setRequestLog(String className) - { - try - { - this.requestLog = (RequestLog)Class.forName(className).getDeclaredConstructor().newInstance(); - } - catch (ClassNotFoundException e) - { - throw new BuildException("Unknown request logger class: " + className); - } - catch (Exception e) - { - throw new BuildException("Request logger instantiation exception: " + e); - } - } - - public String getRequestLog() - { - if (requestLog != null) - { - return requestLog.getClass().getName(); - } - - return ""; - } - - /** - * Sets the port Jetty uses for the default connector. - * - * @param jettyPort The port Jetty will use for the default connector - */ - public void setJettyPort(final int jettyPort) - { - this.jettyPort = jettyPort; - } - - /** - * Executes this Ant task. The build flow is being stopped until Jetty - * server stops. - * - * @throws BuildException if unable to build - */ - @Override - public void execute() throws BuildException - { - - TaskLog.log("Configuring Jetty for project: " + getProject().getName()); - - setSystemProperties(); - - List connectorsList = null; - - if (connectors != null) - connectorsList = connectors.getConnectors(); - else - connectorsList = new Connectors(jettyPort, 30000).getDefaultConnectors(); - - List loginServicesList = (loginServices != null ? loginServices.getLoginServices() : new ArrayList()); - ServerProxyImpl server = new ServerProxyImpl(); - server.setConnectors(connectorsList); - server.setLoginServices(loginServicesList); - server.setRequestLog(requestLog); - server.setJettyXml(jettyXml); - server.setDaemon(daemon); - server.setStopPort(stopPort); - server.setStopKey(stopKey); - server.setContextHandlers(contextHandlers); - server.setTempDirectory(tempDirectory); - server.setScanIntervalSecs(scanIntervalSeconds); - - try - { - for (WebAppContext webapp : webapps) - { - server.addWebApplication((AntWebAppContext)webapp); - } - } - catch (Exception e) - { - throw new BuildException(e); - } - - server.start(); - } - - public int getStopPort() - { - return stopPort; - } - - public void setStopPort(int stopPort) - { - this.stopPort = stopPort; - TaskLog.log("stopPort=" + stopPort); - } - - public String getStopKey() - { - return stopKey; - } - - public void setStopKey(String stopKey) - { - this.stopKey = stopKey; - TaskLog.log("stopKey=" + stopKey); - } - - /** - * @return the daemon - */ - public boolean isDaemon() - { - return daemon; - } - - /** - * @param daemon the daemon to set - */ - public void setDaemon(boolean daemon) - { - this.daemon = daemon; - TaskLog.log("Daemon=" + daemon); - } - - public int getScanIntervalSeconds() - { - return scanIntervalSeconds; - } - - public void setScanIntervalSeconds(int secs) - { - scanIntervalSeconds = secs; - TaskLog.log("scanIntervalSecs=" + secs); - } - - /** - * Sets the system properties. - */ - private void setSystemProperties() - { - if (systemProperties != null) - { - Iterator propertiesIterator = systemProperties.getSystemProperties().iterator(); - while (propertiesIterator.hasNext()) - { - Property property = ((Property)propertiesIterator.next()); - SystemProperties.setIfNotSetAlready(property); - } - } - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/JettyStopTask.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/JettyStopTask.java deleted file mode 100644 index 04056d4ecdb1..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/JettyStopTask.java +++ /dev/null @@ -1,114 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant; - -import java.io.InputStreamReader; -import java.io.LineNumberReader; -import java.io.OutputStream; -import java.net.ConnectException; -import java.net.InetAddress; -import java.net.Socket; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import org.eclipse.jetty.ee9.ant.utils.TaskLog; - -/** - * JettyStopTask - */ -public class JettyStopTask extends Task -{ - - private int stopPort; - - private String stopKey; - - private int stopWait; - - /** - * - */ - public JettyStopTask() - { - TaskLog.setTask(this); - } - - @Override - public void execute() throws BuildException - { - try - { - Socket s = new Socket(InetAddress.getByName("127.0.0.1"), stopPort); - if (stopWait > 0) - s.setSoTimeout(stopWait * 1000); - try - { - OutputStream out = s.getOutputStream(); - out.write((stopKey + "\r\nstop\r\n").getBytes()); - out.flush(); - - if (stopWait > 0) - { - TaskLog.log("Waiting" + (stopWait > 0 ? (" " + stopWait + "sec") : "") + " for jetty to stop"); - LineNumberReader lin = new LineNumberReader(new InputStreamReader(s.getInputStream())); - String response = lin.readLine(); - if ("Stopped".equals(response)) - System.err.println("Stopped"); - } - } - finally - { - s.close(); - } - } - catch (ConnectException e) - { - TaskLog.log("Jetty not running!"); - } - catch (Exception e) - { - TaskLog.log(e.getMessage()); - } - } - - public int getStopPort() - { - return stopPort; - } - - public void setStopPort(int stopPort) - { - this.stopPort = stopPort; - } - - public String getStopKey() - { - return stopKey; - } - - public void setStopKey(String stopKey) - { - this.stopKey = stopKey; - } - - public int getStopWait() - { - return stopWait; - } - - public void setStopWait(int stopWait) - { - this.stopWait = stopWait; - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/ServerProxyImpl.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/ServerProxyImpl.java deleted file mode 100644 index 96a8c063b093..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/ServerProxyImpl.java +++ /dev/null @@ -1,491 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant; - -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.jetty.ee9.ant.types.Connector; -import org.eclipse.jetty.ee9.ant.types.ContextHandlers; -import org.eclipse.jetty.ee9.ant.utils.ServerProxy; -import org.eclipse.jetty.ee9.ant.utils.TaskLog; -import org.eclipse.jetty.ee9.security.LoginService; -import org.eclipse.jetty.server.RequestLog; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.server.ShutdownMonitor; -import org.eclipse.jetty.server.handler.ContextHandler; -import org.eclipse.jetty.server.handler.ContextHandlerCollection; -import org.eclipse.jetty.server.handler.DefaultHandler; -import org.eclipse.jetty.server.handler.HandlerCollection; -import org.eclipse.jetty.util.Scanner; -import org.eclipse.jetty.util.resource.PathResource; -import org.eclipse.jetty.util.resource.Resource; -import org.eclipse.jetty.xml.XmlConfiguration; -import org.xml.sax.SAXException; - -/** - * A proxy class for interaction with Jetty server object. Used to have some - * level of abstraction over standard Jetty classes. - */ -public class ServerProxyImpl implements ServerProxy -{ - - /** - * Proxied Jetty server object. - */ - private Server server; - - /** - * Temporary files directory. - */ - private File tempDirectory; - - /** - * Collection of context handlers (web application contexts). - */ - private ContextHandlerCollection contexts; - - /** - * Location of jetty.xml file. - */ - private File jettyXml; - - /** - * List of connectors. - */ - private List connectors; - - /** - * Request logger. - */ - private RequestLog requestLog; - - /** - * User realms. - */ - private List loginServices; - - /** - * List of added web applications. - */ - private List webApplications = new ArrayList(); - - /** - * other contexts to deploy - */ - private ContextHandlers contextHandlers; - - /** - * scan interval for changed files - */ - private int scanIntervalSecs; - - /** - * port to listen for stop command - */ - private int stopPort; - - /** - * security key for stop command - */ - private String stopKey; - - /** - * wait for all jetty threads to exit or continue - */ - private boolean daemon; - - private boolean configured = false; - - /** - * WebAppScannerListener - * - * Handle notifications that files we are interested in have changed - * during execution. - */ - public static class WebAppScannerListener implements Scanner.BulkListener - { - AntWebAppContext awc; - - public WebAppScannerListener(AntWebAppContext awc) - { - this.awc = awc; - } - - @Override - public void filesChanged(Set changedFileNames) - { - boolean isScanned = false; - try - { - Iterator itor = changedFileNames.iterator(); - while (!isScanned && itor.hasNext()) - { - isScanned = awc.isScanned(Resource.newResource(itor.next()).getFile()); - } - if (isScanned) - { - awc.stop(); - awc.start(); - } - } - catch (Exception e) - { - TaskLog.log(e.getMessage()); - } - } - } - - /** - * Default constructor. Creates a new Jetty server with a standard connector - * listening on a given port. - */ - public ServerProxyImpl() - { - server = new Server(); - server.setStopAtShutdown(true); - } - - @Override - public void addWebApplication(AntWebAppContext webApp) - { - webApplications.add(webApp); - } - - public int getStopPort() - { - return stopPort; - } - - public void setStopPort(int stopPort) - { - this.stopPort = stopPort; - } - - public String getStopKey() - { - return stopKey; - } - - public void setStopKey(String stopKey) - { - this.stopKey = stopKey; - } - - public File getJettyXml() - { - return jettyXml; - } - - public void setJettyXml(File jettyXml) - { - this.jettyXml = jettyXml; - } - - public List getConnectors() - { - return connectors; - } - - public void setConnectors(List connectors) - { - this.connectors = connectors; - } - - public RequestLog getRequestLog() - { - return requestLog; - } - - public void setRequestLog(RequestLog requestLog) - { - this.requestLog = requestLog; - } - - public List getLoginServices() - { - return loginServices; - } - - public void setLoginServices(List loginServices) - { - this.loginServices = loginServices; - } - - public List getWebApplications() - { - return webApplications; - } - - public void setWebApplications(List webApplications) - { - this.webApplications = webApplications; - } - - public File getTempDirectory() - { - return tempDirectory; - } - - public void setTempDirectory(File tempDirectory) - { - this.tempDirectory = tempDirectory; - } - - @Override - public void start() - { - try - { - configure(); - - configureWebApps(); - - server.start(); - - System.setProperty("jetty.ant.server.port", "" + ((ServerConnector)server.getConnectors()[0]).getLocalPort()); - - String host = ((ServerConnector)server.getConnectors()[0]).getHost(); - - if (host == null) - { - System.setProperty("jetty.ant.server.host", "localhost"); - } - else - { - System.setProperty("jetty.ant.server.host", host); - } - - startScanners(); - - TaskLog.log("Jetty AntTask Started"); - - if (!daemon) - server.join(); - } - catch (InterruptedException e) - { - new RuntimeException(e); - } - catch (Exception e) - { - e.printStackTrace(); - new RuntimeException(e); - } - } - - @Override - public Object getProxiedObject() - { - return server; - } - - /** - * @return the daemon - */ - public boolean isDaemon() - { - return daemon; - } - - /** - * @param daemon the daemon to set - */ - public void setDaemon(boolean daemon) - { - this.daemon = daemon; - } - - /** - * @return the contextHandlers - */ - public ContextHandlers getContextHandlers() - { - return contextHandlers; - } - - /** - * @param contextHandlers the contextHandlers to set - */ - public void setContextHandlers(ContextHandlers contextHandlers) - { - this.contextHandlers = contextHandlers; - } - - public int getScanIntervalSecs() - { - return scanIntervalSecs; - } - - public void setScanIntervalSecs(int scanIntervalSecs) - { - this.scanIntervalSecs = scanIntervalSecs; - } - - /** - * Configures Jetty server before adding any web applications to it. - */ - private void configure() - { - if (configured) - return; - - configured = true; - - if (stopPort > 0 && stopKey != null) - { - ShutdownMonitor monitor = ShutdownMonitor.getInstance(); - monitor.setPort(stopPort); - monitor.setKey(stopKey); - monitor.setExitVm(false); - } - - if (tempDirectory != null && !tempDirectory.exists()) - tempDirectory.mkdirs(); - - // Applies external configuration via jetty.xml - applyJettyXml(); - - // Configures connectors for this server instance. - if (connectors != null) - { - for (Connector c : connectors) - { - ServerConnector jc = new ServerConnector(server); - - jc.setPort(c.getPort()); - jc.setIdleTimeout(c.getMaxIdleTime()); - - server.addConnector(jc); - } - } - - // Configures login services - if (loginServices != null) - { - for (LoginService ls : loginServices) - { - server.addBean(ls); - } - } - - // Does not cache resources, to prevent Windows from locking files - Resource.setDefaultUseCaches(false); - - // Set default server handlers - configureHandlers(); - } - - /** - * - */ - private void configureHandlers() - { - if (requestLog != null) - server.setRequestLog(requestLog); - - contexts = server.getChildHandlerByClass(ContextHandlerCollection.class); - if (contexts == null) - { - contexts = new ContextHandlerCollection(); - HandlerCollection handlers = server.getChildHandlerByClass(HandlerCollection.class); - if (handlers == null) - server.setHandler(contexts); - else - handlers.addHandler(contexts); - } - - //if there are any extra contexts to deploy - if (contextHandlers != null && contextHandlers.getContextHandlers() != null) - { - for (ContextHandler c : contextHandlers.getContextHandlers()) - { - contexts.addHandler(c); - } - } - } - - /** - * Applies jetty.xml configuration to the Jetty server instance. - */ - private void applyJettyXml() - { - if (jettyXml != null && jettyXml.exists()) - { - TaskLog.log("Configuring jetty from xml configuration file = " + jettyXml.getAbsolutePath()); - XmlConfiguration configuration; - try - { - configuration = new XmlConfiguration(new PathResource(jettyXml)); - configuration.configure(server); - } - catch (MalformedURLException e) - { - throw new RuntimeException(e); - } - catch (SAXException e) - { - throw new RuntimeException(e); - } - catch (IOException e) - { - throw new RuntimeException(e); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - } - - /** - * Starts web applications' scanners. - */ - private void startScanners() throws Exception - { - for (AntWebAppContext awc : webApplications) - { - if (scanIntervalSecs <= 0) - return; - - TaskLog.log("Web application '" + awc + "': starting scanner at interval of " + scanIntervalSecs + " seconds."); - Scanner.Listener changeListener = new WebAppScannerListener(awc); - Scanner scanner = new Scanner(); - scanner.setScanInterval(scanIntervalSecs); - scanner.addListener(changeListener); - scanner.setScanDirs(awc.getScanFiles()); - scanner.setReportExistingFilesOnStartup(false); - scanner.start(); - } - } - - /** - * - */ - private void configureWebApps() - { - for (AntWebAppContext awc : webApplications) - { - awc.setAttribute(AntWebAppContext.BASETEMPDIR, tempDirectory); - if (contexts != null) - contexts.addHandler(awc); - } - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/package-info.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/package-info.java deleted file mode 100644 index 198e3cbb27cb..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -/** - * Jetty Ant : Ant Tasks and Configuration - */ -package org.eclipse.jetty.ee9.ant; - diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/Attribute.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/Attribute.java deleted file mode 100644 index 57fa02dd23bc..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/Attribute.java +++ /dev/null @@ -1,42 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant.types; - -public class Attribute -{ - - String name; - - String value; - - public void setName(String name) - { - this.name = name; - } - - public void setValue(String value) - { - this.value = value; - } - - public String getName() - { - return name; - } - - public String getValue() - { - return value; - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/Attributes.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/Attributes.java deleted file mode 100644 index f21e44168092..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/Attributes.java +++ /dev/null @@ -1,33 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant.types; - -import java.util.ArrayList; -import java.util.List; - -public class Attributes -{ - - List _attributes = new ArrayList(); - - public void addAttribute(Attribute attr) - { - _attributes.add(attr); - } - - public List getAttributes() - { - return _attributes; - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/Connector.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/Connector.java deleted file mode 100644 index ce5064420a92..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/Connector.java +++ /dev/null @@ -1,54 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant.types; - -/** - * Connector - */ -public class Connector -{ - private int port; - private int maxIdleTime; - - public Connector() - { - - } - - public Connector(int port, int maxIdleTime) - { - this.port = port; - this.maxIdleTime = maxIdleTime; - } - - public int getPort() - { - return port; - } - - public void setPort(int port) - { - this.port = port; - } - - public int getMaxIdleTime() - { - return maxIdleTime; - } - - public void setMaxIdleTime(int maxIdleTime) - { - this.maxIdleTime = maxIdleTime; - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/Connectors.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/Connectors.java deleted file mode 100644 index adc8a737ad99..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/Connectors.java +++ /dev/null @@ -1,76 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant.types; - -import java.util.ArrayList; -import java.util.List; - -/** - * Specifies a jetty configuration <connectors/> element for Ant build file. - */ -public class Connectors -{ - private List connectors = new ArrayList(); - private List defaultConnectors = new ArrayList(); - - /** - * Default constructor. - */ - public Connectors() - { - this(8080, 30000); - } - - /** - * Constructor. - * - * @param port The port that the default connector will listen on - * @param maxIdleTime The maximum idle time for the default connector - */ - public Connectors(int port, int maxIdleTime) - { - defaultConnectors.add(new Connector(port, maxIdleTime)); - } - - /** - * Adds a connector to the list of connectors to deploy. - * - * @param connector A connector to add to the list - */ - public void add(Connector connector) - { - connectors.add(connector); - } - - /** - * Returns the list of known connectors to deploy. - * - * @return The list of known connectors - */ - public List getConnectors() - { - return connectors; - } - - /** - * Gets the default list of connectors to deploy when no connectors - * were explicitly added to the list. - * - * @return The list of default connectors - */ - public List getDefaultConnectors() - { - return defaultConnectors; - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/ContextHandlers.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/ContextHandlers.java deleted file mode 100644 index 10308fe173fe..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/ContextHandlers.java +++ /dev/null @@ -1,37 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant.types; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jetty.server.handler.ContextHandler; - -/** - * Specifies <contextHandlers/> element in web app configuration. - */ -public class ContextHandlers -{ - private List contextHandlers = new ArrayList(); - - public void add(ContextHandler handler) - { - contextHandlers.add(handler); - } - - public List getContextHandlers() - { - return contextHandlers; - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/FileMatchingConfiguration.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/FileMatchingConfiguration.java deleted file mode 100644 index 4627c4b197b3..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/FileMatchingConfiguration.java +++ /dev/null @@ -1,91 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant.types; - -import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.tools.ant.DirectoryScanner; - -/** - * Describes set of files matched by <fileset/> elements in ant configuration - * file. It is used to group application classes, libraries, and scannedTargets - * elements. - */ -public class FileMatchingConfiguration -{ - - private List directoryScanners; - - public FileMatchingConfiguration() - { - this.directoryScanners = new ArrayList<>(); - } - - /** - * @param directoryScanner new directory scanner retrieved from the - * <fileset/> element. - */ - public void addDirectoryScanner(DirectoryScanner directoryScanner) - { - this.directoryScanners.add(directoryScanner); - } - - /** - * @return a list of base directories denoted by a list of directory - * scanners. - */ - public List getBaseDirectories() - { - List baseDirs = new ArrayList<>(); - Iterator scanners = directoryScanners.iterator(); - while (scanners.hasNext()) - { - DirectoryScanner scanner = (DirectoryScanner)scanners.next(); - baseDirs.add(scanner.getBasedir()); - } - - return baseDirs; - } - - /** - * Checks if passed file is scanned by any of the directory scanners. - * - * @param pathToFile a fully qualified path to tested file. - * @return true if so, false otherwise. - */ - public boolean isIncluded(String pathToFile) - { - Iterator scanners = directoryScanners.iterator(); - while (scanners.hasNext()) - { - DirectoryScanner scanner = (DirectoryScanner)scanners.next(); - scanner.scan(); - String[] includedFiles = scanner.getIncludedFiles(); - - for (int i = 0; i < includedFiles.length; i++) - { - File includedFile = new File(scanner.getBasedir(), includedFiles[i]); - if (pathToFile.equalsIgnoreCase(includedFile.getAbsolutePath())) - { - return true; - } - } - } - - return false; - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/LoginServices.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/LoginServices.java deleted file mode 100644 index e12ab3ce8878..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/LoginServices.java +++ /dev/null @@ -1,37 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant.types; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jetty.ee9.security.LoginService; - -/** - * Specifies a jetty configuration <loginServices/> element for Ant build file. - */ -public class LoginServices -{ - private List loginServices = new ArrayList(); - - public void add(LoginService service) - { - loginServices.add(service); - } - - public List getLoginServices() - { - return loginServices; - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/SystemProperties.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/SystemProperties.java deleted file mode 100644 index 3831f75939f1..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/SystemProperties.java +++ /dev/null @@ -1,59 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant.types; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tools.ant.taskdefs.Property; -import org.eclipse.jetty.ee9.ant.utils.TaskLog; - -/** - * SystemProperties - *

- * Ant <systemProperties/> tag definition. - */ -public class SystemProperties -{ - - private List systemProperties = new ArrayList(); - - public List getSystemProperties() - { - return systemProperties; - } - - public void addSystemProperty(Property property) - { - systemProperties.add(property); - } - - /** - * Set a System.property with this value if it is not already set. - * - * @param property the property to test - * @return true if property has been set - */ - public static boolean setIfNotSetAlready(Property property) - { - if (System.getProperty(property.getName()) == null) - { - System.setProperty(property.getName(), (property.getValue() == null ? "" : property.getValue())); - TaskLog.log("Setting property '" + property.getName() + "' to value '" + property.getValue() + "'"); - return true; - } - - return false; - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/package-info.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/package-info.java deleted file mode 100644 index 5a0bdcaacc96..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/types/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -/** - * Jetty Ant : Ant Wrappers of Jetty Internals - */ -package org.eclipse.jetty.ee9.ant.types; - diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/utils/ServerProxy.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/utils/ServerProxy.java deleted file mode 100644 index 0a9836fe569c..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/utils/ServerProxy.java +++ /dev/null @@ -1,34 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant.utils; - -import org.eclipse.jetty.ee9.ant.AntWebAppContext; - -public interface ServerProxy -{ - - /** - * Adds a new web application to this server. - * - * @param awc a AntWebAppContext object. - */ - public void addWebApplication(AntWebAppContext awc); - - /** - * Starts this server. - */ - public void start(); - - public Object getProxiedObject(); -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/utils/TaskLog.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/utils/TaskLog.java deleted file mode 100644 index e1d676fa2ddf..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/utils/TaskLog.java +++ /dev/null @@ -1,52 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Sabre Holdings and others. -// ------------------------------------------------------------------------ -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant.utils; - -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.apache.tools.ant.Task; - -/** - * Provides logging functionality for classes without access to the Ant project - * variable. - */ -public class TaskLog -{ - - private static Task task; - - private static final SimpleDateFormat format = new SimpleDateFormat( - "yyyy-MM-dd HH:mm:ss.SSS"); - - public static void setTask(Task task) - { - TaskLog.task = task; - } - - public static void log(String message) - { - task.log(message); - } - - public static void logWithTimestamp(String message) - { - String date; - synchronized (format) - { - date = format.format(new Date()); - } - task.log(date + ": " + message); - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/utils/package-info.java b/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/utils/package-info.java deleted file mode 100644 index ba6605a55336..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/java/org/eclipse/jetty/ee9/ant/utils/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -/** - * Jetty Ant : Utility Classes - */ -package org.eclipse.jetty.ee9.ant.utils; - diff --git a/jetty-ee9/jetty-ee9-ant/src/main/resources/META-INF/services/org.eclipse.jetty.ee9.webapp.Configuration b/jetty-ee9/jetty-ee9-ant/src/main/resources/META-INF/services/org.eclipse.jetty.ee9.webapp.Configuration deleted file mode 100644 index 3c3409373e18..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/resources/META-INF/services/org.eclipse.jetty.ee9.webapp.Configuration +++ /dev/null @@ -1,2 +0,0 @@ -org.eclipse.jetty.ee9.ant.AntWebInfConfiguration -org.eclipse.jetty.ee9.ant.AntWebXmlConfiguration diff --git a/jetty-ee9/jetty-ee9-ant/src/main/resources/tasks.properties b/jetty-ee9/jetty-ee9-ant/src/main/resources/tasks.properties deleted file mode 100644 index 455c149424e8..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/main/resources/tasks.properties +++ /dev/null @@ -1,2 +0,0 @@ -jetty.run=org.eclipse.jetty.ee9.ant.JettyRunTask -jetty.stop=org.eclipse.jetty.ee9.ant.JettyStopTask \ No newline at end of file diff --git a/jetty-ee9/jetty-ee9-ant/src/test/config/build.xml b/jetty-ee9/jetty-ee9-ant/src/test/config/build.xml deleted file mode 100644 index fd80592ab9ab..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/config/build.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/java/org/eclipse/jetty/ee9/ant/AntBuild.java b/jetty-ee9/jetty-ee9-ant/src/test/java/org/eclipse/jetty/ee9/ant/AntBuild.java deleted file mode 100644 index c4f98adf6e01..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/java/org/eclipse/jetty/ee9/ant/AntBuild.java +++ /dev/null @@ -1,289 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; -import java.io.PrintStream; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.tools.ant.DefaultLogger; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.ProjectHelper; -import org.eclipse.jetty.toolchain.test.IO; -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; - -public class AntBuild -{ - private Thread _process; - private String _ant; - - private int _port; - private String _host; - - public AntBuild(String ant) - { - _ant = ant; - } - - private class AntBuildProcess implements Runnable - { - List connList; - - @Override - public void run() - { - File buildFile = new File(_ant); - - Project antProject = new Project(); - try - { - antProject.setBaseDir(MavenTestingUtils.getBaseDir()); - antProject.setUserProperty("ant.file", buildFile.getAbsolutePath()); - DefaultLogger logger = new DefaultLogger(); - - ConsoleParser parser = new ConsoleParser(); - //connList = parser.newPattern(".*([0-9]+\\.[0-9]*\\.[0-9]*\\.[0-9]*):([0-9]*)",1); - connList = parser.newPattern("Jetty AntTask Started", 1); - - PipedOutputStream pos = new PipedOutputStream(); - PipedInputStream pis = new PipedInputStream(pos); - - PipedOutputStream pose = new PipedOutputStream(); - PipedInputStream pise = new PipedInputStream(pose); - - startPump("STDOUT", parser, pis); - startPump("STDERR", parser, pise); - - logger.setErrorPrintStream(new PrintStream(pos)); - logger.setOutputPrintStream(new PrintStream(pose)); - logger.setMessageOutputLevel(Project.MSG_VERBOSE); - antProject.addBuildListener(logger); - - antProject.fireBuildStarted(); - antProject.init(); - - ProjectHelper helper = ProjectHelper.getProjectHelper(); - - antProject.addReference("ant.projectHelper", helper); - - helper.parse(antProject, buildFile); - - antProject.executeTarget("jetty.run"); - - parser.waitForDone(10000, TimeUnit.MILLISECONDS); - } - catch (Exception e) - { - antProject.fireBuildFinished(e); - } - } - - public void waitForStarted() throws Exception - { - while (connList == null || connList.isEmpty()) - { - Thread.sleep(10); - } - } - } - - public void start() throws Exception - { - System.out.println("Starting Ant Build ..."); - AntBuildProcess abp = new AntBuildProcess(); - _process = new Thread(abp); - - _process.start(); - - abp.waitForStarted(); - - // once this has returned we should have the connection info we need - //_host = abp.getConnectionList().get(0)[0]; - //_port = Integer.parseInt(abp.getConnectionList().get(0)[1]); - - } - - public int getJettyPort() - { - return Integer.parseInt(System.getProperty("jetty.ant.server.port")); - } - - public String getJettyHost() - { - return System.getProperty("jetty.ant.server.host"); - } - - /** - * Stop the jetty server - */ - public void stop() - { - System.out.println("Stopping Ant Build ..."); - _process.interrupt(); - } - - private static class ConsoleParser - { - private List patterns = new ArrayList(); - private CountDownLatch latch; - private int count; - - public List newPattern(String exp, int cnt) - { - ConsolePattern pat = new ConsolePattern(exp, cnt); - patterns.add(pat); - count += cnt; - - return pat.getMatches(); - } - - public void parse(String line) - { - for (ConsolePattern pat : patterns) - { - Matcher mat = pat.getMatcher(line); - if (mat.find()) - { - int num = 0; - int count = mat.groupCount(); - String[] match = new String[count]; - while (num++ < count) - { - match[num - 1] = mat.group(num); - } - pat.getMatches().add(match); - - if (pat.getCount() > 0) - { - getLatch().countDown(); - } - } - } - } - - public void waitForDone(long timeout, TimeUnit unit) throws InterruptedException - { - getLatch().await(timeout, unit); - } - - private CountDownLatch getLatch() - { - synchronized (this) - { - if (latch == null) - { - latch = new CountDownLatch(count); - } - } - - return latch; - } - } - - private static class ConsolePattern - { - private Pattern pattern; - private List matches; - private int count; - - ConsolePattern(String exp, int cnt) - { - pattern = Pattern.compile(exp); - matches = new ArrayList(); - count = cnt; - } - - public Matcher getMatcher(String line) - { - return pattern.matcher(line); - } - - public List getMatches() - { - return matches; - } - - public int getCount() - { - return count; - } - } - - private void startPump(String mode, ConsoleParser parser, InputStream inputStream) - { - ConsoleStreamer pump = new ConsoleStreamer(mode, inputStream); - pump.setParser(parser); - Thread thread = new Thread(pump, "ConsoleStreamer/" + mode); - thread.start(); - } - - /** - * Simple streamer for the console output from a Process - */ - private static class ConsoleStreamer implements Runnable - { - private String mode; - private BufferedReader reader; - private ConsoleParser parser; - - public ConsoleStreamer(String mode, InputStream is) - { - this.mode = mode; - this.reader = new BufferedReader(new InputStreamReader(is)); - } - - public void setParser(ConsoleParser connector) - { - this.parser = connector; - } - - @Override - public void run() - { - String line; - //System.out.printf("ConsoleStreamer/%s initiated%n",mode); - try - { - while ((line = reader.readLine()) != (null)) - { - if (parser != null) - { - parser.parse(line); - } - System.out.println("[" + mode + "] " + line); - } - } - catch (IOException ignore) - { - /* ignore */ - } - finally - { - IO.close(reader); - } - //System.out.printf("ConsoleStreamer/%s finished%n",mode); - } - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/test/java/org/eclipse/jetty/ee9/ant/JettyAntTaskTest.java b/jetty-ee9/jetty-ee9-ant/src/test/java/org/eclipse/jetty/ee9/ant/JettyAntTaskTest.java deleted file mode 100644 index c6737021dafe..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/java/org/eclipse/jetty/ee9/ant/JettyAntTaskTest.java +++ /dev/null @@ -1,64 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License v. 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -package org.eclipse.jetty.ee9.ant; - -import java.net.HttpURLConnection; -import java.net.URI; - -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.junit.jupiter.api.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; - -public class JettyAntTaskTest -{ - - @Test - public void testConnectorTask() throws Exception - { - AntBuild build = new AntBuild(MavenTestingUtils.getTestResourceFile("connector-test.xml").getAbsolutePath()); - - build.start(); - - URI uri = new URI("http://" + build.getJettyHost() + ":" + build.getJettyPort()); - - HttpURLConnection connection = (HttpURLConnection)uri.toURL().openConnection(); - - connection.connect(); - - assertThat("response code is 404", connection.getResponseCode(), is(404)); - - build.stop(); - } - - @Test - public void testWebApp() throws Exception - { - AntBuild build = new AntBuild(MavenTestingUtils.getTestResourceFile("webapp-test.xml").getAbsolutePath()); - - build.start(); - - URI uri = new URI("http://" + build.getJettyHost() + ":" + build.getJettyPort() + "/"); - - HttpURLConnection connection = (HttpURLConnection)uri.toURL().openConnection(); - - connection.connect(); - - assertThat("response code is 200", connection.getResponseCode(), is(200)); - - System.err.println("Stop build!"); - build.stop(); - } -} diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/connector-test.xml b/jetty-ee9/jetty-ee9-ant/src/test/resources/connector-test.xml deleted file mode 100644 index 149819c48033..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/connector-test.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/WEB-INF/acme-taglib.tld b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/WEB-INF/acme-taglib.tld deleted file mode 100644 index 09b70aece57c..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/WEB-INF/acme-taglib.tld +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - 1.0 - 1.2 - acme - http://www.acme.com/taglib - taglib example - - com.acme.TagListener - - - - date - com.acme.DateTag - TAGDEPENDENT - Display Date - - tz - false - - - - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/WEB-INF/acme-taglib2.tld b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/WEB-INF/acme-taglib2.tld deleted file mode 100644 index 3edb7bb14f35..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/WEB-INF/acme-taglib2.tld +++ /dev/null @@ -1,35 +0,0 @@ - - - - Acme JSP2 tags - 1.0 - acme2 - http://www.acme.com/taglib2 - - Simple Date formatting - date2 - com.acme.Date2Tag - scriptless - - Day of the Month - day - - - Month of the Year - month - - - Year - year - - - format - true - true - - - - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/WEB-INF/tags/panel.tag b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/WEB-INF/tags/panel.tag deleted file mode 100644 index fa0540a61dbd..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/WEB-INF/tags/panel.tag +++ /dev/null @@ -1,17 +0,0 @@ -<%-- - - Copyright (c) 2002 The Apache Software Foundation. All rights - - reserved. ---%> -<%@ attribute name="color" %> -<%@ attribute name="bgcolor" %> -<%@ attribute name="title" %> - - - - - - - -
${title}
- -
diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/WEB-INF/web.xml b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/WEB-INF/web.xml deleted file mode 100644 index b3b1176cac8b..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/WEB-INF/web.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Test WebApp - - - org.eclipse.jetty.server.context.ManagedAttributes - QoSFilter,TransparentProxy.ThreadPool,TransparentProxy.HttpClient - - - - - foo.jsp - /jsp/foo/foo.jsp - - - foo.jsp - /jsp/foo/ - - - - - - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/index.html b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/index.html deleted file mode 100644 index bab0d7c3a912..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/index.html +++ /dev/null @@ -1,5 +0,0 @@ - - -

INDEX!

- - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/bean1.jsp b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/bean1.jsp deleted file mode 100644 index 0c15da2ca4e3..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/bean1.jsp +++ /dev/null @@ -1,15 +0,0 @@ - -<%@ page session="true"%> - - - -

JSP1.2 Beans: 1

- -Counter accessed times.
-Counter last accessed by
- - -Goto bean2.jsp - - - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/bean2.jsp b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/bean2.jsp deleted file mode 100644 index 624dc2e59d4b..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/bean2.jsp +++ /dev/null @@ -1,15 +0,0 @@ - -<%@ page session="true"%> - - - -

JSP1.2 Beans: 2

- -Counter accessed times.
-Counter last accessed by
- - -Goto bean1.jsp - - - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/dump.jsp b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/dump.jsp deleted file mode 100644 index fb73b0b00026..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/dump.jsp +++ /dev/null @@ -1,23 +0,0 @@ - -<%@ page import="java.util.Enumeration" %> - -

JSP Dump

- - - - - - -<% - Enumeration e =request.getParameterNames(); - while(e.hasMoreElements()) - { - String name = (String)e.nextElement(); -%> - - - -<% } %> - -
Request URI:<%= request.getRequestURI() %>
ServletPath:<%= request.getServletPath() %>
PathInfo:<%= request.getPathInfo() %>
getParameter("<%= name %>")<%= request.getParameter(name) %>
- diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/expr.jsp b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/expr.jsp deleted file mode 100644 index e0b25e202031..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/expr.jsp +++ /dev/null @@ -1,23 +0,0 @@ - -

JSP2.0 Expressions

- - - - - - - - - - - - - - - - - - - -
ExpressionResult
\${param["A"]}${param["A"]} 
\${header["host"]}${header["host"]}
\${header["user-agent"]}${header["user-agent"]}
\${1+1}${1+1}
\${param["A"] * 2}${param["A"] * 2} 
- diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/foo/foo.jsp b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/foo/foo.jsp deleted file mode 100644 index 7ec8955932d2..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/foo/foo.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - - - -

FOO Example

-
-

A trivial FOO example -


- - -
-
- - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/index.html b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/index.html deleted file mode 100644 index 644ebc7ff409..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - -

JSP Examples

- - -Main Menu - - - - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/jstl.jsp b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/jstl.jsp deleted file mode 100644 index 9fa7b57e96c6..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/jstl.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - - - -

JSTL Example

-
-

A trivial jstl example -


- - -
-
- - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/tag.jsp b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/tag.jsp deleted file mode 100644 index 069d8c67b172..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/tag.jsp +++ /dev/null @@ -1,16 +0,0 @@ - - - -<%@ taglib uri="http://www.acme.com/taglib" prefix="acme" %> - -<acme:date tz="GMT">EEE, dd/MMM/yyyy HH:mm:ss ZZZ</acme:date> -==> -EEE, dd/MMM/yyyy HH:mm:ss ZZZ -
-<acme:date tz="EST">EEE, dd-MMM-yyyy HH:mm:ss ZZZ</acme:date> -==> -EEE, dd-MMM-yyyy HH:mm:ss ZZZ -
- - - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/tag2.jsp b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/tag2.jsp deleted file mode 100644 index 8071927562a4..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/tag2.jsp +++ /dev/null @@ -1,19 +0,0 @@ - - - -<%@ taglib uri="http://www.acme.com/taglib2" prefix="acme" %> - - - On ${day} of ${month} in the year ${year} - - -
- - - ${day} - ${month} - ${year} - - -
- - - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/tagfile.jsp b/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/tagfile.jsp deleted file mode 100644 index 67299f0229c7..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/foo/jsp/tagfile.jsp +++ /dev/null @@ -1,37 +0,0 @@ -<%@ taglib prefix="acme" tagdir="/WEB-INF/tags" %> - - - - -

JSP 2.0 Tag File Example

-
-

Panel tag created from JSP fragment file in WEB-INF/tags -


- - - - - - -
- - First panel.
-
-
- - Second panel.
- Second panel.
- Second panel.
- Second panel.
-
-
- - Third panel.
- - A panel in a panel. - - Third panel.
-
-
- - diff --git a/jetty-ee9/jetty-ee9-ant/src/test/resources/webapp-test.xml b/jetty-ee9/jetty-ee9-ant/src/test/resources/webapp-test.xml deleted file mode 100644 index 29bec3bd286a..000000000000 --- a/jetty-ee9/jetty-ee9-ant/src/test/resources/webapp-test.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/jetty-ee9/pom.xml b/jetty-ee9/pom.xml index d796c99549cb..ef60d61c460a 100644 --- a/jetty-ee9/pom.xml +++ b/jetty-ee9/pom.xml @@ -54,7 +54,6 @@ jetty-ee9-apache-jsp jetty-ee9-glassfish-jstl jetty-ee9-annotations - jetty-ee9-cdi jetty-ee9-jaas jetty-ee9-jaspi