Make HostedModeServletContextProxy check in the Linker's output directory.
Patch by: bobv
Review by: scottb
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1862 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/shell/GWTShellServlet.java b/dev/core/src/com/google/gwt/dev/shell/GWTShellServlet.java
index 7fdf414..aca4ab0 100644
--- a/dev/core/src/com/google/gwt/dev/shell/GWTShellServlet.java
+++ b/dev/core/src/com/google/gwt/dev/shell/GWTShellServlet.java
@@ -916,10 +916,9 @@
// ServeletContext.getResourceAsStream()
//
File moduleDir = new File(getOutputDir(), moduleDef.getName());
- File shellDir = new File(moduleDir, GWTShell.GWT_SHELL_PATH);
ServletContext context = new HostedModeServletContextProxy(
- getServletContext(), moduleDef, shellDir);
+ getServletContext(), moduleDef, moduleDir);
ServletConfig config = new HostedModeServletConfigProxy(
getServletConfig(), context);
diff --git a/dev/core/src/com/google/gwt/dev/shell/HostedModeServletContextProxy.java b/dev/core/src/com/google/gwt/dev/shell/HostedModeServletContextProxy.java
index 5509a06..a016880 100644
--- a/dev/core/src/com/google/gwt/dev/shell/HostedModeServletContextProxy.java
+++ b/dev/core/src/com/google/gwt/dev/shell/HostedModeServletContextProxy.java
@@ -15,6 +15,7 @@
*/
package com.google.gwt.dev.shell;
+import com.google.gwt.dev.GWTShell;
import com.google.gwt.dev.cfg.ModuleDef;
import java.io.File;
@@ -37,13 +38,13 @@
class HostedModeServletContextProxy implements ServletContext {
private final ServletContext context;
private final ModuleDef moduleDef;
- private final File shellDir;
+ private final File moduleDir;
HostedModeServletContextProxy(ServletContext context, ModuleDef moduleDef,
- File shellDir) {
+ File moduleDir) {
this.context = context;
this.moduleDef = moduleDef;
- this.shellDir = shellDir;
+ this.moduleDir = moduleDir;
}
/**
@@ -160,12 +161,30 @@
URL url = moduleDef.findPublicFile(partialPath);
if (url == null) {
// Otherwise try the path but rooted in the shell's output directory
+ File shellDir = new File(moduleDir, GWTShell.GWT_SHELL_PATH);
File requestedFile = new File(shellDir, partialPath);
if (requestedFile.exists()) {
url = requestedFile.toURI().toURL();
}
}
+ /*
+ * If the user is coming from compiled web-mode, check the linker output
+ * directory for the file. We'll default to using the output directory of
+ * the first linker defined in the <set-linker> tab.
+ */
+ if (url == null) {
+ File linkerDir = new File(moduleDir, moduleDef.getActiveLinkerNames()[0]);
+ File requestedFile = new File(linkerDir, partialPath);
+ if (requestedFile.exists()) {
+ try {
+ url = requestedFile.toURI().toURL();
+ } catch (MalformedURLException e) {
+ // ignore since it was speculative anyway
+ }
+ }
+ }
+
return url;
}