Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-24827] Complete compatibility with jetty 8.x
- Update jetty to latest 8.x - Expose jetty packages to webapp as it is required for jndi initial factory - Rename org.mortbay.jetty to org.eclipse.jetty
- Loading branch information
Showing
5 changed files
with
66 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/org/jenkinsci/maven/plugins/hpi/JettyAndServletApiOnlyClassLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.jenkinsci.maven.plugins.hpi; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.util.Collections; | ||
import java.util.Enumeration; | ||
|
||
/** | ||
* Only exposes Servlet API and Jetty to the web application, then JavaSE. | ||
* | ||
* <p> | ||
* This is because the classloader that loads this plugin brings in a whole lot of baggage, such as | ||
* Maven, Xalan, commons libraries, and etc., which can interfere with what's in Jenkins and plugins. | ||
* | ||
* @author Kohsuke Kawaguchi | ||
*/ | ||
public class JettyAndServletApiOnlyClassLoader extends ClassLoader { | ||
private final ClassLoader jettyClassLoader; | ||
|
||
public JettyAndServletApiOnlyClassLoader(ClassLoader parent, ClassLoader jettyClassLoader) { | ||
super(parent); | ||
this.jettyClassLoader = jettyClassLoader; | ||
} | ||
|
||
@Override | ||
public Enumeration<URL> getResources(String name) throws IOException { | ||
if (name.equals("jndi.properties")) { | ||
return jettyClassLoader.getResources(name); | ||
} | ||
return Collections.emptyEnumeration(); | ||
} | ||
|
||
@Override | ||
protected Class<?> findClass(String name) throws ClassNotFoundException { | ||
if (name.startsWith("javax.") | ||
|| name.startsWith("org.eclipse.jetty.")) | ||
return jettyClassLoader.loadClass(name); | ||
else | ||
throw new ClassNotFoundException(name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
src/main/java/org/jenkinsci/maven/plugins/hpi/ServletApiOnlyClassLoader.java
This file was deleted.
Oops, something went wrong.