Issue #2983 - Jetty 10 Configuration abstraction.

Updated all services whose implementation is in jetty-webapp.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2018-10-16 14:59:08 +02:00
parent 1957e858ee
commit 28e50a2415
13 changed files with 112 additions and 19 deletions

View File

@ -1 +0,0 @@
org.eclipse.jetty.webapp.JspConfiguration

View File

@ -1 +0,0 @@
org.eclipse.jetty.webapp.JaasConfiguration

View File

@ -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>

View File

@ -1 +0,0 @@
org.eclipse.jetty.webapp.JndiConfiguration

View File

@ -1 +0,0 @@
org.eclipse.jetty.webapp.ServletsConfiguration

View File

@ -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;
}
}
}

View File

@ -18,12 +18,12 @@
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;
import java.util.ServiceLoader;
/**
* <p>JMX Configuration</p>
* <p>This configuration configures the WebAppContext server/system classes to
@ -55,7 +55,7 @@ public class JmxConfiguration extends AbstractConfiguration
catch (Throwable e)
{
LOG.ignore(e);
}
return false;
}
}
}

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

View File

@ -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

View File

@ -1 +0,0 @@
org.eclipse.jetty.webapp.WebSocketConfiguration