Skip to content

Commit 02239c3

Browse files
committed
Merge pull request #80 from GoogleCloudPlatform:spring-boot-fixes
PiperOrigin-RevId: 583399120 Change-Id: I4ebdcda1d3c42a836a6a0a4cb07581b477f3e8b2
2 parents c1b0aa9 + 4a964d0 commit 02239c3

File tree

2 files changed

+31
-11
lines changed

2 files changed

+31
-11
lines changed

api_dev/src/main/java/com/google/appengine/tools/development/DevAppServerClassLoader.java

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,31 @@ class DevAppServerClassLoader extends URLClassLoader {
6060
* classes will be loaded (e.g. DevAppServer).
6161
*/
6262
public static DevAppServerClassLoader newClassLoader(ClassLoader delegate) {
63+
List<URL> sharedLibs = AppengineSdk.getSdk().getSharedLibs();
64+
List<URL> implLibs = AppengineSdk.getSdk().getImplLibs();
65+
List<URL> userJspLibs = AppengineSdk.getSdk().getUserJspLibs();
66+
6367
// NB Doing shared, then impl, in order, allows us to prefer
64-
// returning shared classes when asked by other classloaders. This makes
65-
// it so that we don't have to have the impl and shared classes
66-
// be a strictly disjoint set.
67-
List<URL> libs = new ArrayList<>(AppengineSdk.getSdk().getSharedLibs());
68-
libs.addAll(AppengineSdk.getSdk().getImplLibs());
69-
// Needed by admin console servlets, which are loaded by this
70-
// ClassLoader
71-
libs.addAll(AppengineSdk.getSdk().getUserJspLibs());
72-
return new DevAppServerClassLoader(libs.toArray(new URL[libs.size()]), delegate);
68+
// returning shared classes when asked by other classloaders.
69+
// This makes it so that we don't have to have the impl and
70+
// shared classes be a strictly disjoint set.
71+
List<URL> libs = new ArrayList<>(sharedLibs);
72+
addLibs(libs, implLibs);
73+
74+
// Needed by admin console servlets, which are loaded by this ClassLoader.
75+
addLibs(libs, userJspLibs);
76+
77+
return new DevAppServerClassLoader(libs.toArray(new URL[0]), delegate);
78+
}
79+
80+
private static void addLibs(List<URL> libs, List<URL> toAdd)
81+
{
82+
for (URL url : toAdd)
83+
{
84+
if (libs.contains(url))
85+
continue;
86+
libs.add(url);
87+
}
7388
}
7489

7590
// NB

runtime/local_jetty12_ee10/src/main/java/com/google/appengine/tools/development/jetty/ee10/DevAppEngineWebAppContext.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public DevAppEngineWebAppContext(File appDir, File externalResourceDir, String s
6464

6565
// Set up the classpath required to compile JSPs. This is specific to Jasper.
6666
setAttribute(JASPER_SERVLET_CLASSPATH, buildClasspath());
67+
setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", ".*/jakarta.servlet-api-[^/]*\\.jar$|.*jakarta.servlet.jsp.jstl-.*\\.jar$");
6768

6869
// Make ApiProxyLocal available via the servlet context. This allows
6970
// servlets that are part of the dev appserver (like those that render the
@@ -94,14 +95,18 @@ protected ClassLoader configureClassLoader(ClassLoader loader) {
9495
return loader;
9596
}
9697

98+
@Override
99+
protected void doStart() throws Exception {
100+
super.doStart();
101+
disableTransportGuarantee();
102+
}
103+
97104
@Override
98105
protected ClassLoader enterScope(Request contextRequest) {
99106
if ((contextRequest != null) && (hasSkipAdminCheck(contextRequest))) {
100107
contextRequest.setAttribute(SKIP_ADMIN_CHECK_ATTR, Boolean.TRUE);
101108
}
102109

103-
disableTransportGuarantee();
104-
105110
// TODO An extremely heinous way of helping the DevAppServer's
106111
// SecurityManager determine if a DevAppServer request thread is executing.
107112
// Find something better.

0 commit comments

Comments
 (0)