Merged branch 'jetty-10.0.x-2983-JmxConfiguration2' into 'jetty-10.0.x'.
This commit is contained in:
commit
23ff7b8fcd
|
@ -1 +0,0 @@
|
|||
org.eclipse.jetty.webapp.JspConfiguration
|
|
@ -1 +0,0 @@
|
|||
org.eclipse.jetty.webapp.JaasConfiguration
|
|
@ -31,13 +31,6 @@
|
|||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>findbugs-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<onlyAnalyze>org.eclipse.jetty.jndi.*</onlyAnalyze>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
org.eclipse.jetty.webapp.JndiConfiguration
|
|
@ -1 +0,0 @@
|
|||
org.eclipse.jetty.webapp.ServletsConfiguration
|
|
@ -56,37 +56,45 @@ import org.eclipse.jetty.util.annotation.Name;
|
|||
*/
|
||||
public interface Configuration
|
||||
{
|
||||
public final static String ATTR="org.eclipse.jetty.webapp.configuration";
|
||||
|
||||
String ATTR="org.eclipse.jetty.webapp.configuration";
|
||||
|
||||
/**
|
||||
* @return True if the feature this configuration represents is available and has all its dependencies.
|
||||
*/
|
||||
default boolean isAvailable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Get a class that this class replaces/extends.
|
||||
* If this is added to {@link Configurations} collection that already contains a
|
||||
* configuration of the replaced class or that reports to replace the same class, then
|
||||
* it is replaced with this instance.
|
||||
* @return The class this Configuration replaces/extends or null if it replaces no other configuration
|
||||
*/
|
||||
public default Class<? extends Configuration> replaces() { return null; }
|
||||
default Class<? extends Configuration> replaces() { return null; }
|
||||
|
||||
/** Get known Configuration Dependencies.
|
||||
* @return The names of Configurations that {@link TopologicalSort} must order
|
||||
* before this configuration.
|
||||
*/
|
||||
public default Collection<String> getDependencies() { return Collections.emptyList(); }
|
||||
default Collection<String> getDependencies() { return Collections.emptyList(); }
|
||||
|
||||
/** Get known Configuration Dependents.
|
||||
* @return The names of Configurations that {@link TopologicalSort} must order
|
||||
* after this configuration.
|
||||
*/
|
||||
public default Collection<String> getDependents(){ return Collections.emptyList(); }
|
||||
default Collection<String> getDependents(){ return Collections.emptyList(); }
|
||||
|
||||
/** Get the system classes associated with this Configuration.
|
||||
* @return ClasspathPattern of system classes.
|
||||
*/
|
||||
public default ClasspathPattern getSystemClasses() { return new ClasspathPattern(); }
|
||||
default ClasspathPattern getSystemClasses() { return new ClasspathPattern(); }
|
||||
|
||||
/** Get the system classes associated with this Configuration.
|
||||
* @return ClasspathPattern of server classes.
|
||||
*/
|
||||
public default ClasspathPattern getServerClasses() { return new ClasspathPattern(); }
|
||||
default ClasspathPattern getServerClasses() { return new ClasspathPattern(); }
|
||||
|
||||
/** Set up for configuration.
|
||||
* <p>
|
||||
|
@ -97,7 +105,7 @@ public interface Configuration
|
|||
* @param context The context to configure
|
||||
* @throws Exception if unable to pre configure
|
||||
*/
|
||||
public void preConfigure (WebAppContext context) throws Exception;
|
||||
void preConfigure (WebAppContext context) throws Exception;
|
||||
|
||||
/** Configure WebApp.
|
||||
* <p>
|
||||
|
@ -106,13 +114,13 @@ public interface Configuration
|
|||
* @param context The context to configure
|
||||
* @throws Exception if unable to configure
|
||||
*/
|
||||
public void configure (WebAppContext context) throws Exception;
|
||||
void configure (WebAppContext context) throws Exception;
|
||||
|
||||
/** Clear down after configuration.
|
||||
* @param context The context to configure
|
||||
* @throws Exception if unable to post configure
|
||||
*/
|
||||
public void postConfigure (WebAppContext context) throws Exception;
|
||||
void postConfigure (WebAppContext context) throws Exception;
|
||||
|
||||
/** DeConfigure WebApp.
|
||||
* This method is called to undo all configuration done. This is
|
||||
|
@ -120,7 +128,7 @@ public interface Configuration
|
|||
* @param context The context to configure
|
||||
* @throws Exception if unable to deconfigure
|
||||
*/
|
||||
public void deconfigure (WebAppContext context) throws Exception;
|
||||
void deconfigure (WebAppContext context) throws Exception;
|
||||
|
||||
/** Destroy WebApp.
|
||||
* This method is called to destroy a webappcontext. It is typically called when a context
|
||||
|
@ -128,23 +136,23 @@ public interface Configuration
|
|||
* @param context The context to configure
|
||||
* @throws Exception if unable to destroy
|
||||
*/
|
||||
public void destroy (WebAppContext context) throws Exception;
|
||||
void destroy (WebAppContext context) throws Exception;
|
||||
|
||||
/**
|
||||
* @return true if configuration is disabled by default
|
||||
*/
|
||||
public boolean isDisabledByDefault();
|
||||
boolean isDisabledByDefault();
|
||||
|
||||
/**
|
||||
* @return true if configuration should be aborted
|
||||
*/
|
||||
public boolean abort(WebAppContext context);
|
||||
boolean abort(WebAppContext context);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Configurations}
|
||||
*/
|
||||
@Deprecated
|
||||
public class ClassList extends Configurations
|
||||
class ClassList extends Configurations
|
||||
{
|
||||
@Deprecated
|
||||
public void addAfter(@Name("afterClass") String afterClass,@Name("configClass")String... configClass)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
package org.eclipse.jetty.webapp;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.AbstractList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -78,14 +79,18 @@ public class Configurations extends AbstractList<Configuration>
|
|||
try
|
||||
{
|
||||
Configuration configuration = i.next();
|
||||
if (!configuration.isAvailable())
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Configuration unavailable: "+configuration);
|
||||
continue;
|
||||
}
|
||||
__known.add(configuration);
|
||||
__knownByClassName.add(configuration.getClass().getName());
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
LOG.info("Configuration unavailable: "+e.getMessage());
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug(e);
|
||||
LOG.warn(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +118,14 @@ public class Configurations extends AbstractList<Configuration>
|
|||
{
|
||||
try
|
||||
{
|
||||
Class<?> clazz = Loader.loadClass(c);
|
||||
Class<? extends Configuration> clazz = Loader.loadClass(c);
|
||||
Configuration configuration = clazz.getConstructor().newInstance();
|
||||
if (!configuration.isAvailable())
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.warn("Configuration unavailable: "+configuration);
|
||||
continue;
|
||||
}
|
||||
__known.add((Configuration)clazz.newInstance());
|
||||
__knownByClassName.add(c);
|
||||
}
|
||||
|
@ -232,9 +244,9 @@ public class Configurations extends AbstractList<Configuration>
|
|||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<Configuration> clazz = Loader.loadClass(classname);
|
||||
return clazz.newInstance();
|
||||
return clazz.getConstructor().newInstance();
|
||||
}
|
||||
catch (ClassNotFoundException | InstantiationException | IllegalAccessException e)
|
||||
catch (Throwable e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@ package org.eclipse.jetty.webapp;
|
|||
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import org.eclipse.jetty.util.Loader;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
/**
|
||||
* <p>JAAS Configuration</p>
|
||||
* <p>This configuration configures the WebAppContext server/system classes to
|
||||
|
@ -32,10 +36,26 @@ import java.util.ServiceLoader;
|
|||
*/
|
||||
public class JaasConfiguration extends AbstractConfiguration
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(JaasConfiguration.class);
|
||||
|
||||
public JaasConfiguration()
|
||||
{
|
||||
addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class);
|
||||
addDependents(WebAppConfiguration.class);
|
||||
protectAndExpose("org.eclipse.jetty.jaas.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Loader.loadClass("org.eclipse.jetty.jaas.JAASLoginService")!=null;
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
LOG.ignore(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,10 +18,12 @@
|
|||
|
||||
package org.eclipse.jetty.webapp;
|
||||
|
||||
import org.eclipse.jetty.jmx.ObjectMBean;
|
||||
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import org.eclipse.jetty.util.Loader;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
/**
|
||||
* <p>JMX Configuration</p>
|
||||
* <p>This configuration configures the WebAppContext server/system classes to
|
||||
|
@ -35,9 +37,25 @@ import java.util.ServiceLoader;
|
|||
*/
|
||||
public class JmxConfiguration extends AbstractConfiguration
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(JmxConfiguration.class);
|
||||
|
||||
public JmxConfiguration()
|
||||
{
|
||||
addDependents(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class);
|
||||
protectAndExpose(ObjectMBean.class.getPackage().getName()+".");
|
||||
protectAndExpose("org.eclipse.jetty.jmx.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Loader.loadClass("org.eclipse.jetty.jmx.ObjectMBean")!=null;
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
LOG.ignore(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@ package org.eclipse.jetty.webapp;
|
|||
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import org.eclipse.jetty.util.Loader;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
/**
|
||||
* <p>JNDI Configuration</p>
|
||||
* <p>This configuration configures the WebAppContext system/server classes to
|
||||
|
@ -32,10 +36,26 @@ import java.util.ServiceLoader;
|
|||
*/
|
||||
public class JndiConfiguration extends AbstractConfiguration
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(JndiConfiguration.class);
|
||||
|
||||
public JndiConfiguration()
|
||||
{
|
||||
addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class);
|
||||
addDependents(WebAppConfiguration.class);
|
||||
protectAndExpose("org.eclipse.jetty.jndi.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Loader.loadClass("org.eclipse.jetty.jndi.InitialContextFactory")!=null;
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
LOG.ignore(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@ package org.eclipse.jetty.webapp;
|
|||
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import org.eclipse.jetty.util.Loader;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
/**
|
||||
* <p>JSP Configuration</p>
|
||||
* <p>This configuration configures the WebAppContext server/system classes to
|
||||
|
@ -33,6 +37,8 @@ import java.util.ServiceLoader;
|
|||
*/
|
||||
public class JspConfiguration extends AbstractConfiguration
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(JspConfiguration.class);
|
||||
|
||||
public JspConfiguration()
|
||||
{
|
||||
addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class);
|
||||
|
@ -41,4 +47,18 @@ public class JspConfiguration extends AbstractConfiguration
|
|||
expose("org.eclipse.jetty.apache.");
|
||||
hide("org.eclipse.jdt.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Loader.loadClass("org.eclipse.jetty.jsp.JettyJspServlet")!=null;
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
LOG.ignore(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
package org.eclipse.jetty.webapp;
|
||||
|
||||
import org.eclipse.jetty.util.Loader;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
/**
|
||||
* <p>Jetty Servlets Configuration</p>
|
||||
* <p>This configuration configures the WebAppContext server/system classes to
|
||||
|
@ -27,6 +31,8 @@ package org.eclipse.jetty.webapp;
|
|||
*/
|
||||
public class ServletsConfiguration extends AbstractConfiguration
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(ServletsConfiguration.class);
|
||||
|
||||
public ServletsConfiguration()
|
||||
{
|
||||
addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, WebAppConfiguration.class);
|
||||
|
@ -37,4 +43,18 @@ public class ServletsConfiguration extends AbstractConfiguration
|
|||
);
|
||||
expose("org.eclipse.jetty.servlets."); // don't hide jetty servlets
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Loader.loadClass("org.eclipse.jetty.servlets.PushCacheFilter")!=null;
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
LOG.ignore(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@ package org.eclipse.jetty.webapp;
|
|||
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import org.eclipse.jetty.util.Loader;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
/**
|
||||
* <p>Websocket Configuration</p>
|
||||
* <p>This configuration configures the WebAppContext server/system classes to
|
||||
|
@ -32,10 +36,26 @@ import java.util.ServiceLoader;
|
|||
*/
|
||||
public class WebSocketConfiguration extends AbstractConfiguration
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(WebSocketConfiguration.class);
|
||||
|
||||
public WebSocketConfiguration()
|
||||
{
|
||||
addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class);
|
||||
addDependents("org.eclipse.jetty.annotations.AnnotationConfiguration", WebAppConfiguration.class.getName());
|
||||
protectAndExpose("org.eclipse.jetty.websocket.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Loader.loadClass("org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter")!=null;
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
LOG.ignore(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
org.eclipse.jetty.webapp.FragmentConfiguration
|
||||
org.eclipse.jetty.webapp.JettyWebXmlConfiguration
|
||||
org.eclipse.jetty.webapp.MetaInfConfiguration
|
||||
org.eclipse.jetty.webapp.WebInfConfiguration
|
||||
org.eclipse.jetty.webapp.WebXmlConfiguration
|
||||
org.eclipse.jetty.webapp.WebAppConfiguration
|
||||
org.eclipse.jetty.webapp.JaasConfiguration
|
||||
org.eclipse.jetty.webapp.JmxConfiguration
|
||||
org.eclipse.jetty.webapp.JndiConfiguration
|
||||
org.eclipse.jetty.webapp.JspConfiguration
|
||||
org.eclipse.jetty.webapp.MetaInfConfiguration
|
||||
org.eclipse.jetty.webapp.ServletsConfiguration
|
||||
org.eclipse.jetty.webapp.WebAppConfiguration
|
||||
org.eclipse.jetty.webapp.WebInfConfiguration
|
||||
org.eclipse.jetty.webapp.WebSocketConfiguration
|
||||
org.eclipse.jetty.webapp.WebXmlConfiguration
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
org.eclipse.jetty.webapp.WebSocketConfiguration
|
Loading…
Reference in New Issue