- Revision
- 785
- Author
- mauro
- Date
- 2008-08-26 07:09:42 -0500 (Tue, 26 Aug 2008)
Log Message
Some progress in debugging jruby webapp.
Modified Paths
- trunk/examples/jruby-example/pom.xml
- trunk/examples/jruby-example/src/main/java/org/codehaus/waffle/example/jruby/JRubyRegistrar.java
- trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml
- trunk/waffle-ruby/src/main/java/org/codehaus/waffle/servlet/RhtmlServlet.java
Diff
Modified: trunk/examples/jruby-example/pom.xml (784 => 785)
--- trunk/examples/jruby-example/pom.xml 2008-08-26 09:21:11 UTC (rev 784) +++ trunk/examples/jruby-example/pom.xml 2008-08-26 12:09:42 UTC (rev 785) @@ -47,6 +47,25 @@ </artifactItems> </configuration> </execution> + <execution> + <id>unpack-waffle-ruby</id> + <phase>process-resources</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/${pom.artifactId}-${pom.version}/WEB-INF/classes</outputDirectory> + <includes>org/codehaus/waffle/**.rb</includes> + <overWriteSnapshots>true</overWriteSnapshots> + <artifactItems> + <artifactItem> + <groupId>${pom.groupId}</groupId> + <artifactId>waffle-ruby</artifactId> + <version>${pom.version}</version> + </artifactItem> + </artifactItems> + </configuration> + </execution> </executions> </plugin> <plugin>
Modified: trunk/examples/jruby-example/src/main/java/org/codehaus/waffle/example/jruby/JRubyRegistrar.java (784 => 785)
--- trunk/examples/jruby-example/src/main/java/org/codehaus/waffle/example/jruby/JRubyRegistrar.java 2008-08-26 09:21:11 UTC (rev 784) +++ trunk/examples/jruby-example/src/main/java/org/codehaus/waffle/example/jruby/JRubyRegistrar.java 2008-08-26 12:09:42 UTC (rev 785) @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.List; +import org.codehaus.waffle.context.pico.RubyScriptLoader; import org.codehaus.waffle.example.jruby.dao.SimplePersonDAO; import org.codehaus.waffle.registrar.AbstractScriptedRegistrar; import org.codehaus.waffle.registrar.Registrar; @@ -30,6 +31,6 @@ @Override public void request() { - register(RubyScriptReloader.class); + register(RubyScriptLoader.class); } }
Modified: trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml (784 => 785)
--- trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml 2008-08-26 09:21:11 UTC (rev 784) +++ trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml 2008-08-26 12:09:42 UTC (rev 785) @@ -47,8 +47,8 @@ <!-- Define a relative path to the ruby script directory (for development) --> <context-param> <param-name>org.codehaus.waffle.ruby.path</param-name> - <param-value>dir:../../src/main/ruby/</param-value> - <!-- this needs to be more forgiving --> + <param-value>dir:../../../target/waffle-jruby-example-1.2-SNAPSHOT/WEB-INF/classes/org/codehaus/waffle</param-value> + <!-- TODO: this needs to be more forgiving --> </context-param> <listener>
Modified: trunk/waffle-ruby/src/main/java/org/codehaus/waffle/servlet/RhtmlServlet.java (784 => 785)
--- trunk/waffle-ruby/src/main/java/org/codehaus/waffle/servlet/RhtmlServlet.java 2008-08-26 09:21:11 UTC (rev 784) +++ trunk/waffle-ruby/src/main/java/org/codehaus/waffle/servlet/RhtmlServlet.java 2008-08-26 12:09:42 UTC (rev 785) @@ -3,6 +3,16 @@ */ package org.codehaus.waffle.servlet; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import org.codehaus.waffle.Constants; import org.codehaus.waffle.WaffleException; import org.codehaus.waffle.context.RequestLevelContainer; @@ -13,15 +23,6 @@ import org.jruby.javasupport.JavaEmbedUtils; import org.jruby.runtime.builtin.IRubyObject; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; - /** * ERB (rhtml) views support * @@ -62,13 +63,16 @@ return controller; } - private String loadRhtml(String fileName) { - log("Loading...." + fileName); + private String loadRhtml(String resource) { + log("Loading...." + resource); BufferedReader bufferedReader = null; InputStream inputStream = null; try { - inputStream = getServletContext().getResourceAsStream(fileName); + inputStream = getServletContext().getResourceAsStream(resource); + if ( inputStream == null ){ + throw new IOException("Failed to find resource "+resource+" in servlet context"); + } bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder script = new StringBuilder(); String line = bufferedReader.readLine();
To unsubscribe from this list please visit:
