Skip to content

Commit

Permalink
Remove the isServletApi checks
Browse files Browse the repository at this point in the history
  • Loading branch information
woldieJDI committed Feb 22, 2018
1 parent e5c1305 commit 7355c6f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ class JettyConfigurerImpl implements JettyConfigurer {

private static final Logger log = LoggerFactory.getLogger(JettyConfigurerImpl)

protected static boolean isServletApi(String filePath) {
filePath.matches(/^.*servlet-api.*\.jar$/)
}

private SSOAuthenticatorFactory ssoAuthenticatorFactory
private HashSessionManager sharedSessionManager

Expand Down Expand Up @@ -201,8 +197,8 @@ class JettyConfigurerImpl implements JettyConfigurer {
def createWebAppContext(Map serverParams, Map webappParams) {
List<String> webappClassPath = webappParams.webappClassPath
JettyWebAppContext context = new JettyWebAppContext()
context.setWebInfLib(webappClassPath.findAll { it.endsWith('.jar') && !isServletApi(it) }.collect { new File(it) })
context.setExtraClasspath(webappClassPath.collect { it.endsWith('.jar') ? it : (it.endsWith('/') ? it : it + '/') }.findAll { !isServletApi(it) }.join(';'))
context.setWebInfLib(webappClassPath.findAll { it.endsWith('.jar') }.collect { new File(it) })
context.setExtraClasspath(webappClassPath.collect { it.endsWith('.jar') ? it : (it.endsWith('/') ? it : it + '/') }.join(';'))
if (webappParams.webXml != null) context.setDescriptor(webappParams.webXml);
FilteringClassLoader classLoader = new FilteringClassLoader(context)
classLoader.addServerClass('ch.qos.logback.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ class JettyConfigurerImpl implements JettyConfigurer {

private static final Logger log = LoggerFactory.getLogger(JettyConfigurerImpl)

protected static boolean isServletApi(String filePath) {
filePath.matches(/^.*servlet-api.*\.jar$/)
}

private SSOAuthenticatorFactory ssoAuthenticatorFactory
private HashSessionManager sharedSessionManager

Expand Down Expand Up @@ -201,8 +197,8 @@ class JettyConfigurerImpl implements JettyConfigurer {
def createWebAppContext(Map serverParams, Map webappParams) {
List<String> webappClassPath = webappParams.webappClassPath
JettyWebAppContext context = new JettyWebAppContext()
context.setWebInfLib(webappClassPath.findAll { it.endsWith('.jar') && !isServletApi(it) }.collect { new File(it) })
context.setExtraClasspath(webappClassPath.collect { it.endsWith('.jar') ? it : (it.endsWith('/') ? it : it + '/') }.findAll { !isServletApi(it) }.join(';'))
context.setWebInfLib(webappClassPath.findAll { it.endsWith('.jar') }.collect { new File(it) })
context.setExtraClasspath(webappClassPath.collect { it.endsWith('.jar') ? it : (it.endsWith('/') ? it : it + '/') }.join(';'))
if (webappParams.webXml != null) context.setDescriptor(webappParams.webXml);
FilteringClassLoader classLoader = new FilteringClassLoader(context)
classLoader.addServerClass('ch.qos.logback.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ class JettyConfigurerImpl implements JettyConfigurer {

private static final Logger log = LoggerFactory.getLogger(JettyConfigurerImpl)

protected static boolean isServletApi(String filePath) {
filePath.matches(/^.*servlet-api.*\.jar$/)
}

private SSOAuthenticatorFactory ssoAuthenticatorFactory
private HashSessionManager sharedSessionManager

Expand Down Expand Up @@ -207,8 +203,8 @@ class JettyConfigurerImpl implements JettyConfigurer {
String webappClasspathScanPattern = webappParams.webInfIncludeJarPattern
JettyWebAppContext context = new JettyWebAppContext()
context.setAttribute("org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern", webappClasspathScanPattern)
context.setWebInfLib(webappClassPath.findAll { it.endsWith('.jar') && !isServletApi(it) }.collect { new File(it) })
context.setExtraClasspath(webappClassPath.collect { it.endsWith('.jar') ? it : (it.endsWith('/') ? it : it + '/') }.findAll { !isServletApi(it) }.join(';'))
context.setWebInfLib(webappClassPath.findAll { it.endsWith('.jar') }.collect { new File(it) })
context.setExtraClasspath(webappClassPath.collect { it.endsWith('.jar') ? it : (it.endsWith('/') ? it : it + '/') }.join(';'))
context.setInitParameter('org.eclipse.jetty.servlet.Default.useFileMappedBuffer', serverParams.productMode ? 'true' : 'false')
if (webappParams.webXml != null) context.setDescriptor(webappParams.webXml);
FilteringClassLoader classLoader = new FilteringClassLoader(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ class JettyConfigurerImpl implements JettyConfigurer {

private static final Logger log = LoggerFactory.getLogger(JettyConfigurerImpl)

protected static boolean isServletApi(String filePath) {
filePath.matches(/^.*servlet-api.*\.jar$/)
}

private SSOAuthenticatorFactory ssoAuthenticatorFactory
private HashSessionManager sharedSessionManager

Expand Down Expand Up @@ -205,8 +201,8 @@ class JettyConfigurerImpl implements JettyConfigurer {
def createWebAppContext(Map serverParams, Map webappParams) {
List<String> webappClassPath = webappParams.webappClassPath
JettyWebAppContext context = new JettyWebAppContext()
context.setWebInfLib(webappClassPath.findAll { it.endsWith('.jar') && !isServletApi(it) }.collect { new File(it) })
context.setExtraClasspath(webappClassPath.collect { it.endsWith('.jar') ? it : (it.endsWith('/') ? it : it + '/') }.findAll { !isServletApi(it) }.join(';'))
context.setWebInfLib(webappClassPath.findAll { it.endsWith('.jar') }.collect { new File(it) })
context.setExtraClasspath(webappClassPath.collect { it.endsWith('.jar') ? it : (it.endsWith('/') ? it : it + '/') }.join(';'))
context.setInitParameter('org.eclipse.jetty.servlet.Default.useFileMappedBuffer', serverParams.productMode ? 'true' : 'false')
context.setAttribute('org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern',
'.*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ class JettyConfigurerImpl implements JettyConfigurer {

private static final Logger log = LoggerFactory.getLogger(JettyConfigurerImpl)

protected static boolean isServletApi(String filePath) {
filePath.matches(/^.*servlet-api.*\.jar$/)
}

private SSOAuthenticatorFactory ssoAuthenticatorFactory
private SessionHandler sharedSessionHandler

Expand Down Expand Up @@ -204,8 +200,8 @@ class JettyConfigurerImpl implements JettyConfigurer {
def createWebAppContext(Map serverParams, Map webappParams) {
List<String> webappClassPath = webappParams.webappClassPath
JettyWebAppContext context = new JettyWebAppContext()
context.setWebInfLib(webappClassPath.findAll { it.endsWith('.jar') && !isServletApi(it) }.collect { new File(it) })
context.setExtraClasspath(webappClassPath.collect { it.endsWith('.jar') ? it : (it.endsWith('/') ? it : it + '/') }.findAll { !isServletApi(it) }.join(';'))
context.setWebInfLib(webappClassPath.findAll { it.endsWith('.jar') }.collect { new File(it) })
context.setExtraClasspath(webappClassPath.collect { it.endsWith('.jar') ? it : (it.endsWith('/') ? it : it + '/') }.join(';'))
context.setInitParameter('org.eclipse.jetty.servlet.Default.useFileMappedBuffer', serverParams.productMode ? 'true' : 'false')
context.setAttribute('org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern',
'.*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ class TomcatConfigurerImpl implements TomcatConfigurer {

private static final Logger log = LoggerFactory.getLogger(TomcatConfigurerImpl)

protected static boolean isServletApi(String filePath) {
filePath.matches(/^.*servlet-api.*\.jar$/)
}

@Override
ContextConfig createContextConfig(URL[] classpathUrls) {

Expand Down Expand Up @@ -75,7 +71,7 @@ class TomcatConfigurerImpl implements TomcatConfigurer {
if (webappParams.webXml)
context.setAltDDName(webappParams.webXml);

Set classpathJarParentDirs = webappParams.webappClassPath.findAll { it.endsWith('.jar') && !isServletApi(it) }.collect({
Set classpathJarParentDirs = webappParams.webappClassPath.findAll { it.endsWith('.jar') }.collect({
File jarFile = it.startsWith('file:') ? new File(new URI(it)) : new File(it)
jarFile
}) as Set
Expand Down

0 comments on commit 7355c6f

Please sign in to comment.