Title: [729] trunk/rails-integration: - Allow FileServlet to work even if activation.jar is not present at runtime
- Revision
- 729
- Author
- nicksieger
- Date
- 2007-08-30 11:59:10 -0400 (Thu, 30 Aug 2007)
Log Message
- Allow FileServlet to work even if activation.jar is not present at runtime
- Make rails.root param assume it's relative to the webapp
- Make pom download and install rails if necessary
Modified Paths
Diff
Modified: trunk/rails-integration/pom.xml (728 => 729)
--- trunk/rails-integration/pom.xml 2007-08-30 15:38:52 UTC (rev 728)
+++ trunk/rails-integration/pom.xml 2007-08-30 15:59:10 UTC (rev 729)
@@ -187,6 +187,24 @@
</extensions>
<plugins>
<plugin>
+ <groupId>org.jruby.plugins</groupId>
+ <artifactId>jruby-rake-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>install-rails</id>
+ <phase>generate-test-resources</phase>
+ <goals><goal>rake</goal></goals>
+ <configuration>
+ <script>
+ task :default do
+ ruby "-S", "maybe_install_gems", "-v", "1.2.3", "rails" rescue nil
+ end
+ </script>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
Modified: trunk/rails-integration/src/main/java/org/jruby/webapp/FileServlet.java (728 => 729)
--- trunk/rails-integration/src/main/java/org/jruby/webapp/FileServlet.java 2007-08-30 15:38:52 UTC (rev 728)
+++ trunk/rails-integration/src/main/java/org/jruby/webapp/FileServlet.java 2007-08-30 15:59:10 UTC (rev 729)
@@ -1,7 +1,6 @@
package org.jruby.webapp;
import org.jruby.webapp.util.FileUtil;
-import javax.activation.FileTypeMap;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@@ -298,9 +297,15 @@
} else if (lowerName.endsWith(".js")) {
return "text/js";
}
- // everything else
- FileTypeMap typeMap = FileTypeMap.getDefaultFileTypeMap();
- return typeMap.getContentType(fileName);
+ try {
+ // everything else
+ javax.activation.FileTypeMap typeMap =
+ javax.activation.FileTypeMap.getDefaultFileTypeMap();
+ return typeMap.getContentType(fileName);
+ } catch (Throwable t) {
+ // allow activation.jar to be missing
+ return "application/octet-stream";
+ }
}
/**
Modified: trunk/rails-integration/src/main/java/org/jruby/webapp/RailsContextListener.java (728 => 729)
--- trunk/rails-integration/src/main/java/org/jruby/webapp/RailsContextListener.java 2007-08-30 15:38:52 UTC (rev 728)
+++ trunk/rails-integration/src/main/java/org/jruby/webapp/RailsContextListener.java 2007-08-30 15:59:10 UTC (rev 729)
@@ -36,13 +36,14 @@
// find the root of the web application
String railsRoot = context.getInitParameter("rails.root");
if (railsRoot == null || railsRoot.length() == 0) {
- try {
- railsRoot = getPath("/");
- } catch (ServletException e) {
- log("ERROR: " + e.getMessage());
- throw new RuntimeException(e);
- }
+ railsRoot = "/";
}
+ try {
+ railsRoot = getPath(railsRoot);
+ } catch (ServletException e) {
+ log("ERROR: " + e.getMessage());
+ throw new RuntimeException(e);
+ }
// create the factory
RailsFactory railsFactory = createRailsFactory();
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel