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> </instructions>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<onlyAnalyze>org.eclipse.jetty.jndi.*</onlyAnalyze>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
<dependencies> <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 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>JAAS Configuration</p>
* <p>This configuration configures the WebAppContext server/system classes to * <p>This configuration configures the WebAppContext server/system classes to
@ -32,10 +36,26 @@ import java.util.ServiceLoader;
*/ */
public class JaasConfiguration extends AbstractConfiguration public class JaasConfiguration extends AbstractConfiguration
{ {
private static final Logger LOG = Log.getLogger(JaasConfiguration.class);
public JaasConfiguration() public JaasConfiguration()
{ {
addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class); addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class);
addDependents(WebAppConfiguration.class); addDependents(WebAppConfiguration.class);
protectAndExpose("org.eclipse.jetty.jaas."); 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; package org.eclipse.jetty.webapp;
import java.util.ServiceLoader;
import org.eclipse.jetty.util.Loader; import org.eclipse.jetty.util.Loader;
import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
import java.util.ServiceLoader;
/** /**
* <p>JMX Configuration</p> * <p>JMX Configuration</p>
* <p>This configuration configures the WebAppContext server/system classes to * <p>This configuration configures the WebAppContext server/system classes to
@ -55,7 +55,7 @@ public class JmxConfiguration extends AbstractConfiguration
catch (Throwable e) catch (Throwable e)
{ {
LOG.ignore(e); LOG.ignore(e);
}
return false; return false;
} }
}
} }

View File

@ -20,6 +20,10 @@ package org.eclipse.jetty.webapp;
import java.util.ServiceLoader; 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>JNDI Configuration</p>
* <p>This configuration configures the WebAppContext system/server classes to * <p>This configuration configures the WebAppContext system/server classes to
@ -32,10 +36,26 @@ import java.util.ServiceLoader;
*/ */
public class JndiConfiguration extends AbstractConfiguration public class JndiConfiguration extends AbstractConfiguration
{ {
private static final Logger LOG = Log.getLogger(JndiConfiguration.class);
public JndiConfiguration() public JndiConfiguration()
{ {
addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class); addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class);
addDependents(WebAppConfiguration.class); addDependents(WebAppConfiguration.class);
protectAndExpose("org.eclipse.jetty.jndi."); 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 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>JSP Configuration</p>
* <p>This configuration configures the WebAppContext server/system classes to * <p>This configuration configures the WebAppContext server/system classes to
@ -33,6 +37,8 @@ import java.util.ServiceLoader;
*/ */
public class JspConfiguration extends AbstractConfiguration public class JspConfiguration extends AbstractConfiguration
{ {
private static final Logger LOG = Log.getLogger(JspConfiguration.class);
public JspConfiguration() public JspConfiguration()
{ {
addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class); addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class);
@ -41,4 +47,18 @@ public class JspConfiguration extends AbstractConfiguration
expose("org.eclipse.jetty.apache."); expose("org.eclipse.jetty.apache.");
hide("org.eclipse.jdt."); 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; 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>Jetty Servlets Configuration</p>
* <p>This configuration configures the WebAppContext server/system classes to * <p>This configuration configures the WebAppContext server/system classes to
@ -27,6 +31,8 @@ package org.eclipse.jetty.webapp;
*/ */
public class ServletsConfiguration extends AbstractConfiguration public class ServletsConfiguration extends AbstractConfiguration
{ {
private static final Logger LOG = Log.getLogger(ServletsConfiguration.class);
public ServletsConfiguration() public ServletsConfiguration()
{ {
addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, WebAppConfiguration.class); 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 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 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>Websocket Configuration</p>
* <p>This configuration configures the WebAppContext server/system classes to * <p>This configuration configures the WebAppContext server/system classes to
@ -32,10 +36,26 @@ import java.util.ServiceLoader;
*/ */
public class WebSocketConfiguration extends AbstractConfiguration public class WebSocketConfiguration extends AbstractConfiguration
{ {
private static final Logger LOG = Log.getLogger(WebSocketConfiguration.class);
public WebSocketConfiguration() public WebSocketConfiguration()
{ {
addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class); addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class);
addDependents("org.eclipse.jetty.annotations.AnnotationConfiguration", WebAppConfiguration.class.getName()); addDependents("org.eclipse.jetty.annotations.AnnotationConfiguration", WebAppConfiguration.class.getName());
protectAndExpose("org.eclipse.jetty.websocket."); 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.FragmentConfiguration
org.eclipse.jetty.webapp.JettyWebXmlConfiguration org.eclipse.jetty.webapp.JettyWebXmlConfiguration
org.eclipse.jetty.webapp.MetaInfConfiguration org.eclipse.jetty.webapp.JaasConfiguration
org.eclipse.jetty.webapp.WebInfConfiguration
org.eclipse.jetty.webapp.WebXmlConfiguration
org.eclipse.jetty.webapp.WebAppConfiguration
org.eclipse.jetty.webapp.JmxConfiguration 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