From derek.townsend at perspecsys.com Fri Nov 10 12:18:37 2006 From: derek.townsend at perspecsys.com (Derek Townsend) Date: Fri, 10 Nov 2006 12:18:37 -0500 Subject: [Jruby-extras-devel] WAR deployment Message-ID: <4554B46D.2050502@perspecsys.com> Hi I just joined the list and would like to help with the WAR deployment project for JRuby. my rubyforge ID is 12463. Please let me know what i can do. Derek **** From public at bagotricks.com Sat Nov 11 02:23:13 2006 From: public at bagotricks.com (Thomas Palmer) Date: Fri, 10 Nov 2006 23:23:13 -0800 Subject: [Jruby-extras-devel] Rendering a Gruff Graphs example Message-ID: <45557A61.1040007@bagotricks.com> I've got a mostly correct rendering of a simple Gruff Graphs example: http://bagotricks.com/blog/2006/11/11/gruff-graphs-in-jruby/ Once I cover more/all of Gruff Graphs features, I'll probably release 0.3. And maybe I'll make a gem someday, too. I've discussed this some with Tim Hunter (of RMagick), but I don't have a final plan, and I haven't had the time to work on it. I'm aiming for features first, but I really need to cut a gem someday. - Tom Palmer From robert at cs.auckland.ac.nz Sun Nov 12 03:45:51 2006 From: robert at cs.auckland.ac.nz (Robert Egglestone) Date: Sun, 12 Nov 2006 21:45:51 +1300 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <4554B46D.2050502@perspecsys.com> References: <4554B46D.2050502@perspecsys.com> Message-ID: <4556DF3F.9040403@cs.auckland.ac.nz> Hi all, I've checked the latest version of the initial WAR code I had into the subversion repository at: svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration It currently contains two parts: + rails-integration is a JAR library, which contains RailsServlet, FileServlet, and associated Ruby code. + samples/helloworld is a very simple Rails application plus WEB-INF/web.xml and pom.xml. If anyone could try it out and see if you run into any problems it would be much appreciated. Some of the changes from before: + Error messages are a lot better + Fausto's real path fix has been added in + The webapp directory layout is now the standard Rails one (This also means that mvn jetty:run can be used to run them in-place). + FileServlet has been added to handle static files Cheers, Robert From fausto.lelli at gmail.com Sun Nov 12 05:20:43 2006 From: fausto.lelli at gmail.com (Fausto Lelli) Date: Sun, 12 Nov 2006 11:20:43 +0100 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <4556DF3F.9040403@cs.auckland.ac.nz> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> Message-ID: Hi Robert, helloworld is working and the static files are reachable, but I needed to add the WEB-INF/ruby/builtin directory into the helloworld dir and add the loadpath in the RailsServlet // setup the load paths List loadPaths = new ArrayList(); loadPaths.add(railsRoot); loadPaths.add(getPath("/WEB-INF/ruby")); I'm not using maven (I don't have it installed yet) so the dir thing is settled by it, I just don't know. Cheers, Fausto On 11/12/06, Robert Egglestone wrote: > Hi all, > > I've checked the latest version of the initial WAR code I had into the > subversion repository at: > svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration > > It currently contains two parts: > + rails-integration is a JAR library, which contains RailsServlet, > FileServlet, and associated Ruby code. > + samples/helloworld is a very simple Rails application plus > WEB-INF/web.xml and pom.xml. > > If anyone could try it out and see if you run into any problems it would > be much appreciated. > > Some of the changes from before: > + Error messages are a lot better > + Fausto's real path fix has been added in > + The webapp directory layout is now the standard Rails one (This also > means that mvn jetty:run can be used to run them in-place). > + FileServlet has been added to handle static files > > Cheers, > Robert > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > From robert at cs.auckland.ac.nz Sun Nov 12 16:39:49 2006 From: robert at cs.auckland.ac.nz (Robert Egglestone) Date: Mon, 13 Nov 2006 10:39:49 +1300 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> Message-ID: <455794A5.8050806@cs.auckland.ac.nz> Hi Fausto, Thanks for trying it out. I've added in an Ant build file which should make things easier. I was expecting to have to use /WEB-INF/ruby, but it turns out that JRuby can get the .rb file from inside jars, so the rails-integration jar should be able to contain these as well. Conceivably I guess we could even package up gems as jar files to make self-contained web apps. I'm not sure about the best way to deal with the static files. The FileServlet approach isn't great, however rearranging the Rails app isn't ideal either. We could suggest that if people intend the Rails app to be mostly used with JRuby, then they rearrange the structure to move public to the top. Alternatively, if they're wanting something that's compatible with both Ruby and JRuby, then they go with FileServlet. Cheers, Robert Fausto Lelli wrote: > Hi Robert, > > helloworld is working and the static files are reachable, > but I needed to add the WEB-INF/ruby/builtin directory into > the helloworld dir and add the loadpath in the RailsServlet > > // setup the load paths > List loadPaths = new ArrayList(); > loadPaths.add(railsRoot); > loadPaths.add(getPath("/WEB-INF/ruby")); > > I'm not using maven (I don't have it installed yet) so the dir thing > is settled by it, I just don't know. > > Cheers, > Fausto > > On 11/12/06, Robert Egglestone wrote: > >> Hi all, >> >> I've checked the latest version of the initial WAR code I had into the >> subversion repository at: >> svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >> >> It currently contains two parts: >> + rails-integration is a JAR library, which contains RailsServlet, >> FileServlet, and associated Ruby code. >> + samples/helloworld is a very simple Rails application plus >> WEB-INF/web.xml and pom.xml. >> >> If anyone could try it out and see if you run into any problems it would >> be much appreciated. >> >> Some of the changes from before: >> + Error messages are a lot better >> + Fausto's real path fix has been added in >> + The webapp directory layout is now the standard Rails one (This also >> means that mvn jetty:run can be used to run them in-place). >> + FileServlet has been added to handle static files >> >> Cheers, >> Robert >> >> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20061113/fb47d526/attachment.html From fausto.lelli at gmail.com Sun Nov 12 19:22:34 2006 From: fausto.lelli at gmail.com (Fausto Lelli) Date: Mon, 13 Nov 2006 01:22:34 +0100 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <455794A5.8050806@cs.auckland.ac.nz> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> Message-ID: Hi Robert, an outstanding job as usual, just two things: 1) in the ant file, also the servlet api jar need to included in the classpath jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot make the patch myself because I don't know the best way to deal this kind of dependence within maven) 2)in the read me file, also remember to copy all the jruby related jar file in the lib directory of the webapp (jruby,asm,bsf ecc) > be able to contain these as well. Conceivably I guess we could even package > up gems as jar files to make self-contained web apps. Intriguing, really. > ideal either. We could suggest that if people intend the Rails app to be > mostly used with JRuby, then they rearrange the structure to move public to > the top. Alternatively, if they're wanting something that's compatible with > both Ruby and JRuby, then they go with FileServlet. Exactly. There's choices even! Anyway the FileServlet approach seems the more confortable at the moment, by far. My only concern is in the fact that, in the case that there a are lot (a lot!) of static files to be served, the FileServlet could be hit quite heavely, and this could degrade the overall performance. But probably this is just speculation and won't be a great problem in practice. I also think that a rake goal to procude a war-packaged rails app is waiting at the door, do you think ;-) ? Fausto On 11/12/06, Robert Egglestone wrote: > > Hi Fausto, > > Thanks for trying it out. I've added in an Ant build file which should make > things easier. > > I was expecting to have to use /WEB-INF/ruby, but it turns out that JRuby > can get the .rb file from inside jars, so the rails-integration jar should > be able to contain these as well. Conceivably I guess we could even package > up gems as jar files to make self-contained web apps. > > I'm not sure about the best way to deal with the static files. The > FileServlet approach isn't great, however rearranging the Rails app isn't > ideal either. We could suggest that if people intend the Rails app to be > mostly used with JRuby, then they rearrange the structure to move public to > the top. Alternatively, if they're wanting something that's compatible with > both Ruby and JRuby, then they go with FileServlet. > > Cheers, > Robert > > > > Fausto Lelli wrote: > Hi Robert, > > helloworld is working and the static files are reachable, > but I needed to add the WEB-INF/ruby/builtin directory into > the helloworld dir and add the loadpath in the RailsServlet > > // setup the load paths > List loadPaths = new ArrayList(); > loadPaths.add(railsRoot); > loadPaths.add(getPath("/WEB-INF/ruby")); > > I'm not using maven (I don't have it installed yet) so the dir thing > is settled by it, I just don't know. > > Cheers, > Fausto > > On 11/12/06, Robert Egglestone wrote: > > > Hi all, > > I've checked the latest version of the initial WAR code I had into the > subversion repository at: > svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration > > It currently contains two parts: > + rails-integration is a JAR library, which contains RailsServlet, > FileServlet, and associated Ruby code. > + samples/helloworld is a very simple Rails application plus > WEB-INF/web.xml and pom.xml. > > If anyone could try it out and see if you run into any problems it would > be much appreciated. > > Some of the changes from before: > + Error messages are a lot better > + Fausto's real path fix has been added in > + The webapp directory layout is now the standard Rails one (This also > means that mvn jetty:run can be used to run them in-place). > + FileServlet has been added to handle static files > > Cheers, > Robert > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > From superchrisnelson at gmail.com Sun Nov 12 19:54:34 2006 From: superchrisnelson at gmail.com (Chris Nelson) Date: Sun, 12 Nov 2006 19:54:34 -0500 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <455794A5.8050806@cs.auckland.ac.nz> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> Message-ID: Hey, thanks a lot Robert. I tried it out and followed the maven directions in the README file and got the JRuby welcome screen when I ran the helloworld app. I'll try creating a simple scaffolded ActiveRecord-jdbc app next and let you know how it goes. Great work! BTW, that's pretty awesome that JRuby can find scripts on the classpath using require. Packaging gems into jars in a WAR file is certainly an intriguing possibility. --chris On 11/12/06, Robert Egglestone wrote: > > Hi Fausto, > > Thanks for trying it out. I've added in an Ant build file which should make > things easier. > > I was expecting to have to use /WEB-INF/ruby, but it turns out that JRuby > can get the .rb file from inside jars, so the rails-integration jar should > be able to contain these as well. Conceivably I guess we could even package > up gems as jar files to make self-contained web apps. > > I'm not sure about the best way to deal with the static files. The > FileServlet approach isn't great, however rearranging the Rails app isn't > ideal either. We could suggest that if people intend the Rails app to be > mostly used with JRuby, then they rearrange the structure to move public to > the top. Alternatively, if they're wanting something that's compatible with > both Ruby and JRuby, then they go with FileServlet. > > Cheers, > Robert > > > > Fausto Lelli wrote: > Hi Robert, > > helloworld is working and the static files are reachable, > but I needed to add the WEB-INF/ruby/builtin directory into > the helloworld dir and add the loadpath in the RailsServlet > > // setup the load paths > List loadPaths = new ArrayList(); > loadPaths.add(railsRoot); > loadPaths.add(getPath("/WEB-INF/ruby")); > > I'm not using maven (I don't have it installed yet) so the dir thing > is settled by it, I just don't know. > > Cheers, > Fausto > > On 11/12/06, Robert Egglestone wrote: > > > Hi all, > > I've checked the latest version of the initial WAR code I had into the > subversion repository at: > svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration > > It currently contains two parts: > + rails-integration is a JAR library, which contains RailsServlet, > FileServlet, and associated Ruby code. > + samples/helloworld is a very simple Rails application plus > WEB-INF/web.xml and pom.xml. > > If anyone could try it out and see if you run into any problems it would > be much appreciated. > > Some of the changes from before: > + Error messages are a lot better > + Fausto's real path fix has been added in > + The webapp directory layout is now the standard Rails one (This also > means that mvn jetty:run can be used to run them in-place). > + FileServlet has been added to handle static files > > Cheers, > Robert > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > From superchrisnelson at gmail.com Sun Nov 12 20:19:27 2006 From: superchrisnelson at gmail.com (Chris Nelson) Date: Sun, 12 Nov 2006 20:19:27 -0500 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> Message-ID: At some point should we look at Raven to do our builds? It appears it to combine some goodness from both maven and rake. http://raven.rubyforge.org/ On 11/12/06, Chris Nelson wrote: > Hey, thanks a lot Robert. I tried it out and followed the maven > directions in the README file and got the JRuby welcome screen when I > ran the helloworld app. I'll try creating a simple scaffolded > ActiveRecord-jdbc app next and let you know how it goes. Great work! > > BTW, that's pretty awesome that JRuby can find scripts on the > classpath using require. Packaging gems into jars in a WAR file is > certainly an intriguing possibility. > > --chris > > On 11/12/06, Robert Egglestone wrote: > > > > Hi Fausto, > > > > Thanks for trying it out. I've added in an Ant build file which should make > > things easier. > > > > I was expecting to have to use /WEB-INF/ruby, but it turns out that JRuby > > can get the .rb file from inside jars, so the rails-integration jar should > > be able to contain these as well. Conceivably I guess we could even package > > up gems as jar files to make self-contained web apps. > > > > I'm not sure about the best way to deal with the static files. The > > FileServlet approach isn't great, however rearranging the Rails app isn't > > ideal either. We could suggest that if people intend the Rails app to be > > mostly used with JRuby, then they rearrange the structure to move public to > > the top. Alternatively, if they're wanting something that's compatible with > > both Ruby and JRuby, then they go with FileServlet. > > > > Cheers, > > Robert > > > > > > > > Fausto Lelli wrote: > > Hi Robert, > > > > helloworld is working and the static files are reachable, > > but I needed to add the WEB-INF/ruby/builtin directory into > > the helloworld dir and add the loadpath in the RailsServlet > > > > // setup the load paths > > List loadPaths = new ArrayList(); > > loadPaths.add(railsRoot); > > loadPaths.add(getPath("/WEB-INF/ruby")); > > > > I'm not using maven (I don't have it installed yet) so the dir thing > > is settled by it, I just don't know. > > > > Cheers, > > Fausto > > > > On 11/12/06, Robert Egglestone wrote: > > > > > > Hi all, > > > > I've checked the latest version of the initial WAR code I had into the > > subversion repository at: > > svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration > > > > It currently contains two parts: > > + rails-integration is a JAR library, which contains RailsServlet, > > FileServlet, and associated Ruby code. > > + samples/helloworld is a very simple Rails application plus > > WEB-INF/web.xml and pom.xml. > > > > If anyone could try it out and see if you run into any problems it would > > be much appreciated. > > > > Some of the changes from before: > > + Error messages are a lot better > > + Fausto's real path fix has been added in > > + The webapp directory layout is now the standard Rails one (This also > > means that mvn jetty:run can be used to run them in-place). > > + FileServlet has been added to handle static files > > > > Cheers, > > Robert > > > > > > _______________________________________________ > > Jruby-extras-devel mailing list > > Jruby-extras-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > > _______________________________________________ > > Jruby-extras-devel mailing list > > Jruby-extras-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > > _______________________________________________ > > Jruby-extras-devel mailing list > > Jruby-extras-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > From robert at cs.auckland.ac.nz Sun Nov 12 21:08:25 2006 From: robert at cs.auckland.ac.nz (Robert Egglestone) Date: Mon, 13 Nov 2006 15:08:25 +1300 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> Message-ID: <4557D399.5040301@cs.auckland.ac.nz> Ah, oops, it turns out I had the jars on my classpath. I've fixed up the build file and readme with the changes, thanks. I'm not very familiar with rake, but certainly being able to package everything up from a single command would make things easier. Cheers, Robert Fausto Lelli wrote: > Hi Robert, > an outstanding job as usual, just two things: > 1) in the ant file, also the servlet api jar need to included in the classpath > jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot make the > patch myself because I don't know the best way to deal this kind > of dependence within maven) > 2)in the read me file, also remember to copy all the jruby related jar > file in the lib directory of the webapp (jruby,asm,bsf ecc) > > >> be able to contain these as well. Conceivably I guess we could even package >> up gems as jar files to make self-contained web apps. >> > > Intriguing, really. > > >> ideal either. We could suggest that if people intend the Rails app to be >> mostly used with JRuby, then they rearrange the structure to move public to >> the top. Alternatively, if they're wanting something that's compatible with >> both Ruby and JRuby, then they go with FileServlet. >> > > Exactly. There's choices even! Anyway the FileServlet approach seems the more > confortable at the moment, by far. My only concern is in the fact > that, in the case > that there a are lot (a lot!) of static files to be served, the > FileServlet could be hit > quite heavely, and this could degrade the overall performance. But > probably this is > just speculation and won't be a great problem in practice. > > I also think that a rake goal to procude a war-packaged rails app is > waiting at the > door, do you think ;-) ? > > Fausto > > > On 11/12/06, Robert Egglestone wrote: > >> Hi Fausto, >> >> Thanks for trying it out. I've added in an Ant build file which should make >> things easier. >> >> I was expecting to have to use /WEB-INF/ruby, but it turns out that JRuby >> can get the .rb file from inside jars, so the rails-integration jar should >> be able to contain these as well. Conceivably I guess we could even package >> up gems as jar files to make self-contained web apps. >> >> I'm not sure about the best way to deal with the static files. The >> FileServlet approach isn't great, however rearranging the Rails app isn't >> ideal either. We could suggest that if people intend the Rails app to be >> mostly used with JRuby, then they rearrange the structure to move public to >> the top. Alternatively, if they're wanting something that's compatible with >> both Ruby and JRuby, then they go with FileServlet. >> >> Cheers, >> Robert >> >> >> >> Fausto Lelli wrote: >> Hi Robert, >> >> helloworld is working and the static files are reachable, >> but I needed to add the WEB-INF/ruby/builtin directory into >> the helloworld dir and add the loadpath in the RailsServlet >> >> // setup the load paths >> List loadPaths = new ArrayList(); >> loadPaths.add(railsRoot); >> loadPaths.add(getPath("/WEB-INF/ruby")); >> >> I'm not using maven (I don't have it installed yet) so the dir thing >> is settled by it, I just don't know. >> >> Cheers, >> Fausto >> >> On 11/12/06, Robert Egglestone wrote: >> >> >> Hi all, >> >> I've checked the latest version of the initial WAR code I had into the >> subversion repository at: >> svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >> >> It currently contains two parts: >> + rails-integration is a JAR library, which contains RailsServlet, >> FileServlet, and associated Ruby code. >> + samples/helloworld is a very simple Rails application plus >> WEB-INF/web.xml and pom.xml. >> >> If anyone could try it out and see if you run into any problems it would >> be much appreciated. >> >> Some of the changes from before: >> + Error messages are a lot better >> + Fausto's real path fix has been added in >> + The webapp directory layout is now the standard Rails one (This also >> means that mvn jetty:run can be used to run them in-place). >> + FileServlet has been added to handle static files >> >> Cheers, >> Robert >> >> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >> > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20061113/ac5637b0/attachment.html From superchrisnelson at gmail.com Sun Nov 12 23:34:51 2006 From: superchrisnelson at gmail.com (Chris Nelson) Date: Sun, 12 Nov 2006 23:34:51 -0500 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <4557D399.5040301@cs.auckland.ac.nz> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> Message-ID: Well, I was able to get a simple Rails app with some simple scaffolding to load, but it didn't seem to quite work correctly. It would save records, but not seem to take any values from the screen. In the database it would create a record with nulls in all the columns. The same screens work ok with jruby script/server so it appears to a problem specific to using jetty:run. Still, great progress! --Chris On 11/12/06, Robert Egglestone wrote: > > Ah, oops, it turns out I had the jars on my classpath. I've fixed up the > build file and readme with the changes, thanks. > > I'm not very familiar with rake, but certainly being able to package > everything up from a single command would make things easier. > > > Cheers, > Robert > > Fausto Lelli wrote: > Hi Robert, > an outstanding job as usual, just two things: > 1) in the ant file, also the servlet api jar need to included in the > classpath > jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot make the > patch myself because I don't know the best way to deal this kind > of dependence within maven) > 2)in the read me file, also remember to copy all the jruby related jar > file in the lib directory of the webapp (jruby,asm,bsf ecc) > > > > be able to contain these as well. Conceivably I guess we could even package > up gems as jar files to make self-contained web apps. > > Intriguing, really. > > > > ideal either. We could suggest that if people intend the Rails app to be > mostly used with JRuby, then they rearrange the structure to move public to > the top. Alternatively, if they're wanting something that's compatible with > both Ruby and JRuby, then they go with FileServlet. > > Exactly. There's choices even! Anyway the FileServlet approach seems the > more > confortable at the moment, by far. My only concern is in the fact > that, in the case > that there a are lot (a lot!) of static files to be served, the > FileServlet could be hit > quite heavely, and this could degrade the overall performance. But > probably this is > just speculation and won't be a great problem in practice. > > I also think that a rake goal to procude a war-packaged rails app is > waiting at the > door, do you think ;-) ? > > Fausto > > > On 11/12/06, Robert Egglestone wrote: > > > Hi Fausto, > > Thanks for trying it out. I've added in an Ant build file which should make > things easier. > > I was expecting to have to use /WEB-INF/ruby, but it turns out that JRuby > can get the .rb file from inside jars, so the rails-integration jar should > be able to contain these as well. Conceivably I guess we could even package > up gems as jar files to make self-contained web apps. > > I'm not sure about the best way to deal with the static files. The > FileServlet approach isn't great, however rearranging the Rails app isn't > ideal either. We could suggest that if people intend the Rails app to be > mostly used with JRuby, then they rearrange the structure to move public to > the top. Alternatively, if they're wanting something that's compatible with > both Ruby and JRuby, then they go with FileServlet. > > Cheers, > Robert > > > > Fausto Lelli wrote: > Hi Robert, > > helloworld is working and the static files are reachable, > but I needed to add the WEB-INF/ruby/builtin directory into > the helloworld dir and add the loadpath in the RailsServlet > > // setup the load paths > List loadPaths = new ArrayList(); > loadPaths.add(railsRoot); > loadPaths.add(getPath("/WEB-INF/ruby")); > > I'm not using maven (I don't have it installed yet) so the dir thing > is settled by it, I just don't know. > > Cheers, > Fausto > > On 11/12/06, Robert Egglestone wrote: > > > Hi all, > > I've checked the latest version of the initial WAR code I had into the > subversion repository at: > svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration > > It currently contains two parts: > + rails-integration is a JAR library, which contains RailsServlet, > FileServlet, and associated Ruby code. > + samples/helloworld is a very simple Rails application plus > WEB-INF/web.xml and pom.xml. > > If anyone could try it out and see if you run into any problems it would > be much appreciated. > > Some of the changes from before: > + Error messages are a lot better > + Fausto's real path fix has been added in > + The webapp directory layout is now the standard Rails one (This also > means that mvn jetty:run can be used to run them in-place). > + FileServlet has been added to handle static files > > Cheers, > Robert > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > From headius at headius.com Mon Nov 13 00:42:39 2006 From: headius at headius.com (Charles Oliver Nutter) Date: Sun, 12 Nov 2006 23:42:39 -0600 Subject: [Jruby-extras-devel] Commit mailing list added Message-ID: <455805CF.1080005@headius.com> Added and set up: jruby-extras-commit -- Charles Oliver Nutter, JRuby Core Developer Blogging on Ruby and Java @ headius.blogspot.com Help spec out Ruby today! @ www.headius.com/rubyspec headius at headius.com -- charles.nutter at sun.com From robert at cs.auckland.ac.nz Mon Nov 13 15:16:38 2006 From: robert at cs.auckland.ac.nz (Robert Egglestone) Date: Tue, 14 Nov 2006 09:16:38 +1300 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> Message-ID: <4558D2A6.6070300@cs.auckland.ac.nz> Hi Chris, Thanks for testing it out. Would it be possible to check in the Rails app as another sample so we can work through the problems? Cheers, Robert Chris Nelson wrote: > Well, I was able to get a simple Rails app with some simple > scaffolding to load, but it didn't seem to quite work correctly. It > would save records, but not seem to take any values from the screen. > In the database it would create a record with nulls in all the > columns. The same screens work ok with jruby script/server so it > appears to a problem specific to using jetty:run. > > Still, great progress! > > --Chris > > On 11/12/06, Robert Egglestone wrote: > >> Ah, oops, it turns out I had the jars on my classpath. I've fixed up the >> build file and readme with the changes, thanks. >> >> I'm not very familiar with rake, but certainly being able to package >> everything up from a single command would make things easier. >> >> >> Cheers, >> Robert >> >> Fausto Lelli wrote: >> Hi Robert, >> an outstanding job as usual, just two things: >> 1) in the ant file, also the servlet api jar need to included in the >> classpath >> jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot make the >> patch myself because I don't know the best way to deal this kind >> of dependence within maven) >> 2)in the read me file, also remember to copy all the jruby related jar >> file in the lib directory of the webapp (jruby,asm,bsf ecc) >> >> >> >> be able to contain these as well. Conceivably I guess we could even package >> up gems as jar files to make self-contained web apps. >> >> Intriguing, really. >> >> >> >> ideal either. We could suggest that if people intend the Rails app to be >> mostly used with JRuby, then they rearrange the structure to move public to >> the top. Alternatively, if they're wanting something that's compatible with >> both Ruby and JRuby, then they go with FileServlet. >> >> Exactly. There's choices even! Anyway the FileServlet approach seems the >> more >> confortable at the moment, by far. My only concern is in the fact >> that, in the case >> that there a are lot (a lot!) of static files to be served, the >> FileServlet could be hit >> quite heavely, and this could degrade the overall performance. But >> probably this is >> just speculation and won't be a great problem in practice. >> >> I also think that a rake goal to procude a war-packaged rails app is >> waiting at the >> door, do you think ;-) ? >> >> Fausto >> >> >> On 11/12/06, Robert Egglestone wrote: >> >> >> Hi Fausto, >> >> Thanks for trying it out. I've added in an Ant build file which should make >> things easier. >> >> I was expecting to have to use /WEB-INF/ruby, but it turns out that JRuby >> can get the .rb file from inside jars, so the rails-integration jar should >> be able to contain these as well. Conceivably I guess we could even package >> up gems as jar files to make self-contained web apps. >> >> I'm not sure about the best way to deal with the static files. The >> FileServlet approach isn't great, however rearranging the Rails app isn't >> ideal either. We could suggest that if people intend the Rails app to be >> mostly used with JRuby, then they rearrange the structure to move public to >> the top. Alternatively, if they're wanting something that's compatible with >> both Ruby and JRuby, then they go with FileServlet. >> >> Cheers, >> Robert >> >> >> >> Fausto Lelli wrote: >> Hi Robert, >> >> helloworld is working and the static files are reachable, >> but I needed to add the WEB-INF/ruby/builtin directory into >> the helloworld dir and add the loadpath in the RailsServlet >> >> // setup the load paths >> List loadPaths = new ArrayList(); >> loadPaths.add(railsRoot); >> loadPaths.add(getPath("/WEB-INF/ruby")); >> >> I'm not using maven (I don't have it installed yet) so the dir thing >> is settled by it, I just don't know. >> >> Cheers, >> Fausto >> >> On 11/12/06, Robert Egglestone wrote: >> >> >> Hi all, >> >> I've checked the latest version of the initial WAR code I had into the >> subversion repository at: >> svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >> >> It currently contains two parts: >> + rails-integration is a JAR library, which contains RailsServlet, >> FileServlet, and associated Ruby code. >> + samples/helloworld is a very simple Rails application plus >> WEB-INF/web.xml and pom.xml. >> >> If anyone could try it out and see if you run into any problems it would >> be much appreciated. >> >> Some of the changes from before: >> + Error messages are a lot better >> + Fausto's real path fix has been added in >> + The webapp directory layout is now the standard Rails one (This also >> means that mvn jetty:run can be used to run them in-place). >> + FileServlet has been added to handle static files >> >> Cheers, >> Robert >> >> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >> > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20061114/131fb82f/attachment-0001.html From Ashish.Sahni at Sun.COM Mon Nov 13 16:03:33 2006 From: Ashish.Sahni at Sun.COM (Ashish Sahni) Date: Mon, 13 Nov 2006 13:03:33 -0800 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <4557D399.5040301@cs.auckland.ac.nz> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> Message-ID: <4558DDA5.9050302@sun.com> Hi Robert, Thanks for all the great work ! I've been trying to get a rails app run as a web app, so this effort is awesome and I'm now able to get the helloworld sample working ;) Some comments/questions: - I think it would be useful it the jruby interpreter is acquire via the javax.scripting interface(jsr223 - new in mustang). I don't know if it'll be a seemless transition from the JavaEmbedUtils but should make things a lot more standardized. Ofcourse it require use of java 1.6 - The rails servlet executes just one ruby script - basically a combination of 'require config/environment' and 'require java_servlet_dispatcher' - Move all the ruby-rails files and directories under a single directory. CUrrently they are all in a top-level web application dir. So it would look something like -- WEB-INF -- railsFiles/app -- railsFiles/config -- railsFiles/components ... - Since I'm new to the ruby language and rails I'd like to understand how/where in the ruby framework do the javaRequest and javaResponse parameters in self.dispatch method in java-servlet-dipatcher code get created/bound to the underlying actual http-servlet request/response objects. Anyone ? Thanks Ashish Robert Egglestone wrote: > Ah, oops, it turns out I had the jars on my classpath. I've fixed up > the build file and readme with the changes, thanks. > > I'm not very familiar with rake, but certainly being able to package > everything up from a single command would make things easier. > > Cheers, > Robert > > Fausto Lelli wrote: > >>Hi Robert, >>an outstanding job as usual, just two things: >>1) in the ant file, also the servlet api jar need to included in the classpath >> jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot make the >> patch myself because I don't know the best way to deal this kind >> of dependence within maven) >>2)in the read me file, also remember to copy all the jruby related jar >> file in the lib directory of the webapp (jruby,asm,bsf ecc) >> >> >> >>>be able to contain these as well. Conceivably I guess we could even package >>>up gems as jar files to make self-contained web apps. >>> >>> >> >>Intriguing, really. >> >> >> >>>ideal either. We could suggest that if people intend the Rails app to be >>>mostly used with JRuby, then they rearrange the structure to move public to >>>the top. Alternatively, if they're wanting something that's compatible with >>>both Ruby and JRuby, then they go with FileServlet. >>> >>> >> >>Exactly. There's choices even! Anyway the FileServlet approach seems the more >>confortable at the moment, by far. My only concern is in the fact >>that, in the case >>that there a are lot (a lot!) of static files to be served, the >>FileServlet could be hit >>quite heavely, and this could degrade the overall performance. But >>probably this is >>just speculation and won't be a great problem in practice. >> >>I also think that a rake goal to procude a war-packaged rails app is >>waiting at the >>door, do you think ;-) ? >> >>Fausto >> >> >>On 11/12/06, Robert Egglestone wrote: >> >> >>> Hi Fausto, >>> >>> Thanks for trying it out. I've added in an Ant build file which should make >>>things easier. >>> >>> I was expecting to have to use /WEB-INF/ruby, but it turns out that JRuby >>>can get the .rb file from inside jars, so the rails-integration jar should >>>be able to contain these as well. Conceivably I guess we could even package >>>up gems as jar files to make self-contained web apps. >>> >>> I'm not sure about the best way to deal with the static files. The >>>FileServlet approach isn't great, however rearranging the Rails app isn't >>>ideal either. We could suggest that if people intend the Rails app to be >>>mostly used with JRuby, then they rearrange the structure to move public to >>>the top. Alternatively, if they're wanting something that's compatible with >>>both Ruby and JRuby, then they go with FileServlet. >>> >>> Cheers, >>> Robert >>> >>> >>> >>> Fausto Lelli wrote: >>> Hi Robert, >>> >>>helloworld is working and the static files are reachable, >>>but I needed to add the WEB-INF/ruby/builtin directory into >>>the helloworld dir and add the loadpath in the RailsServlet >>> >>> // setup the load paths >>> List loadPaths = new ArrayList(); >>> loadPaths.add(railsRoot); >>> loadPaths.add(getPath("/WEB-INF/ruby")); >>> >>>I'm not using maven (I don't have it installed yet) so the dir thing >>>is settled by it, I just don't know. >>> >>>Cheers, >>>Fausto >>> >>>On 11/12/06, Robert Egglestone wrote: >>> >>> >>> Hi all, >>> >>>I've checked the latest version of the initial WAR code I had into the >>>subversion repository at: >>>svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>> >>>It currently contains two parts: >>>+ rails-integration is a JAR library, which contains RailsServlet, >>>FileServlet, and associated Ruby code. >>>+ samples/helloworld is a very simple Rails application plus >>>WEB-INF/web.xml and pom.xml. >>> >>>If anyone could try it out and see if you run into any problems it would >>>be much appreciated. >>> >>>Some of the changes from before: >>>+ Error messages are a lot better >>>+ Fausto's real path fix has been added in >>>+ The webapp directory layout is now the standard Rails one (This also >>>means that mvn jetty:run can be used to run them in-place). >>>+ FileServlet has been added to handle static files >>> >>>Cheers, >>>Robert >>> >>> >>>_______________________________________________ >>>Jruby-extras-devel mailing list >>>Jruby-extras-devel at rubyforge.org >>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >>> _______________________________________________ >>>Jruby-extras-devel mailing list >>>Jruby-extras-devel at rubyforge.org >>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >>>_______________________________________________ >>>Jruby-extras-devel mailing list >>>Jruby-extras-devel at rubyforge.org >>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >>> >>> >>_______________________________________________ >>Jruby-extras-devel mailing list >>Jruby-extras-devel at rubyforge.org >>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >------------------------------------------------------------------------ > >_______________________________________________ >Jruby-extras-devel mailing list >Jruby-extras-devel at rubyforge.org >http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > From robert at cs.auckland.ac.nz Mon Nov 13 16:50:41 2006 From: robert at cs.auckland.ac.nz (Robert Egglestone) Date: Tue, 14 Nov 2006 10:50:41 +1300 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <4558DDA5.9050302@sun.com> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> Message-ID: <4558E8B1.7020208@cs.auckland.ac.nz> Hi Ashish, Merging more of the rails servlet work into the ruby side makes sense, I'll look into it. Inside a war file we could put all the rails files into a directory (previously they were in WEB-INF/rails), however for an exploded webapp it may become a problem for anyone that wants to take an existing rails application and use it with jruby without changing the existing structure. javaRequest and javaResponse are the actual servlet request/response objects. They're passed through from the RailsServlet: protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Object[] args = { request, response }; JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, void.class); } I believe JavaEmbedUtils wraps them in RubyObjects so that they can be used directly in Ruby code. Cheers, Robert Ashish Sahni wrote: > Hi Robert, > Thanks for all the great work ! I've been trying to get a rails app > run as a web app, so this > effort is awesome and I'm now able to get the helloworld sample > working ;) > > Some comments/questions: > - I think it would be useful it the jruby interpreter is acquire via > the javax.scripting interface(jsr223 - new in > mustang). I don't know if it'll be a seemless transition from the > JavaEmbedUtils but should make things a lot > more standardized. Ofcourse it require use of java 1.6 > - The rails servlet executes just one ruby script - basically a > combination of 'require config/environment' > and 'require java_servlet_dispatcher' > - Move all the ruby-rails files and directories under a single > directory. CUrrently they are all in a top-level > web application dir. So it would look something like > -- WEB-INF > -- railsFiles/app > -- railsFiles/config > -- railsFiles/components ... > - Since I'm new to the ruby language and rails I'd like to understand > how/where in the ruby framework > do the javaRequest and javaResponse parameters in self.dispatch method > in java-servlet-dipatcher code > get created/bound to the underlying actual http-servlet > request/response objects. Anyone ? > > Thanks > Ashish > > > > Robert Egglestone wrote: > >> Ah, oops, it turns out I had the jars on my classpath. I've fixed up >> the build file and readme with the changes, thanks. >> >> I'm not very familiar with rake, but certainly being able to package >> everything up from a single command would make things easier. >> >> Cheers, >> Robert >> >> Fausto Lelli wrote: >> >>> Hi Robert, >>> an outstanding job as usual, just two things: >>> 1) in the ant file, also the servlet api jar need to included in the >>> classpath >>> jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot >>> make the >>> patch myself because I don't know the best way to deal this kind >>> of dependence within maven) >>> 2)in the read me file, also remember to copy all the jruby related jar >>> file in the lib directory of the webapp (jruby,asm,bsf ecc) >>> >>> >>> >>>> be able to contain these as well. Conceivably I guess we could even >>>> package >>>> up gems as jar files to make self-contained web apps. >>>> >>> >>> Intriguing, really. >>> >>> >>> >>>> ideal either. We could suggest that if people intend the Rails app >>>> to be >>>> mostly used with JRuby, then they rearrange the structure to move >>>> public to >>>> the top. Alternatively, if they're wanting something that's >>>> compatible with >>>> both Ruby and JRuby, then they go with FileServlet. >>>> >>> >>> Exactly. There's choices even! Anyway the FileServlet approach >>> seems the more >>> confortable at the moment, by far. My only concern is in the fact >>> that, in the case >>> that there a are lot (a lot!) of static files to be served, the >>> FileServlet could be hit >>> quite heavely, and this could degrade the overall performance. But >>> probably this is >>> just speculation and won't be a great problem in practice. >>> >>> I also think that a rake goal to procude a war-packaged rails app is >>> waiting at the >>> door, do you think ;-) ? >>> >>> Fausto >>> >>> >>> On 11/12/06, Robert Egglestone wrote: >>> >>> >>>> Hi Fausto, >>>> >>>> Thanks for trying it out. I've added in an Ant build file which >>>> should make >>>> things easier. >>>> >>>> I was expecting to have to use /WEB-INF/ruby, but it turns out that >>>> JRuby >>>> can get the .rb file from inside jars, so the rails-integration jar >>>> should >>>> be able to contain these as well. Conceivably I guess we could even >>>> package >>>> up gems as jar files to make self-contained web apps. >>>> >>>> I'm not sure about the best way to deal with the static files. The >>>> FileServlet approach isn't great, however rearranging the Rails app >>>> isn't >>>> ideal either. We could suggest that if people intend the Rails app >>>> to be >>>> mostly used with JRuby, then they rearrange the structure to move >>>> public to >>>> the top. Alternatively, if they're wanting something that's >>>> compatible with >>>> both Ruby and JRuby, then they go with FileServlet. >>>> >>>> Cheers, >>>> Robert >>>> >>>> >>>> >>>> Fausto Lelli wrote: >>>> Hi Robert, >>>> >>>> helloworld is working and the static files are reachable, >>>> but I needed to add the WEB-INF/ruby/builtin directory into >>>> the helloworld dir and add the loadpath in the RailsServlet >>>> >>>> // setup the load paths >>>> List loadPaths = new ArrayList(); >>>> loadPaths.add(railsRoot); >>>> loadPaths.add(getPath("/WEB-INF/ruby")); >>>> >>>> I'm not using maven (I don't have it installed yet) so the dir thing >>>> is settled by it, I just don't know. >>>> >>>> Cheers, >>>> Fausto >>>> >>>> On 11/12/06, Robert Egglestone wrote: >>>> >>>> >>>> Hi all, >>>> >>>> I've checked the latest version of the initial WAR code I had into the >>>> subversion repository at: >>>> svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>>> >>>> It currently contains two parts: >>>> + rails-integration is a JAR library, which contains RailsServlet, >>>> FileServlet, and associated Ruby code. >>>> + samples/helloworld is a very simple Rails application plus >>>> WEB-INF/web.xml and pom.xml. >>>> >>>> If anyone could try it out and see if you run into any problems it >>>> would >>>> be much appreciated. >>>> >>>> Some of the changes from before: >>>> + Error messages are a lot better >>>> + Fausto's real path fix has been added in >>>> + The webapp directory layout is now the standard Rails one (This also >>>> means that mvn jetty:run can be used to run them in-place). >>>> + FileServlet has been added to handle static files >>>> >>>> Cheers, >>>> Robert >>>> >>>> >>>> _______________________________________________ >>>> Jruby-extras-devel mailing list >>>> Jruby-extras-devel at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>> >>>> >>>> _______________________________________________ >>>> Jruby-extras-devel mailing list >>>> Jruby-extras-devel at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>> >>>> >>>> _______________________________________________ >>>> Jruby-extras-devel mailing list >>>> Jruby-extras-devel at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>> >>>> >>>> >>> _______________________________________________ >>> Jruby-extras-devel mailing list >>> Jruby-extras-devel at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> > From Ashish.Sahni at Sun.COM Mon Nov 13 17:32:50 2006 From: Ashish.Sahni at Sun.COM (Ashish Sahni) Date: Mon, 13 Nov 2006 14:32:50 -0800 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <4558E8B1.7020208@cs.auckland.ac.nz> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> Message-ID: <4558F292.6030801@sun.com> (snip) > javaRequest and javaResponse are the actual servlet request/response > objects. They're passed through from the RailsServlet: > protected void service(HttpServletRequest request, HttpServletResponse > response) throws ServletException, IOException { > Object[] args = { request, response }; > JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, > void.class); > } > I believe JavaEmbedUtils wraps them in RubyObjects so that they can be > used directly in Ruby code. Aah ! I don't know how I missed this. Thanks for the explanation ! -Ashish > > Cheers, > Robert > > Ashish Sahni wrote: > >> Hi Robert, >> Thanks for all the great work ! I've been trying to get a rails app >> run as a web app, so this >> effort is awesome and I'm now able to get the helloworld sample >> working ;) >> >> Some comments/questions: >> - I think it would be useful it the jruby interpreter is acquire via >> the javax.scripting interface(jsr223 - new in >> mustang). I don't know if it'll be a seemless transition from the >> JavaEmbedUtils but should make things a lot >> more standardized. Ofcourse it require use of java 1.6 >> - The rails servlet executes just one ruby script - basically a >> combination of 'require config/environment' >> and 'require java_servlet_dispatcher' >> - Move all the ruby-rails files and directories under a single >> directory. CUrrently they are all in a top-level >> web application dir. So it would look something like >> -- WEB-INF >> -- railsFiles/app >> -- railsFiles/config >> -- railsFiles/components ... >> - Since I'm new to the ruby language and rails I'd like to understand >> how/where in the ruby framework >> do the javaRequest and javaResponse parameters in self.dispatch >> method in java-servlet-dipatcher code >> get created/bound to the underlying actual http-servlet >> request/response objects. Anyone ? >> >> Thanks >> Ashish >> >> >> >> Robert Egglestone wrote: >> >>> Ah, oops, it turns out I had the jars on my classpath. I've fixed up >>> the build file and readme with the changes, thanks. >>> >>> I'm not very familiar with rake, but certainly being able to package >>> everything up from a single command would make things easier. >>> >>> Cheers, >>> Robert >>> >>> Fausto Lelli wrote: >>> >>>> Hi Robert, >>>> an outstanding job as usual, just two things: >>>> 1) in the ant file, also the servlet api jar need to included in >>>> the classpath >>>> jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot >>>> make the >>>> patch myself because I don't know the best way to deal this kind >>>> of dependence within maven) >>>> 2)in the read me file, also remember to copy all the jruby related jar >>>> file in the lib directory of the webapp (jruby,asm,bsf ecc) >>>> >>>> >>>> >>>>> be able to contain these as well. Conceivably I guess we could >>>>> even package >>>>> up gems as jar files to make self-contained web apps. >>>>> >>>> >>>> >>>> Intriguing, really. >>>> >>>> >>>> >>>>> ideal either. We could suggest that if people intend the Rails app >>>>> to be >>>>> mostly used with JRuby, then they rearrange the structure to move >>>>> public to >>>>> the top. Alternatively, if they're wanting something that's >>>>> compatible with >>>>> both Ruby and JRuby, then they go with FileServlet. >>>>> >>>> >>>> >>>> Exactly. There's choices even! Anyway the FileServlet approach >>>> seems the more >>>> confortable at the moment, by far. My only concern is in the fact >>>> that, in the case >>>> that there a are lot (a lot!) of static files to be served, the >>>> FileServlet could be hit >>>> quite heavely, and this could degrade the overall performance. But >>>> probably this is >>>> just speculation and won't be a great problem in practice. >>>> >>>> I also think that a rake goal to procude a war-packaged rails app is >>>> waiting at the >>>> door, do you think ;-) ? >>>> >>>> Fausto >>>> >>>> >>>> On 11/12/06, Robert Egglestone wrote: >>>> >>>> >>>>> Hi Fausto, >>>>> >>>>> Thanks for trying it out. I've added in an Ant build file which >>>>> should make >>>>> things easier. >>>>> >>>>> I was expecting to have to use /WEB-INF/ruby, but it turns out >>>>> that JRuby >>>>> can get the .rb file from inside jars, so the rails-integration >>>>> jar should >>>>> be able to contain these as well. Conceivably I guess we could >>>>> even package >>>>> up gems as jar files to make self-contained web apps. >>>>> >>>>> I'm not sure about the best way to deal with the static files. The >>>>> FileServlet approach isn't great, however rearranging the Rails >>>>> app isn't >>>>> ideal either. We could suggest that if people intend the Rails app >>>>> to be >>>>> mostly used with JRuby, then they rearrange the structure to move >>>>> public to >>>>> the top. Alternatively, if they're wanting something that's >>>>> compatible with >>>>> both Ruby and JRuby, then they go with FileServlet. >>>>> >>>>> Cheers, >>>>> Robert >>>>> >>>>> >>>>> >>>>> Fausto Lelli wrote: >>>>> Hi Robert, >>>>> >>>>> helloworld is working and the static files are reachable, >>>>> but I needed to add the WEB-INF/ruby/builtin directory into >>>>> the helloworld dir and add the loadpath in the RailsServlet >>>>> >>>>> // setup the load paths >>>>> List loadPaths = new ArrayList(); >>>>> loadPaths.add(railsRoot); >>>>> loadPaths.add(getPath("/WEB-INF/ruby")); >>>>> >>>>> I'm not using maven (I don't have it installed yet) so the dir thing >>>>> is settled by it, I just don't know. >>>>> >>>>> Cheers, >>>>> Fausto >>>>> >>>>> On 11/12/06, Robert Egglestone wrote: >>>>> >>>>> >>>>> Hi all, >>>>> >>>>> I've checked the latest version of the initial WAR code I had into >>>>> the >>>>> subversion repository at: >>>>> svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>>>> >>>>> It currently contains two parts: >>>>> + rails-integration is a JAR library, which contains RailsServlet, >>>>> FileServlet, and associated Ruby code. >>>>> + samples/helloworld is a very simple Rails application plus >>>>> WEB-INF/web.xml and pom.xml. >>>>> >>>>> If anyone could try it out and see if you run into any problems it >>>>> would >>>>> be much appreciated. >>>>> >>>>> Some of the changes from before: >>>>> + Error messages are a lot better >>>>> + Fausto's real path fix has been added in >>>>> + The webapp directory layout is now the standard Rails one (This >>>>> also >>>>> means that mvn jetty:run can be used to run them in-place). >>>>> + FileServlet has been added to handle static files >>>>> >>>>> Cheers, >>>>> Robert >>>>> >>>>> >>>>> _______________________________________________ >>>>> Jruby-extras-devel mailing list >>>>> Jruby-extras-devel at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>> _______________________________________________ >>>>> Jruby-extras-devel mailing list >>>>> Jruby-extras-devel at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>> _______________________________________________ >>>>> Jruby-extras-devel mailing list >>>>> Jruby-extras-devel at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> Jruby-extras-devel mailing list >>>> Jruby-extras-devel at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>> >>>> >>> ------------------------------------------------------------------------ >>> >>> >>> _______________________________________________ >>> Jruby-extras-devel mailing list >>> Jruby-extras-devel at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >> From tom.enebo at gmail.com Mon Nov 13 19:38:26 2006 From: tom.enebo at gmail.com (Thomas E Enebo) Date: Mon, 13 Nov 2006 18:38:26 -0600 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <4558F292.6030801@sun.com> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> <4558F292.6030801@sun.com> Message-ID: <21ef583e0611131638t3ac230f5tfe4920f658b94812@mail.gmail.com> On 11/13/06, Ashish Sahni wrote: > (snip) > > > javaRequest and javaResponse are the actual servlet request/response > > objects. They're passed through from the RailsServlet: > > protected void service(HttpServletRequest request, HttpServletResponse > > response) throws ServletException, IOException { > > Object[] args = { request, response }; > > JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, > > void.class); > > } > > I believe JavaEmbedUtils wraps them in RubyObjects so that they can be > > used directly in Ruby code. > > Aah ! I don't know how I missed this. Thanks for the explanation ! > I wrote JavaEmbedUtils in a hurry before JavaOne to try and consolidate the logic between BSF and JSR223 implementations. If people have ideas on improving it or discover things that should be in it, then please either send an email to jruby dev mailing list or enter a Jira entry on your idea. -Tom -- Blog: http://www.bloglines.com/blog/ThomasEEnebo Email: enebo at acm.org , tom.enebo at gmail.com From Ashish.Sahni at Sun.COM Mon Nov 13 21:52:55 2006 From: Ashish.Sahni at Sun.COM (Ashish Sahni) Date: Mon, 13 Nov 2006 18:52:55 -0800 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <4558E8B1.7020208@cs.auckland.ac.nz> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> Message-ID: <45592F87.7030307@sun.com> Hi Folks, I'm able to connect a rails app deployed as a war file and it seems to be working (to an extent) ! The problem seems to be with the content-type of the http response. The browser is interpreting it as text/plain but it really is html content. Its deployed on glassfish appserver. Any ideas - is it a rails-on-jruby thingy or the container issue ? (snip) >Inside a war file we could put all the rails files into a directory >(previously they were in WEB-INF/rails), however for an exploded webapp >it may become a problem for anyone that wants to take an existing rails >application and use it with jruby without changing the existing structure. > > I don't quite see the problem you are referring to. Could you explain a bit more ? Thanks Ashish >javaRequest and javaResponse are the actual servlet request/response >objects. They're passed through from the RailsServlet: >protected void service(HttpServletRequest request, HttpServletResponse >response) throws ServletException, IOException { > Object[] args = { request, response }; > JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, >void.class); >} >I believe JavaEmbedUtils wraps them in RubyObjects so that they can be >used directly in Ruby code. > >Cheers, >Robert > >Ashish Sahni wrote: > > >>Hi Robert, >>Thanks for all the great work ! I've been trying to get a rails app >>run as a web app, so this >>effort is awesome and I'm now able to get the helloworld sample >>working ;) >> >>Some comments/questions: >>- I think it would be useful it the jruby interpreter is acquire via >>the javax.scripting interface(jsr223 - new in >>mustang). I don't know if it'll be a seemless transition from the >>JavaEmbedUtils but should make things a lot >>more standardized. Ofcourse it require use of java 1.6 >>- The rails servlet executes just one ruby script - basically a >>combination of 'require config/environment' >>and 'require java_servlet_dispatcher' >>- Move all the ruby-rails files and directories under a single >>directory. CUrrently they are all in a top-level >> web application dir. So it would look something like >> -- WEB-INF >> -- railsFiles/app >> -- railsFiles/config >> -- railsFiles/components ... >>- Since I'm new to the ruby language and rails I'd like to understand >>how/where in the ruby framework >>do the javaRequest and javaResponse parameters in self.dispatch method >>in java-servlet-dipatcher code >>get created/bound to the underlying actual http-servlet >>request/response objects. Anyone ? >> >>Thanks >>Ashish >> >> >> >>Robert Egglestone wrote: >> >> >> >>>Ah, oops, it turns out I had the jars on my classpath. I've fixed up >>>the build file and readme with the changes, thanks. >>> >>>I'm not very familiar with rake, but certainly being able to package >>>everything up from a single command would make things easier. >>> >>>Cheers, >>>Robert >>> >>>Fausto Lelli wrote: >>> >>> >>> >>>>Hi Robert, >>>>an outstanding job as usual, just two things: >>>>1) in the ant file, also the servlet api jar need to included in the >>>>classpath >>>> jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot >>>>make the >>>> patch myself because I don't know the best way to deal this kind >>>> of dependence within maven) >>>>2)in the read me file, also remember to copy all the jruby related jar >>>> file in the lib directory of the webapp (jruby,asm,bsf ecc) >>>> >>>> >>>> >>>> >>>> >>>>>be able to contain these as well. Conceivably I guess we could even >>>>>package >>>>>up gems as jar files to make self-contained web apps. >>>>> >>>>> >>>>> >>>>Intriguing, really. >>>> >>>> >>>> >>>> >>>> >>>>>ideal either. We could suggest that if people intend the Rails app >>>>>to be >>>>>mostly used with JRuby, then they rearrange the structure to move >>>>>public to >>>>>the top. Alternatively, if they're wanting something that's >>>>>compatible with >>>>>both Ruby and JRuby, then they go with FileServlet. >>>>> >>>>> >>>>> >>>>Exactly. There's choices even! Anyway the FileServlet approach >>>>seems the more >>>>confortable at the moment, by far. My only concern is in the fact >>>>that, in the case >>>>that there a are lot (a lot!) of static files to be served, the >>>>FileServlet could be hit >>>>quite heavely, and this could degrade the overall performance. But >>>>probably this is >>>>just speculation and won't be a great problem in practice. >>>> >>>>I also think that a rake goal to procude a war-packaged rails app is >>>>waiting at the >>>>door, do you think ;-) ? >>>> >>>>Fausto >>>> >>>> >>>>On 11/12/06, Robert Egglestone wrote: >>>> >>>> >>>> >>>> >>>>>Hi Fausto, >>>>> >>>>>Thanks for trying it out. I've added in an Ant build file which >>>>>should make >>>>>things easier. >>>>> >>>>>I was expecting to have to use /WEB-INF/ruby, but it turns out that >>>>>JRuby >>>>>can get the .rb file from inside jars, so the rails-integration jar >>>>>should >>>>>be able to contain these as well. Conceivably I guess we could even >>>>>package >>>>>up gems as jar files to make self-contained web apps. >>>>> >>>>>I'm not sure about the best way to deal with the static files. The >>>>>FileServlet approach isn't great, however rearranging the Rails app >>>>>isn't >>>>>ideal either. We could suggest that if people intend the Rails app >>>>>to be >>>>>mostly used with JRuby, then they rearrange the structure to move >>>>>public to >>>>>the top. Alternatively, if they're wanting something that's >>>>>compatible with >>>>>both Ruby and JRuby, then they go with FileServlet. >>>>> >>>>>Cheers, >>>>>Robert >>>>> >>>>> >>>>> >>>>>Fausto Lelli wrote: >>>>>Hi Robert, >>>>> >>>>>helloworld is working and the static files are reachable, >>>>>but I needed to add the WEB-INF/ruby/builtin directory into >>>>>the helloworld dir and add the loadpath in the RailsServlet >>>>> >>>>>// setup the load paths >>>>>List loadPaths = new ArrayList(); >>>>>loadPaths.add(railsRoot); >>>>>loadPaths.add(getPath("/WEB-INF/ruby")); >>>>> >>>>>I'm not using maven (I don't have it installed yet) so the dir thing >>>>>is settled by it, I just don't know. >>>>> >>>>>Cheers, >>>>>Fausto >>>>> >>>>>On 11/12/06, Robert Egglestone wrote: >>>>> >>>>> >>>>>Hi all, >>>>> >>>>>I've checked the latest version of the initial WAR code I had into the >>>>>subversion repository at: >>>>>svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>>>> >>>>>It currently contains two parts: >>>>>+ rails-integration is a JAR library, which contains RailsServlet, >>>>>FileServlet, and associated Ruby code. >>>>>+ samples/helloworld is a very simple Rails application plus >>>>>WEB-INF/web.xml and pom.xml. >>>>> >>>>>If anyone could try it out and see if you run into any problems it >>>>>would >>>>>be much appreciated. >>>>> >>>>>Some of the changes from before: >>>>>+ Error messages are a lot better >>>>>+ Fausto's real path fix has been added in >>>>>+ The webapp directory layout is now the standard Rails one (This also >>>>>means that mvn jetty:run can be used to run them in-place). >>>>>+ FileServlet has been added to handle static files >>>>> >>>>>Cheers, >>>>>Robert >>>>> >>>>> >>>>>_______________________________________________ >>>>>Jruby-extras-devel mailing list >>>>>Jruby-extras-devel at rubyforge.org >>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>>_______________________________________________ >>>>>Jruby-extras-devel mailing list >>>>>Jruby-extras-devel at rubyforge.org >>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>>_______________________________________________ >>>>>Jruby-extras-devel mailing list >>>>>Jruby-extras-devel at rubyforge.org >>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>> >>>>> >>>>> >>>>_______________________________________________ >>>>Jruby-extras-devel mailing list >>>>Jruby-extras-devel at rubyforge.org >>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>> >>>> >>>> >>>> >>>------------------------------------------------------------------------ >>> >>>_______________________________________________ >>>Jruby-extras-devel mailing list >>>Jruby-extras-devel at rubyforge.org >>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >>> >>> >_______________________________________________ >Jruby-extras-devel mailing list >Jruby-extras-devel at rubyforge.org >http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > From Ashish.Sahni at Sun.COM Tue Nov 14 13:53:39 2006 From: Ashish.Sahni at Sun.COM (Ashish Sahni) Date: Tue, 14 Nov 2006 10:53:39 -0800 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <45592F87.7030307@sun.com> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> <45592F87.7030307@sun.com> Message-ID: <455A10B3.3090208@sun.com> Looks like the content-type thingy is a bit of both. The rails app/framework deployed as a war does not set the content-type header and so its up to the container to set the content-type in the response. Its a bit odd but I guess its a question for the rails-framework folks. Has anybody got a rails-app-as-a-war working with the db ? Viewing the db contents seems to be working but editing/creating does not. Anyone ? Thanks Ashish Ashish Sahni wrote: >Hi Folks, > >I'm able to connect a rails app deployed as a war file and it seems to >be working (to an extent) ! > >The problem seems to be with the content-type of the http response. The >browser >is interpreting it as text/plain but it really is html content. Its >deployed on glassfish appserver. >Any ideas - is it a rails-on-jruby thingy or the container issue ? > >(snip) > > > >>Inside a war file we could put all the rails files into a directory >>(previously they were in WEB-INF/rails), however for an exploded webapp >>it may become a problem for anyone that wants to take an existing rails >>application and use it with jruby without changing the existing structure. >> >> >> >> >I don't quite see the problem you are referring to. Could you explain a >bit more ? > >Thanks >Ashish > > > > >>javaRequest and javaResponse are the actual servlet request/response >>objects. They're passed through from the RailsServlet: >>protected void service(HttpServletRequest request, HttpServletResponse >>response) throws ServletException, IOException { >> Object[] args = { request, response }; >> JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, >>void.class); >>} >>I believe JavaEmbedUtils wraps them in RubyObjects so that they can be >>used directly in Ruby code. >> >>Cheers, >>Robert >> >>Ashish Sahni wrote: >> >> >> >> >>>Hi Robert, >>>Thanks for all the great work ! I've been trying to get a rails app >>>run as a web app, so this >>>effort is awesome and I'm now able to get the helloworld sample >>>working ;) >>> >>>Some comments/questions: >>>- I think it would be useful it the jruby interpreter is acquire via >>>the javax.scripting interface(jsr223 - new in >>>mustang). I don't know if it'll be a seemless transition from the >>>JavaEmbedUtils but should make things a lot >>>more standardized. Ofcourse it require use of java 1.6 >>>- The rails servlet executes just one ruby script - basically a >>>combination of 'require config/environment' >>>and 'require java_servlet_dispatcher' >>>- Move all the ruby-rails files and directories under a single >>>directory. CUrrently they are all in a top-level >>>web application dir. So it would look something like >>>-- WEB-INF >>>-- railsFiles/app >>>-- railsFiles/config >>>-- railsFiles/components ... >>>- Since I'm new to the ruby language and rails I'd like to understand >>>how/where in the ruby framework >>>do the javaRequest and javaResponse parameters in self.dispatch method >>>in java-servlet-dipatcher code >>>get created/bound to the underlying actual http-servlet >>>request/response objects. Anyone ? >>> >>>Thanks >>>Ashish >>> >>> >>> >>>Robert Egglestone wrote: >>> >>> >>> >>> >>> >>>>Ah, oops, it turns out I had the jars on my classpath. I've fixed up >>>>the build file and readme with the changes, thanks. >>>> >>>>I'm not very familiar with rake, but certainly being able to package >>>>everything up from a single command would make things easier. >>>> >>>>Cheers, >>>>Robert >>>> >>>>Fausto Lelli wrote: >>>> >>>> >>>> >>>> >>>> >>>>>Hi Robert, >>>>>an outstanding job as usual, just two things: >>>>>1) in the ant file, also the servlet api jar need to included in the >>>>>classpath >>>>> jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot >>>>>make the >>>>> patch myself because I don't know the best way to deal this kind >>>>> of dependence within maven) >>>>>2)in the read me file, also remember to copy all the jruby related jar >>>>> file in the lib directory of the webapp (jruby,asm,bsf ecc) >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>be able to contain these as well. Conceivably I guess we could even >>>>>>package >>>>>>up gems as jar files to make self-contained web apps. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>Intriguing, really. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>ideal either. We could suggest that if people intend the Rails app >>>>>>to be >>>>>>mostly used with JRuby, then they rearrange the structure to move >>>>>>public to >>>>>>the top. Alternatively, if they're wanting something that's >>>>>>compatible with >>>>>>both Ruby and JRuby, then they go with FileServlet. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>Exactly. There's choices even! Anyway the FileServlet approach >>>>>seems the more >>>>>confortable at the moment, by far. My only concern is in the fact >>>>>that, in the case >>>>>that there a are lot (a lot!) of static files to be served, the >>>>>FileServlet could be hit >>>>>quite heavely, and this could degrade the overall performance. But >>>>>probably this is >>>>>just speculation and won't be a great problem in practice. >>>>> >>>>>I also think that a rake goal to procude a war-packaged rails app is >>>>>waiting at the >>>>>door, do you think ;-) ? >>>>> >>>>>Fausto >>>>> >>>>> >>>>>On 11/12/06, Robert Egglestone wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>Hi Fausto, >>>>>> >>>>>>Thanks for trying it out. I've added in an Ant build file which >>>>>>should make >>>>>>things easier. >>>>>> >>>>>>I was expecting to have to use /WEB-INF/ruby, but it turns out that >>>>>>JRuby >>>>>>can get the .rb file from inside jars, so the rails-integration jar >>>>>>should >>>>>>be able to contain these as well. Conceivably I guess we could even >>>>>>package >>>>>>up gems as jar files to make self-contained web apps. >>>>>> >>>>>>I'm not sure about the best way to deal with the static files. The >>>>>>FileServlet approach isn't great, however rearranging the Rails app >>>>>>isn't >>>>>>ideal either. We could suggest that if people intend the Rails app >>>>>>to be >>>>>>mostly used with JRuby, then they rearrange the structure to move >>>>>>public to >>>>>>the top. Alternatively, if they're wanting something that's >>>>>>compatible with >>>>>>both Ruby and JRuby, then they go with FileServlet. >>>>>> >>>>>>Cheers, >>>>>>Robert >>>>>> >>>>>> >>>>>> >>>>>>Fausto Lelli wrote: >>>>>>Hi Robert, >>>>>> >>>>>>helloworld is working and the static files are reachable, >>>>>>but I needed to add the WEB-INF/ruby/builtin directory into >>>>>>the helloworld dir and add the loadpath in the RailsServlet >>>>>> >>>>>>// setup the load paths >>>>>>List loadPaths = new ArrayList(); >>>>>>loadPaths.add(railsRoot); >>>>>>loadPaths.add(getPath("/WEB-INF/ruby")); >>>>>> >>>>>>I'm not using maven (I don't have it installed yet) so the dir thing >>>>>>is settled by it, I just don't know. >>>>>> >>>>>>Cheers, >>>>>>Fausto >>>>>> >>>>>>On 11/12/06, Robert Egglestone wrote: >>>>>> >>>>>> >>>>>>Hi all, >>>>>> >>>>>>I've checked the latest version of the initial WAR code I had into the >>>>>>subversion repository at: >>>>>>svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>>>>> >>>>>>It currently contains two parts: >>>>>>+ rails-integration is a JAR library, which contains RailsServlet, >>>>>>FileServlet, and associated Ruby code. >>>>>>+ samples/helloworld is a very simple Rails application plus >>>>>>WEB-INF/web.xml and pom.xml. >>>>>> >>>>>>If anyone could try it out and see if you run into any problems it >>>>>>would >>>>>>be much appreciated. >>>>>> >>>>>>Some of the changes from before: >>>>>>+ Error messages are a lot better >>>>>>+ Fausto's real path fix has been added in >>>>>>+ The webapp directory layout is now the standard Rails one (This also >>>>>>means that mvn jetty:run can be used to run them in-place). >>>>>>+ FileServlet has been added to handle static files >>>>>> >>>>>>Cheers, >>>>>>Robert >>>>>> >>>>>> >>>>>>_______________________________________________ >>>>>>Jruby-extras-devel mailing list >>>>>>Jruby-extras-devel at rubyforge.org >>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>> >>>>>> >>>>>>_______________________________________________ >>>>>>Jruby-extras-devel mailing list >>>>>>Jruby-extras-devel at rubyforge.org >>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>> >>>>>> >>>>>>_______________________________________________ >>>>>>Jruby-extras-devel mailing list >>>>>>Jruby-extras-devel at rubyforge.org >>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>_______________________________________________ >>>>>Jruby-extras-devel mailing list >>>>>Jruby-extras-devel at rubyforge.org >>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>------------------------------------------------------------------------ >>>> >>>>_______________________________________________ >>>>Jruby-extras-devel mailing list >>>>Jruby-extras-devel at rubyforge.org >>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>> >>>> >>>> >>>> >>>> >>>> >>_______________________________________________ >>Jruby-extras-devel mailing list >>Jruby-extras-devel at rubyforge.org >>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >> >> > >_______________________________________________ >Jruby-extras-devel mailing list >Jruby-extras-devel at rubyforge.org >http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > From robert at cs.auckland.ac.nz Tue Nov 14 15:39:37 2006 From: robert at cs.auckland.ac.nz (Robert Egglestone) Date: Wed, 15 Nov 2006 09:39:37 +1300 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <455A10B3.3090208@sun.com> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> <45592F87.7030307@sun.com> <455A10B3.3090208@sun.com> Message-ID: <455A2989.8060104@cs.auckland.ac.nz> It looks like CgiResponse has some special handling of the content-type header that I missed out of JavaServletResponse. Cheers, Robert Ashish Sahni wrote: > Looks like the content-type thingy is a bit of both. The rails > app/framework deployed as a war > does not set the content-type header and so its up to the container to > set the content-type in > the response. Its a bit odd but I guess its a question for the > rails-framework folks. > > Has anybody got a rails-app-as-a-war working with the db ? Viewing the > db contents > seems to be working but editing/creating does not. Anyone ? > > Thanks > Ashish > > > > Ashish Sahni wrote: > > >> Hi Folks, >> >> I'm able to connect a rails app deployed as a war file and it seems to >> be working (to an extent) ! >> >> The problem seems to be with the content-type of the http response. The >> browser >> is interpreting it as text/plain but it really is html content. Its >> deployed on glassfish appserver. >> Any ideas - is it a rails-on-jruby thingy or the container issue ? >> >> (snip) >> >> >> >> >>> Inside a war file we could put all the rails files into a directory >>> (previously they were in WEB-INF/rails), however for an exploded webapp >>> it may become a problem for anyone that wants to take an existing rails >>> application and use it with jruby without changing the existing structure. >>> >>> >>> >>> >>> >> I don't quite see the problem you are referring to. Could you explain a >> bit more ? >> >> Thanks >> Ashish >> >> >> >> >> >>> javaRequest and javaResponse are the actual servlet request/response >>> objects. They're passed through from the RailsServlet: >>> protected void service(HttpServletRequest request, HttpServletResponse >>> response) throws ServletException, IOException { >>> Object[] args = { request, response }; >>> JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, >>> void.class); >>> } >>> I believe JavaEmbedUtils wraps them in RubyObjects so that they can be >>> used directly in Ruby code. >>> >>> Cheers, >>> Robert >>> >>> Ashish Sahni wrote: >>> >>> >>> >>> >>> >>>> Hi Robert, >>>> Thanks for all the great work ! I've been trying to get a rails app >>>> run as a web app, so this >>>> effort is awesome and I'm now able to get the helloworld sample >>>> working ;) >>>> >>>> Some comments/questions: >>>> - I think it would be useful it the jruby interpreter is acquire via >>>> the javax.scripting interface(jsr223 - new in >>>> mustang). I don't know if it'll be a seemless transition from the >>>> JavaEmbedUtils but should make things a lot >>>> more standardized. Ofcourse it require use of java 1.6 >>>> - The rails servlet executes just one ruby script - basically a >>>> combination of 'require config/environment' >>>> and 'require java_servlet_dispatcher' >>>> - Move all the ruby-rails files and directories under a single >>>> directory. CUrrently they are all in a top-level >>>> web application dir. So it would look something like >>>> -- WEB-INF >>>> -- railsFiles/app >>>> -- railsFiles/config >>>> -- railsFiles/components ... >>>> - Since I'm new to the ruby language and rails I'd like to understand >>>> how/where in the ruby framework >>>> do the javaRequest and javaResponse parameters in self.dispatch method >>>> in java-servlet-dipatcher code >>>> get created/bound to the underlying actual http-servlet >>>> request/response objects. Anyone ? >>>> >>>> Thanks >>>> Ashish >>>> >>>> >>>> >>>> Robert Egglestone wrote: >>>> >>>> >>>> >>>> >>>> >>>> >>>>> Ah, oops, it turns out I had the jars on my classpath. I've fixed up >>>>> the build file and readme with the changes, thanks. >>>>> >>>>> I'm not very familiar with rake, but certainly being able to package >>>>> everything up from a single command would make things easier. >>>>> >>>>> Cheers, >>>>> Robert >>>>> >>>>> Fausto Lelli wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> Hi Robert, >>>>>> an outstanding job as usual, just two things: >>>>>> 1) in the ant file, also the servlet api jar need to included in the >>>>>> classpath >>>>>> jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot >>>>>> make the >>>>>> patch myself because I don't know the best way to deal this kind >>>>>> of dependence within maven) >>>>>> 2)in the read me file, also remember to copy all the jruby related jar >>>>>> file in the lib directory of the webapp (jruby,asm,bsf ecc) >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> be able to contain these as well. Conceivably I guess we could even >>>>>>> package >>>>>>> up gems as jar files to make self-contained web apps. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> Intriguing, really. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> ideal either. We could suggest that if people intend the Rails app >>>>>>> to be >>>>>>> mostly used with JRuby, then they rearrange the structure to move >>>>>>> public to >>>>>>> the top. Alternatively, if they're wanting something that's >>>>>>> compatible with >>>>>>> both Ruby and JRuby, then they go with FileServlet. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> Exactly. There's choices even! Anyway the FileServlet approach >>>>>> seems the more >>>>>> confortable at the moment, by far. My only concern is in the fact >>>>>> that, in the case >>>>>> that there a are lot (a lot!) of static files to be served, the >>>>>> FileServlet could be hit >>>>>> quite heavely, and this could degrade the overall performance. But >>>>>> probably this is >>>>>> just speculation and won't be a great problem in practice. >>>>>> >>>>>> I also think that a rake goal to procude a war-packaged rails app is >>>>>> waiting at the >>>>>> door, do you think ;-) ? >>>>>> >>>>>> Fausto >>>>>> >>>>>> >>>>>> On 11/12/06, Robert Egglestone wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> Hi Fausto, >>>>>>> >>>>>>> Thanks for trying it out. I've added in an Ant build file which >>>>>>> should make >>>>>>> things easier. >>>>>>> >>>>>>> I was expecting to have to use /WEB-INF/ruby, but it turns out that >>>>>>> JRuby >>>>>>> can get the .rb file from inside jars, so the rails-integration jar >>>>>>> should >>>>>>> be able to contain these as well. Conceivably I guess we could even >>>>>>> package >>>>>>> up gems as jar files to make self-contained web apps. >>>>>>> >>>>>>> I'm not sure about the best way to deal with the static files. The >>>>>>> FileServlet approach isn't great, however rearranging the Rails app >>>>>>> isn't >>>>>>> ideal either. We could suggest that if people intend the Rails app >>>>>>> to be >>>>>>> mostly used with JRuby, then they rearrange the structure to move >>>>>>> public to >>>>>>> the top. Alternatively, if they're wanting something that's >>>>>>> compatible with >>>>>>> both Ruby and JRuby, then they go with FileServlet. >>>>>>> >>>>>>> Cheers, >>>>>>> Robert >>>>>>> >>>>>>> >>>>>>> >>>>>>> Fausto Lelli wrote: >>>>>>> Hi Robert, >>>>>>> >>>>>>> helloworld is working and the static files are reachable, >>>>>>> but I needed to add the WEB-INF/ruby/builtin directory into >>>>>>> the helloworld dir and add the loadpath in the RailsServlet >>>>>>> >>>>>>> // setup the load paths >>>>>>> List loadPaths = new ArrayList(); >>>>>>> loadPaths.add(railsRoot); >>>>>>> loadPaths.add(getPath("/WEB-INF/ruby")); >>>>>>> >>>>>>> I'm not using maven (I don't have it installed yet) so the dir thing >>>>>>> is settled by it, I just don't know. >>>>>>> >>>>>>> Cheers, >>>>>>> Fausto >>>>>>> >>>>>>> On 11/12/06, Robert Egglestone wrote: >>>>>>> >>>>>>> >>>>>>> Hi all, >>>>>>> >>>>>>> I've checked the latest version of the initial WAR code I had into the >>>>>>> subversion repository at: >>>>>>> svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>>>>>> >>>>>>> It currently contains two parts: >>>>>>> + rails-integration is a JAR library, which contains RailsServlet, >>>>>>> FileServlet, and associated Ruby code. >>>>>>> + samples/helloworld is a very simple Rails application plus >>>>>>> WEB-INF/web.xml and pom.xml. >>>>>>> >>>>>>> If anyone could try it out and see if you run into any problems it >>>>>>> would >>>>>>> be much appreciated. >>>>>>> >>>>>>> Some of the changes from before: >>>>>>> + Error messages are a lot better >>>>>>> + Fausto's real path fix has been added in >>>>>>> + The webapp directory layout is now the standard Rails one (This also >>>>>>> means that mvn jetty:run can be used to run them in-place). >>>>>>> + FileServlet has been added to handle static files >>>>>>> >>>>>>> Cheers, >>>>>>> Robert >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Jruby-extras-devel mailing list >>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Jruby-extras-devel mailing list >>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Jruby-extras-devel mailing list >>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> _______________________________________________ >>>>>> Jruby-extras-devel mailing list >>>>>> Jruby-extras-devel at rubyforge.org >>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> _______________________________________________ >>>>> Jruby-extras-devel mailing list >>>>> Jruby-extras-devel at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>> _______________________________________________ >>> Jruby-extras-devel mailing list >>> Jruby-extras-devel at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >>> >>> >>> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >> > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20061115/3b706b44/attachment-0001.html From robert at cs.auckland.ac.nz Tue Nov 14 17:40:03 2006 From: robert at cs.auckland.ac.nz (Robert Egglestone) Date: Wed, 15 Nov 2006 11:40:03 +1300 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <455A10B3.3090208@sun.com> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> <45592F87.7030307@sun.com> <455A10B3.3090208@sun.com> Message-ID: <455A45C3.10803@cs.auckland.ac.nz> I've checked in a change that should fix problems with the content-type and status code in the responses. Cheers, Robert Ashish Sahni wrote: > Looks like the content-type thingy is a bit of both. The rails > app/framework deployed as a war > does not set the content-type header and so its up to the container to > set the content-type in > the response. Its a bit odd but I guess its a question for the > rails-framework folks. > > Has anybody got a rails-app-as-a-war working with the db ? Viewing the > db contents > seems to be working but editing/creating does not. Anyone ? > > Thanks > Ashish > > > > Ashish Sahni wrote: > > >> Hi Folks, >> >> I'm able to connect a rails app deployed as a war file and it seems to >> be working (to an extent) ! >> >> The problem seems to be with the content-type of the http response. The >> browser >> is interpreting it as text/plain but it really is html content. Its >> deployed on glassfish appserver. >> Any ideas - is it a rails-on-jruby thingy or the container issue ? >> >> (snip) >> >> >> >> >>> Inside a war file we could put all the rails files into a directory >>> (previously they were in WEB-INF/rails), however for an exploded webapp >>> it may become a problem for anyone that wants to take an existing rails >>> application and use it with jruby without changing the existing structure. >>> >>> >>> >>> >>> >> I don't quite see the problem you are referring to. Could you explain a >> bit more ? >> >> Thanks >> Ashish >> >> >> >> >> >>> javaRequest and javaResponse are the actual servlet request/response >>> objects. They're passed through from the RailsServlet: >>> protected void service(HttpServletRequest request, HttpServletResponse >>> response) throws ServletException, IOException { >>> Object[] args = { request, response }; >>> JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, >>> void.class); >>> } >>> I believe JavaEmbedUtils wraps them in RubyObjects so that they can be >>> used directly in Ruby code. >>> >>> Cheers, >>> Robert >>> >>> Ashish Sahni wrote: >>> >>> >>> >>> >>> >>>> Hi Robert, >>>> Thanks for all the great work ! I've been trying to get a rails app >>>> run as a web app, so this >>>> effort is awesome and I'm now able to get the helloworld sample >>>> working ;) >>>> >>>> Some comments/questions: >>>> - I think it would be useful it the jruby interpreter is acquire via >>>> the javax.scripting interface(jsr223 - new in >>>> mustang). I don't know if it'll be a seemless transition from the >>>> JavaEmbedUtils but should make things a lot >>>> more standardized. Ofcourse it require use of java 1.6 >>>> - The rails servlet executes just one ruby script - basically a >>>> combination of 'require config/environment' >>>> and 'require java_servlet_dispatcher' >>>> - Move all the ruby-rails files and directories under a single >>>> directory. CUrrently they are all in a top-level >>>> web application dir. So it would look something like >>>> -- WEB-INF >>>> -- railsFiles/app >>>> -- railsFiles/config >>>> -- railsFiles/components ... >>>> - Since I'm new to the ruby language and rails I'd like to understand >>>> how/where in the ruby framework >>>> do the javaRequest and javaResponse parameters in self.dispatch method >>>> in java-servlet-dipatcher code >>>> get created/bound to the underlying actual http-servlet >>>> request/response objects. Anyone ? >>>> >>>> Thanks >>>> Ashish >>>> >>>> >>>> >>>> Robert Egglestone wrote: >>>> >>>> >>>> >>>> >>>> >>>> >>>>> Ah, oops, it turns out I had the jars on my classpath. I've fixed up >>>>> the build file and readme with the changes, thanks. >>>>> >>>>> I'm not very familiar with rake, but certainly being able to package >>>>> everything up from a single command would make things easier. >>>>> >>>>> Cheers, >>>>> Robert >>>>> >>>>> Fausto Lelli wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> Hi Robert, >>>>>> an outstanding job as usual, just two things: >>>>>> 1) in the ant file, also the servlet api jar need to included in the >>>>>> classpath >>>>>> jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot >>>>>> make the >>>>>> patch myself because I don't know the best way to deal this kind >>>>>> of dependence within maven) >>>>>> 2)in the read me file, also remember to copy all the jruby related jar >>>>>> file in the lib directory of the webapp (jruby,asm,bsf ecc) >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> be able to contain these as well. Conceivably I guess we could even >>>>>>> package >>>>>>> up gems as jar files to make self-contained web apps. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> Intriguing, really. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> ideal either. We could suggest that if people intend the Rails app >>>>>>> to be >>>>>>> mostly used with JRuby, then they rearrange the structure to move >>>>>>> public to >>>>>>> the top. Alternatively, if they're wanting something that's >>>>>>> compatible with >>>>>>> both Ruby and JRuby, then they go with FileServlet. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> Exactly. There's choices even! Anyway the FileServlet approach >>>>>> seems the more >>>>>> confortable at the moment, by far. My only concern is in the fact >>>>>> that, in the case >>>>>> that there a are lot (a lot!) of static files to be served, the >>>>>> FileServlet could be hit >>>>>> quite heavely, and this could degrade the overall performance. But >>>>>> probably this is >>>>>> just speculation and won't be a great problem in practice. >>>>>> >>>>>> I also think that a rake goal to procude a war-packaged rails app is >>>>>> waiting at the >>>>>> door, do you think ;-) ? >>>>>> >>>>>> Fausto >>>>>> >>>>>> >>>>>> On 11/12/06, Robert Egglestone wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> Hi Fausto, >>>>>>> >>>>>>> Thanks for trying it out. I've added in an Ant build file which >>>>>>> should make >>>>>>> things easier. >>>>>>> >>>>>>> I was expecting to have to use /WEB-INF/ruby, but it turns out that >>>>>>> JRuby >>>>>>> can get the .rb file from inside jars, so the rails-integration jar >>>>>>> should >>>>>>> be able to contain these as well. Conceivably I guess we could even >>>>>>> package >>>>>>> up gems as jar files to make self-contained web apps. >>>>>>> >>>>>>> I'm not sure about the best way to deal with the static files. The >>>>>>> FileServlet approach isn't great, however rearranging the Rails app >>>>>>> isn't >>>>>>> ideal either. We could suggest that if people intend the Rails app >>>>>>> to be >>>>>>> mostly used with JRuby, then they rearrange the structure to move >>>>>>> public to >>>>>>> the top. Alternatively, if they're wanting something that's >>>>>>> compatible with >>>>>>> both Ruby and JRuby, then they go with FileServlet. >>>>>>> >>>>>>> Cheers, >>>>>>> Robert >>>>>>> >>>>>>> >>>>>>> >>>>>>> Fausto Lelli wrote: >>>>>>> Hi Robert, >>>>>>> >>>>>>> helloworld is working and the static files are reachable, >>>>>>> but I needed to add the WEB-INF/ruby/builtin directory into >>>>>>> the helloworld dir and add the loadpath in the RailsServlet >>>>>>> >>>>>>> // setup the load paths >>>>>>> List loadPaths = new ArrayList(); >>>>>>> loadPaths.add(railsRoot); >>>>>>> loadPaths.add(getPath("/WEB-INF/ruby")); >>>>>>> >>>>>>> I'm not using maven (I don't have it installed yet) so the dir thing >>>>>>> is settled by it, I just don't know. >>>>>>> >>>>>>> Cheers, >>>>>>> Fausto >>>>>>> >>>>>>> On 11/12/06, Robert Egglestone wrote: >>>>>>> >>>>>>> >>>>>>> Hi all, >>>>>>> >>>>>>> I've checked the latest version of the initial WAR code I had into the >>>>>>> subversion repository at: >>>>>>> svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>>>>>> >>>>>>> It currently contains two parts: >>>>>>> + rails-integration is a JAR library, which contains RailsServlet, >>>>>>> FileServlet, and associated Ruby code. >>>>>>> + samples/helloworld is a very simple Rails application plus >>>>>>> WEB-INF/web.xml and pom.xml. >>>>>>> >>>>>>> If anyone could try it out and see if you run into any problems it >>>>>>> would >>>>>>> be much appreciated. >>>>>>> >>>>>>> Some of the changes from before: >>>>>>> + Error messages are a lot better >>>>>>> + Fausto's real path fix has been added in >>>>>>> + The webapp directory layout is now the standard Rails one (This also >>>>>>> means that mvn jetty:run can be used to run them in-place). >>>>>>> + FileServlet has been added to handle static files >>>>>>> >>>>>>> Cheers, >>>>>>> Robert >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Jruby-extras-devel mailing list >>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Jruby-extras-devel mailing list >>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Jruby-extras-devel mailing list >>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> _______________________________________________ >>>>>> Jruby-extras-devel mailing list >>>>>> Jruby-extras-devel at rubyforge.org >>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> _______________________________________________ >>>>> Jruby-extras-devel mailing list >>>>> Jruby-extras-devel at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>> _______________________________________________ >>> Jruby-extras-devel mailing list >>> Jruby-extras-devel at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >>> >>> >>> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >> > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20061115/aa6b1043/attachment.html From superchrisnelson at gmail.com Tue Nov 14 20:02:38 2006 From: superchrisnelson at gmail.com (Chris Nelson) Date: Tue, 14 Nov 2006 20:02:38 -0500 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <4558D2A6.6070300@cs.auckland.ac.nz> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558D2A6.6070300@cs.auckland.ac.nz> Message-ID: Done! On 11/13/06, Robert Egglestone wrote: > > Hi Chris, > > Thanks for testing it out. Would it be possible to check in the Rails app > as another sample so we can work through the problems? > > Cheers, > Robert > > > > Chris Nelson wrote: > Well, I was able to get a simple Rails app with some simple > scaffolding to load, but it didn't seem to quite work correctly. It > would save records, but not seem to take any values from the screen. > In the database it would create a record with nulls in all the > columns. The same screens work ok with jruby script/server so it > appears to a problem specific to using jetty:run. > > Still, great progress! > > --Chris > > On 11/12/06, Robert Egglestone wrote: > > > Ah, oops, it turns out I had the jars on my classpath. I've fixed up the > build file and readme with the changes, thanks. > > I'm not very familiar with rake, but certainly being able to package > everything up from a single command would make things easier. > > > Cheers, > Robert > > Fausto Lelli wrote: > Hi Robert, > an outstanding job as usual, just two things: > 1) in the ant file, also the servlet api jar need to included in the > classpath > jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot make the > patch myself because I don't know the best way to deal this kind > of dependence within maven) > 2)in the read me file, also remember to copy all the jruby related jar > file in the lib directory of the webapp (jruby,asm,bsf ecc) > > > > be able to contain these as well. Conceivably I guess we could even package > up gems as jar files to make self-contained web apps. > > Intriguing, really. > > > > ideal either. We could suggest that if people intend the Rails app to be > mostly used with JRuby, then they rearrange the structure to move public to > the top. Alternatively, if they're wanting something that's compatible with > both Ruby and JRuby, then they go with FileServlet. > > Exactly. There's choices even! Anyway the FileServlet approach seems the > more > confortable at the moment, by far. My only concern is in the fact > that, in the case > that there a are lot (a lot!) of static files to be served, the > FileServlet could be hit > quite heavely, and this could degrade the overall performance. But > probably this is > just speculation and won't be a great problem in practice. > > I also think that a rake goal to procude a war-packaged rails app is > waiting at the > door, do you think ;-) ? > > Fausto > > > On 11/12/06, Robert Egglestone wrote: > > > Hi Fausto, > > Thanks for trying it out. I've added in an Ant build file which should make > things easier. > > I was expecting to have to use /WEB-INF/ruby, but it turns out that JRuby > can get the .rb file from inside jars, so the rails-integration jar should > be able to contain these as well. Conceivably I guess we could even package > up gems as jar files to make self-contained web apps. > > I'm not sure about the best way to deal with the static files. The > FileServlet approach isn't great, however rearranging the Rails app isn't > ideal either. We could suggest that if people intend the Rails app to be > mostly used with JRuby, then they rearrange the structure to move public to > the top. Alternatively, if they're wanting something that's compatible with > both Ruby and JRuby, then they go with FileServlet. > > Cheers, > Robert > > > > Fausto Lelli wrote: > Hi Robert, > > helloworld is working and the static files are reachable, > but I needed to add the WEB-INF/ruby/builtin directory into > the helloworld dir and add the loadpath in the RailsServlet > > // setup the load paths > List loadPaths = new ArrayList(); > loadPaths.add(railsRoot); > loadPaths.add(getPath("/WEB-INF/ruby")); > > I'm not using maven (I don't have it installed yet) so the dir thing > is settled by it, I just don't know. > > Cheers, > Fausto > > On 11/12/06, Robert Egglestone wrote: > > > Hi all, > > I've checked the latest version of the initial WAR code I had into the > subversion repository at: > svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration > > It currently contains two parts: > + rails-integration is a JAR library, which contains RailsServlet, > FileServlet, and associated Ruby code. > + samples/helloworld is a very simple Rails application plus > WEB-INF/web.xml and pom.xml. > > If anyone could try it out and see if you run into any problems it would > be much appreciated. > > Some of the changes from before: > + Error messages are a lot better > + Fausto's real path fix has been added in > + The webapp directory layout is now the standard Rails one (This also > means that mvn jetty:run can be used to run them in-place). > + FileServlet has been added to handle static files > > Cheers, > Robert > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > From Ashish.Sahni at Sun.COM Tue Nov 14 20:19:16 2006 From: Ashish.Sahni at Sun.COM (Ashish Sahni) Date: Tue, 14 Nov 2006 17:19:16 -0800 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <455A2989.8060104@cs.auckland.ac.nz> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> <45592F87.7030307@sun.com> <455A10B3.3090208@sun.com> <455A2989.8060104@cs.auckland.ac.nz> Message-ID: <455A6B14.9060407@sun.com> Great ! Thanks ! Then the other issue of redirection probably falls in the same bucket - after a create action is completed a redirection page with the user agents ip address is displayed - 'You are being redirected' With redirection link being of the form http://:///list The user-agent-ip-address should be replaced by the server's ip address but I think using relative URI might be better. Thanks Ashish Robert Egglestone wrote: > It looks like CgiResponse has some special handling of the > content-type header that I missed out of JavaServletResponse. > > Cheers, > Robert > > > Ashish Sahni wrote: > >>Looks like the content-type thingy is a bit of both. The rails >>app/framework deployed as a war >>does not set the content-type header and so its up to the container to >>set the content-type in >>the response. Its a bit odd but I guess its a question for the >>rails-framework folks. >> >>Has anybody got a rails-app-as-a-war working with the db ? Viewing the >>db contents >>seems to be working but editing/creating does not. Anyone ? >> >>Thanks >>Ashish >> >> >> >>Ashish Sahni wrote: >> >> >> >>>Hi Folks, >>> >>>I'm able to connect a rails app deployed as a war file and it seems to >>>be working (to an extent) ! >>> >>>The problem seems to be with the content-type of the http response. The >>>browser >>>is interpreting it as text/plain but it really is html content. Its >>>deployed on glassfish appserver. >>>Any ideas - is it a rails-on-jruby thingy or the container issue ? >>> >>>(snip) >>> >>> >>> >>> >>> >>>>Inside a war file we could put all the rails files into a directory >>>>(previously they were in WEB-INF/rails), however for an exploded webapp >>>>it may become a problem for anyone that wants to take an existing rails >>>>application and use it with jruby without changing the existing structure. >>>> >>>> >>>> >>>> >>>> >>>> >>>I don't quite see the problem you are referring to. Could you explain a >>>bit more ? >>> >>>Thanks >>>Ashish >>> >>> >>> >>> >>> >>> >>>>javaRequest and javaResponse are the actual servlet request/response >>>>objects. They're passed through from the RailsServlet: >>>>protected void service(HttpServletRequest request, HttpServletResponse >>>>response) throws ServletException, IOException { >>>> Object[] args = { request, response }; >>>> JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, >>>>void.class); >>>>} >>>>I believe JavaEmbedUtils wraps them in RubyObjects so that they can be >>>>used directly in Ruby code. >>>> >>>>Cheers, >>>>Robert >>>> >>>>Ashish Sahni wrote: >>>> >>>> >>>> >>>> >>>> >>>> >>>>>Hi Robert, >>>>>Thanks for all the great work ! I've been trying to get a rails app >>>>>run as a web app, so this >>>>>effort is awesome and I'm now able to get the helloworld sample >>>>>working ;) >>>>> >>>>>Some comments/questions: >>>>>- I think it would be useful it the jruby interpreter is acquire via >>>>>the javax.scripting interface(jsr223 - new in >>>>>mustang). I don't know if it'll be a seemless transition from the >>>>>JavaEmbedUtils but should make things a lot >>>>>more standardized. Ofcourse it require use of java 1.6 >>>>>- The rails servlet executes just one ruby script - basically a >>>>>combination of 'require config/environment' >>>>>and 'require java_servlet_dispatcher' >>>>>- Move all the ruby-rails files and directories under a single >>>>>directory. CUrrently they are all in a top-level >>>>>web application dir. So it would look something like >>>>>-- WEB-INF >>>>>-- railsFiles/app >>>>>-- railsFiles/config >>>>>-- railsFiles/components ... >>>>>- Since I'm new to the ruby language and rails I'd like to understand >>>>>how/where in the ruby framework >>>>>do the javaRequest and javaResponse parameters in self.dispatch method >>>>>in java-servlet-dipatcher code >>>>>get created/bound to the underlying actual http-servlet >>>>>request/response objects. Anyone ? >>>>> >>>>>Thanks >>>>>Ashish >>>>> >>>>> >>>>> >>>>>Robert Egglestone wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>Ah, oops, it turns out I had the jars on my classpath. I've fixed up >>>>>>the build file and readme with the changes, thanks. >>>>>> >>>>>>I'm not very familiar with rake, but certainly being able to package >>>>>>everything up from a single command would make things easier. >>>>>> >>>>>>Cheers, >>>>>>Robert >>>>>> >>>>>>Fausto Lelli wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>Hi Robert, >>>>>>>an outstanding job as usual, just two things: >>>>>>>1) in the ant file, also the servlet api jar need to included in the >>>>>>>classpath >>>>>>>jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot >>>>>>>make the >>>>>>>patch myself because I don't know the best way to deal this kind >>>>>>>of dependence within maven) >>>>>>>2)in the read me file, also remember to copy all the jruby related jar >>>>>>>file in the lib directory of the webapp (jruby,asm,bsf ecc) >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>be able to contain these as well. Conceivably I guess we could even >>>>>>>>package >>>>>>>>up gems as jar files to make self-contained web apps. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>Intriguing, really. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>ideal either. We could suggest that if people intend the Rails app >>>>>>>>to be >>>>>>>>mostly used with JRuby, then they rearrange the structure to move >>>>>>>>public to >>>>>>>>the top. Alternatively, if they're wanting something that's >>>>>>>>compatible with >>>>>>>>both Ruby and JRuby, then they go with FileServlet. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>Exactly. There's choices even! Anyway the FileServlet approach >>>>>>>seems the more >>>>>>>confortable at the moment, by far. My only concern is in the fact >>>>>>>that, in the case >>>>>>>that there a are lot (a lot!) of static files to be served, the >>>>>>>FileServlet could be hit >>>>>>>quite heavely, and this could degrade the overall performance. But >>>>>>>probably this is >>>>>>>just speculation and won't be a great problem in practice. >>>>>>> >>>>>>>I also think that a rake goal to procude a war-packaged rails app is >>>>>>>waiting at the >>>>>>>door, do you think ;-) ? >>>>>>> >>>>>>>Fausto >>>>>>> >>>>>>> >>>>>>>On 11/12/06, Robert Egglestone wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>Hi Fausto, >>>>>>>> >>>>>>>>Thanks for trying it out. I've added in an Ant build file which >>>>>>>>should make >>>>>>>>things easier. >>>>>>>> >>>>>>>>I was expecting to have to use /WEB-INF/ruby, but it turns out that >>>>>>>>JRuby >>>>>>>>can get the .rb file from inside jars, so the rails-integration jar >>>>>>>>should >>>>>>>>be able to contain these as well. Conceivably I guess we could even >>>>>>>>package >>>>>>>>up gems as jar files to make self-contained web apps. >>>>>>>> >>>>>>>>I'm not sure about the best way to deal with the static files. The >>>>>>>>FileServlet approach isn't great, however rearranging the Rails app >>>>>>>>isn't >>>>>>>>ideal either. We could suggest that if people intend the Rails app >>>>>>>>to be >>>>>>>>mostly used with JRuby, then they rearrange the structure to move >>>>>>>>public to >>>>>>>>the top. Alternatively, if they're wanting something that's >>>>>>>>compatible with >>>>>>>>both Ruby and JRuby, then they go with FileServlet. >>>>>>>> >>>>>>>>Cheers, >>>>>>>>Robert >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>Fausto Lelli wrote: >>>>>>>>Hi Robert, >>>>>>>> >>>>>>>>helloworld is working and the static files are reachable, >>>>>>>>but I needed to add the WEB-INF/ruby/builtin directory into >>>>>>>>the helloworld dir and add the loadpath in the RailsServlet >>>>>>>> >>>>>>>>// setup the load paths >>>>>>>>List loadPaths = new ArrayList(); >>>>>>>>loadPaths.add(railsRoot); >>>>>>>>loadPaths.add(getPath("/WEB-INF/ruby")); >>>>>>>> >>>>>>>>I'm not using maven (I don't have it installed yet) so the dir thing >>>>>>>>is settled by it, I just don't know. >>>>>>>> >>>>>>>>Cheers, >>>>>>>>Fausto >>>>>>>> >>>>>>>>On 11/12/06, Robert Egglestone wrote: >>>>>>>> >>>>>>>> >>>>>>>>Hi all, >>>>>>>> >>>>>>>>I've checked the latest version of the initial WAR code I had into the >>>>>>>>subversion repository at: >>>>>>>>svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>>>>>>> >>>>>>>>It currently contains two parts: >>>>>>>>+ rails-integration is a JAR library, which contains RailsServlet, >>>>>>>>FileServlet, and associated Ruby code. >>>>>>>>+ samples/helloworld is a very simple Rails application plus >>>>>>>>WEB-INF/web.xml and pom.xml. >>>>>>>> >>>>>>>>If anyone could try it out and see if you run into any problems it >>>>>>>>would >>>>>>>>be much appreciated. >>>>>>>> >>>>>>>>Some of the changes from before: >>>>>>>>+ Error messages are a lot better >>>>>>>>+ Fausto's real path fix has been added in >>>>>>>>+ The webapp directory layout is now the standard Rails one (This also >>>>>>>>means that mvn jetty:run can be used to run them in-place). >>>>>>>>+ FileServlet has been added to handle static files >>>>>>>> >>>>>>>>Cheers, >>>>>>>>Robert >>>>>>>> >>>>>>>> >>>>>>>>_______________________________________________ >>>>>>>>Jruby-extras-devel mailing list >>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>> >>>>>>>> >>>>>>>>_______________________________________________ >>>>>>>>Jruby-extras-devel mailing list >>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>> >>>>>>>> >>>>>>>>_______________________________________________ >>>>>>>>Jruby-extras-devel mailing list >>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>_______________________________________________ >>>>>>>Jruby-extras-devel mailing list >>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>------------------------------------------------------------------------ >>>>>> >>>>>>_______________________________________________ >>>>>>Jruby-extras-devel mailing list >>>>>>Jruby-extras-devel at rubyforge.org >>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>_______________________________________________ >>>>Jruby-extras-devel mailing list >>>>Jruby-extras-devel at rubyforge.org >>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>> >>>> >>>> >>>> >>>> >>>> >>>_______________________________________________ >>>Jruby-extras-devel mailing list >>>Jruby-extras-devel at rubyforge.org >>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >>> >>> >> >>_______________________________________________ >>Jruby-extras-devel mailing list >>Jruby-extras-devel at rubyforge.org >>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >------------------------------------------------------------------------ > >_______________________________________________ >Jruby-extras-devel mailing list >Jruby-extras-devel at rubyforge.org >http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > From robert at cs.auckland.ac.nz Wed Nov 15 01:48:13 2006 From: robert at cs.auckland.ac.nz (Robert Egglestone) Date: Wed, 15 Nov 2006 19:48:13 +1300 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <455A6B14.9060407@sun.com> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> <45592F87.7030307@sun.com> <455A10B3.3090208@sun.com> <455A2989.8060104@cs.auckland.ac.nz> <455A6B14.9060407@sun.com> Message-ID: <455AB82D.20807@cs.auckland.ac.nz> The redirect problem was caused by the status and location headers getting mangled. This should be fixed now. The form post data was because it wasn't taking consideration of nested keys (e.g. account[name]). This part of it should be working now, however there will still be a few other cases that have problems (e.g. uploaded files). Cheers, Robert Ashish Sahni wrote: > Great ! Thanks ! > Then the other issue of redirection probably falls in the same bucket - > after a create action > is completed a redirection page with the user agents ip address is > displayed - > 'You are being redirected' > > With redirection link being of the form > http://:///list > The user-agent-ip-address should be replaced by the server's ip address > but I think using relative URI might be better. > > Thanks > Ashish > > > Robert Egglestone wrote: > > >> It looks like CgiResponse has some special handling of the >> content-type header that I missed out of JavaServletResponse. >> >> Cheers, >> Robert >> >> >> Ashish Sahni wrote: >> >> >>> Looks like the content-type thingy is a bit of both. The rails >>> app/framework deployed as a war >>> does not set the content-type header and so its up to the container to >>> set the content-type in >>> the response. Its a bit odd but I guess its a question for the >>> rails-framework folks. >>> >>> Has anybody got a rails-app-as-a-war working with the db ? Viewing the >>> db contents >>> seems to be working but editing/creating does not. Anyone ? >>> >>> Thanks >>> Ashish >>> >>> >>> >>> Ashish Sahni wrote: >>> >>> >>> >>> >>>> Hi Folks, >>>> >>>> I'm able to connect a rails app deployed as a war file and it seems to >>>> be working (to an extent) ! >>>> >>>> The problem seems to be with the content-type of the http response. The >>>> browser >>>> is interpreting it as text/plain but it really is html content. Its >>>> deployed on glassfish appserver. >>>> Any ideas - is it a rails-on-jruby thingy or the container issue ? >>>> >>>> (snip) >>>> >>>> >>>> >>>> >>>> >>>> >>>>> Inside a war file we could put all the rails files into a directory >>>>> (previously they were in WEB-INF/rails), however for an exploded webapp >>>>> it may become a problem for anyone that wants to take an existing rails >>>>> application and use it with jruby without changing the existing structure. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> I don't quite see the problem you are referring to. Could you explain a >>>> bit more ? >>>> >>>> Thanks >>>> Ashish >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>>> javaRequest and javaResponse are the actual servlet request/response >>>>> objects. They're passed through from the RailsServlet: >>>>> protected void service(HttpServletRequest request, HttpServletResponse >>>>> response) throws ServletException, IOException { >>>>> Object[] args = { request, response }; >>>>> JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, >>>>> void.class); >>>>> } >>>>> I believe JavaEmbedUtils wraps them in RubyObjects so that they can be >>>>> used directly in Ruby code. >>>>> >>>>> Cheers, >>>>> Robert >>>>> >>>>> Ashish Sahni wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> Hi Robert, >>>>>> Thanks for all the great work ! I've been trying to get a rails app >>>>>> run as a web app, so this >>>>>> effort is awesome and I'm now able to get the helloworld sample >>>>>> working ;) >>>>>> >>>>>> Some comments/questions: >>>>>> - I think it would be useful it the jruby interpreter is acquire via >>>>>> the javax.scripting interface(jsr223 - new in >>>>>> mustang). I don't know if it'll be a seemless transition from the >>>>>> JavaEmbedUtils but should make things a lot >>>>>> more standardized. Ofcourse it require use of java 1.6 >>>>>> - The rails servlet executes just one ruby script - basically a >>>>>> combination of 'require config/environment' >>>>>> and 'require java_servlet_dispatcher' >>>>>> - Move all the ruby-rails files and directories under a single >>>>>> directory. CUrrently they are all in a top-level >>>>>> web application dir. So it would look something like >>>>>> -- WEB-INF >>>>>> -- railsFiles/app >>>>>> -- railsFiles/config >>>>>> -- railsFiles/components ... >>>>>> - Since I'm new to the ruby language and rails I'd like to understand >>>>>> how/where in the ruby framework >>>>>> do the javaRequest and javaResponse parameters in self.dispatch method >>>>>> in java-servlet-dipatcher code >>>>>> get created/bound to the underlying actual http-servlet >>>>>> request/response objects. Anyone ? >>>>>> >>>>>> Thanks >>>>>> Ashish >>>>>> >>>>>> >>>>>> >>>>>> Robert Egglestone wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> Ah, oops, it turns out I had the jars on my classpath. I've fixed up >>>>>>> the build file and readme with the changes, thanks. >>>>>>> >>>>>>> I'm not very familiar with rake, but certainly being able to package >>>>>>> everything up from a single command would make things easier. >>>>>>> >>>>>>> Cheers, >>>>>>> Robert >>>>>>> >>>>>>> Fausto Lelli wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> Hi Robert, >>>>>>>> an outstanding job as usual, just two things: >>>>>>>> 1) in the ant file, also the servlet api jar need to included in the >>>>>>>> classpath >>>>>>>> jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot >>>>>>>> make the >>>>>>>> patch myself because I don't know the best way to deal this kind >>>>>>>> of dependence within maven) >>>>>>>> 2)in the read me file, also remember to copy all the jruby related jar >>>>>>>> file in the lib directory of the webapp (jruby,asm,bsf ecc) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> be able to contain these as well. Conceivably I guess we could even >>>>>>>>> package >>>>>>>>> up gems as jar files to make self-contained web apps. >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> Intriguing, really. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> ideal either. We could suggest that if people intend the Rails app >>>>>>>>> to be >>>>>>>>> mostly used with JRuby, then they rearrange the structure to move >>>>>>>>> public to >>>>>>>>> the top. Alternatively, if they're wanting something that's >>>>>>>>> compatible with >>>>>>>>> both Ruby and JRuby, then they go with FileServlet. >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> Exactly. There's choices even! Anyway the FileServlet approach >>>>>>>> seems the more >>>>>>>> confortable at the moment, by far. My only concern is in the fact >>>>>>>> that, in the case >>>>>>>> that there a are lot (a lot!) of static files to be served, the >>>>>>>> FileServlet could be hit >>>>>>>> quite heavely, and this could degrade the overall performance. But >>>>>>>> probably this is >>>>>>>> just speculation and won't be a great problem in practice. >>>>>>>> >>>>>>>> I also think that a rake goal to procude a war-packaged rails app is >>>>>>>> waiting at the >>>>>>>> door, do you think ;-) ? >>>>>>>> >>>>>>>> Fausto >>>>>>>> >>>>>>>> >>>>>>>> On 11/12/06, Robert Egglestone wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> Hi Fausto, >>>>>>>>> >>>>>>>>> Thanks for trying it out. I've added in an Ant build file which >>>>>>>>> should make >>>>>>>>> things easier. >>>>>>>>> >>>>>>>>> I was expecting to have to use /WEB-INF/ruby, but it turns out that >>>>>>>>> JRuby >>>>>>>>> can get the .rb file from inside jars, so the rails-integration jar >>>>>>>>> should >>>>>>>>> be able to contain these as well. Conceivably I guess we could even >>>>>>>>> package >>>>>>>>> up gems as jar files to make self-contained web apps. >>>>>>>>> >>>>>>>>> I'm not sure about the best way to deal with the static files. The >>>>>>>>> FileServlet approach isn't great, however rearranging the Rails app >>>>>>>>> isn't >>>>>>>>> ideal either. We could suggest that if people intend the Rails app >>>>>>>>> to be >>>>>>>>> mostly used with JRuby, then they rearrange the structure to move >>>>>>>>> public to >>>>>>>>> the top. Alternatively, if they're wanting something that's >>>>>>>>> compatible with >>>>>>>>> both Ruby and JRuby, then they go with FileServlet. >>>>>>>>> >>>>>>>>> Cheers, >>>>>>>>> Robert >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> Fausto Lelli wrote: >>>>>>>>> Hi Robert, >>>>>>>>> >>>>>>>>> helloworld is working and the static files are reachable, >>>>>>>>> but I needed to add the WEB-INF/ruby/builtin directory into >>>>>>>>> the helloworld dir and add the loadpath in the RailsServlet >>>>>>>>> >>>>>>>>> // setup the load paths >>>>>>>>> List loadPaths = new ArrayList(); >>>>>>>>> loadPaths.add(railsRoot); >>>>>>>>> loadPaths.add(getPath("/WEB-INF/ruby")); >>>>>>>>> >>>>>>>>> I'm not using maven (I don't have it installed yet) so the dir thing >>>>>>>>> is settled by it, I just don't know. >>>>>>>>> >>>>>>>>> Cheers, >>>>>>>>> Fausto >>>>>>>>> >>>>>>>>> On 11/12/06, Robert Egglestone wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> Hi all, >>>>>>>>> >>>>>>>>> I've checked the latest version of the initial WAR code I had into the >>>>>>>>> subversion repository at: >>>>>>>>> svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>>>>>>>> >>>>>>>>> It currently contains two parts: >>>>>>>>> + rails-integration is a JAR library, which contains RailsServlet, >>>>>>>>> FileServlet, and associated Ruby code. >>>>>>>>> + samples/helloworld is a very simple Rails application plus >>>>>>>>> WEB-INF/web.xml and pom.xml. >>>>>>>>> >>>>>>>>> If anyone could try it out and see if you run into any problems it >>>>>>>>> would >>>>>>>>> be much appreciated. >>>>>>>>> >>>>>>>>> Some of the changes from before: >>>>>>>>> + Error messages are a lot better >>>>>>>>> + Fausto's real path fix has been added in >>>>>>>>> + The webapp directory layout is now the standard Rails one (This also >>>>>>>>> means that mvn jetty:run can be used to run them in-place). >>>>>>>>> + FileServlet has been added to handle static files >>>>>>>>> >>>>>>>>> Cheers, >>>>>>>>> Robert >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Jruby-extras-devel mailing list >>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> ------------------------------------------------------------------------ >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Jruby-extras-devel mailing list >>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>> _______________________________________________ >>>>> Jruby-extras-devel mailing list >>>>> Jruby-extras-devel at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> _______________________________________________ >>>> Jruby-extras-devel mailing list >>>> Jruby-extras-devel at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>> >>>> >>>> >>>> >>>> >>> _______________________________________________ >>> Jruby-extras-devel mailing list >>> Jruby-extras-devel at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >>> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >> > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20061115/ef659bc6/attachment-0001.html From fausto.lelli at gmail.com Wed Nov 15 04:04:39 2006 From: fausto.lelli at gmail.com (Fausto Lelli) Date: Wed, 15 Nov 2006 10:04:39 +0100 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558D2A6.6070300@cs.auckland.ac.nz> Message-ID: Hi Chris, the problems seems to be in the way the parameters are bundled in the JavaServletRequest. here's a quick patch (only works for *simple* forms): (Robert, does it make sense to create a branch for this ? I think I could need much more work to get this straight) the patch: in the java_servlet_process.rb : 1) redefine request_parameters: def request_parameters unless @request_parameters request_parameters_temp = Hash.new names = @request.getParameterNames while names.hasMoreElements name = names.nextElement values = @request.getParameterValues(name) values = values[0] if values.length == 1 request_parameters_temp[name] = values end if (request_parameters_temp != nil && request_parameters_temp.size > 0) @request_parameters = format_params(request_parameters_temp) else @request_parameters = {} end end @request_parameters end 2) add this method: private def format_params (params) formatted_params = {} temp_hash_name = "" temp_hash = {} for key, value in params if key.include?('[') splitted = key.split("[") temp_hash["#{splitted[1].slice(0, splitted[1].length - 1)}"] = value if "#{splitted[0]}" != temp_hash_name temp_hash_name = "#{splitted[0]}" formatted_params[temp_hash_name] = temp_hash end #else # formatted_params[key] = value end formatted_params end end ---------------------- Fausto On 11/15/06, Chris Nelson wrote: > Done! > > On 11/13/06, Robert Egglestone wrote: > > > > Hi Chris, > > > > Thanks for testing it out. Would it be possible to check in the Rails app > > as another sample so we can work through the problems? > > > > Cheers, > > Robert > > > > > > > > Chris Nelson wrote: > > Well, I was able to get a simple Rails app with some simple > > scaffolding to load, but it didn't seem to quite work correctly. It > > would save records, but not seem to take any values from the screen. > > In the database it would create a record with nulls in all the > > columns. The same screens work ok with jruby script/server so it > > appears to a problem specific to using jetty:run. > > > > Still, great progress! > > > > --Chris > > > > On 11/12/06, Robert Egglestone wrote: > > > > > > Ah, oops, it turns out I had the jars on my classpath. I've fixed up the > > build file and readme with the changes, thanks. > > > > I'm not very familiar with rake, but certainly being able to package > > everything up from a single command would make things easier. > > > > > > Cheers, > > Robert > > > > Fausto Lelli wrote: > > Hi Robert, > > an outstanding job as usual, just two things: > > 1) in the ant file, also the servlet api jar need to included in the > > classpath > > jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot make the > > patch myself because I don't know the best way to deal this kind > > of dependence within maven) > > 2)in the read me file, also remember to copy all the jruby related jar > > file in the lib directory of the webapp (jruby,asm,bsf ecc) > > > > > > > > be able to contain these as well. Conceivably I guess we could even package > > up gems as jar files to make self-contained web apps. > > > > Intriguing, really. > > > > > > > > ideal either. We could suggest that if people intend the Rails app to be > > mostly used with JRuby, then they rearrange the structure to move public to > > the top. Alternatively, if they're wanting something that's compatible with > > both Ruby and JRuby, then they go with FileServlet. > > > > Exactly. There's choices even! Anyway the FileServlet approach seems the > > more > > confortable at the moment, by far. My only concern is in the fact > > that, in the case > > that there a are lot (a lot!) of static files to be served, the > > FileServlet could be hit > > quite heavely, and this could degrade the overall performance. But > > probably this is > > just speculation and won't be a great problem in practice. > > > > I also think that a rake goal to procude a war-packaged rails app is > > waiting at the > > door, do you think ;-) ? > > > > Fausto > > > > > > On 11/12/06, Robert Egglestone wrote: > > > > > > Hi Fausto, > > > > Thanks for trying it out. I've added in an Ant build file which should make > > things easier. > > > > I was expecting to have to use /WEB-INF/ruby, but it turns out that JRuby > > can get the .rb file from inside jars, so the rails-integration jar should > > be able to contain these as well. Conceivably I guess we could even package > > up gems as jar files to make self-contained web apps. > > > > I'm not sure about the best way to deal with the static files. The > > FileServlet approach isn't great, however rearranging the Rails app isn't > > ideal either. We could suggest that if people intend the Rails app to be > > mostly used with JRuby, then they rearrange the structure to move public to > > the top. Alternatively, if they're wanting something that's compatible with > > both Ruby and JRuby, then they go with FileServlet. > > > > Cheers, > > Robert > > > > > > > > Fausto Lelli wrote: > > Hi Robert, > > > > helloworld is working and the static files are reachable, > > but I needed to add the WEB-INF/ruby/builtin directory into > > the helloworld dir and add the loadpath in the RailsServlet > > > > // setup the load paths > > List loadPaths = new ArrayList(); > > loadPaths.add(railsRoot); > > loadPaths.add(getPath("/WEB-INF/ruby")); > > > > I'm not using maven (I don't have it installed yet) so the dir thing > > is settled by it, I just don't know. > > > > Cheers, > > Fausto > > > > On 11/12/06, Robert Egglestone wrote: > > > > > > Hi all, > > > > I've checked the latest version of the initial WAR code I had into the > > subversion repository at: > > svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration > > > > It currently contains two parts: > > + rails-integration is a JAR library, which contains RailsServlet, > > FileServlet, and associated Ruby code. > > + samples/helloworld is a very simple Rails application plus > > WEB-INF/web.xml and pom.xml. > > > > If anyone could try it out and see if you run into any problems it would > > be much appreciated. > > > > Some of the changes from before: > > + Error messages are a lot better > > + Fausto's real path fix has been added in > > + The webapp directory layout is now the standard Rails one (This also > > means that mvn jetty:run can be used to run them in-place). > > + FileServlet has been added to handle static files > > > > Cheers, > > Robert > > > > > > _______________________________________________ > > Jruby-extras-devel mailing list > > Jruby-extras-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > > _______________________________________________ > > Jruby-extras-devel mailing list > > Jruby-extras-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > > _______________________________________________ > > Jruby-extras-devel mailing list > > Jruby-extras-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > > > > _______________________________________________ > > Jruby-extras-devel mailing list > > Jruby-extras-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > > _______________________________________________ > > Jruby-extras-devel mailing list > > Jruby-extras-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > > > > _______________________________________________ > > Jruby-extras-devel mailing list > > Jruby-extras-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > > _______________________________________________ > > Jruby-extras-devel mailing list > > Jruby-extras-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > From fausto.lelli at gmail.com Wed Nov 15 10:40:59 2006 From: fausto.lelli at gmail.com (Fausto Lelli) Date: Wed, 15 Nov 2006 16:40:59 +0100 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <455AB82D.20807@cs.auckland.ac.nz> References: <4554B46D.2050502@perspecsys.com> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> <45592F87.7030307@sun.com> <455A10B3.3090208@sun.com> <455A2989.8060104@cs.auckland.ac.nz> <455A6B14.9060407@sun.com> <455AB82D.20807@cs.auckland.ac.nz> Message-ID: OOps, I hadn't noticed that, OK then, I'll update the changes from snv, Bye, Fausto On 11/15/06, Robert Egglestone wrote: > > The redirect problem was caused by the status and location headers getting > mangled. This should be fixed now. > > The form post data was because it wasn't taking consideration of nested > keys (e.g. account[name]). This part of it should be working now, however > there will still be a few other cases that have problems (e.g. uploaded > files). > > > Cheers, > Robert > > > Ashish Sahni wrote: > Great ! Thanks ! > Then the other issue of redirection probably falls in the same bucket - > after a create action > is completed a redirection page with the user agents ip address is > displayed - > 'You are being redirected' > > With redirection link being of the form > http://:///list > The user-agent-ip-address should be replaced by the server's ip address > but I think using relative URI might be better. > > Thanks > Ashish > > > Robert Egglestone wrote: > > > > It looks like CgiResponse has some special handling of the > content-type header that I missed out of JavaServletResponse. > > Cheers, > Robert > > > Ashish Sahni wrote: > > > > Looks like the content-type thingy is a bit of both. The rails > app/framework deployed as a war > does not set the content-type header and so its up to the container to > set the content-type in > the response. Its a bit odd but I guess its a question for the > rails-framework folks. > > Has anybody got a rails-app-as-a-war working with the db ? Viewing the > db contents > seems to be working but editing/creating does not. Anyone ? > > Thanks > Ashish > > > > Ashish Sahni wrote: > > > > > > Hi Folks, > > I'm able to connect a rails app deployed as a war file and it seems to > be working (to an extent) ! > > The problem seems to be with the content-type of the http response. The > browser > is interpreting it as text/plain but it really is html content. Its > deployed on glassfish appserver. > Any ideas - is it a rails-on-jruby thingy or the container issue ? > > (snip) > > > > > > > > Inside a war file we could put all the rails files into a directory > (previously they were in WEB-INF/rails), however for an exploded webapp > it may become a problem for anyone that wants to take an existing rails > application and use it with jruby without changing the existing structure. > > > > > > > > I don't quite see the problem you are referring to. Could you explain a > bit more ? > > Thanks > Ashish > > > > > > > > > javaRequest and javaResponse are the actual servlet request/response > objects. They're passed through from the RailsServlet: > protected void service(HttpServletRequest request, HttpServletResponse > response) throws ServletException, IOException { > Object[] args = { request, response }; > JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, > void.class); > } > I believe JavaEmbedUtils wraps them in RubyObjects so that they can be > used directly in Ruby code. > > Cheers, > Robert > > Ashish Sahni wrote: > > > > > > > > > Hi Robert, > Thanks for all the great work ! I've been trying to get a rails app > run as a web app, so this > effort is awesome and I'm now able to get the helloworld sample > working ;) > > Some comments/questions: > - I think it would be useful it the jruby interpreter is acquire via > the javax.scripting interface(jsr223 - new in > mustang). I don't know if it'll be a seemless transition from the > JavaEmbedUtils but should make things a lot > more standardized. Ofcourse it require use of java 1.6 > - The rails servlet executes just one ruby script - basically a > combination of 'require config/environment' > and 'require java_servlet_dispatcher' > - Move all the ruby-rails files and directories under a single > directory. CUrrently they are all in a top-level > web application dir. So it would look something like > -- WEB-INF > -- railsFiles/app > -- railsFiles/config > -- railsFiles/components ... > - Since I'm new to the ruby language and rails I'd like to understand > how/where in the ruby framework > do the javaRequest and javaResponse parameters in self.dispatch method > in java-servlet-dipatcher code > get created/bound to the underlying actual http-servlet > request/response objects. Anyone ? > > Thanks > Ashish > > > > Robert Egglestone wrote: > > > > > > > > > > Ah, oops, it turns out I had the jars on my classpath. I've fixed up > the build file and readme with the changes, thanks. > > I'm not very familiar with rake, but certainly being able to package > everything up from a single command would make things easier. > > Cheers, > Robert > > Fausto Lelli wrote: > > > > > > > > > > Hi Robert, > an outstanding job as usual, just two things: > 1) in the ant file, also the servlet api jar need to included in the > classpath > jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot > make the > patch myself because I don't know the best way to deal this kind > of dependence within maven) > 2)in the read me file, also remember to copy all the jruby related jar > file in the lib directory of the webapp (jruby,asm,bsf ecc) > > > > > > > > > > > > be able to contain these as well. Conceivably I guess we could even > package > up gems as jar files to make self-contained web apps. > > > > > > > > > Intriguing, really. > > > > > > > > > > > > ideal either. We could suggest that if people intend the Rails app > to be > mostly used with JRuby, then they rearrange the structure to move > public to > the top. Alternatively, if they're wanting something that's > compatible with > both Ruby and JRuby, then they go with FileServlet. > > > > > > > > > Exactly. There's choices even! Anyway the FileServlet approach > seems the more > confortable at the moment, by far. My only concern is in the fact > that, in the case > that there a are lot (a lot!) of static files to be served, the > FileServlet could be hit > quite heavely, and this could degrade the overall performance. But > probably this is > just speculation and won't be a great problem in practice. > > I also think that a rake goal to procude a war-packaged rails app is > waiting at the > door, do you think ;-) ? > > Fausto > > > On 11/12/06, Robert Egglestone wrote: > > > > > > > > > > > Hi Fausto, > > Thanks for trying it out. I've added in an Ant build file which > should make > things easier. > > I was expecting to have to use /WEB-INF/ruby, but it turns out that > JRuby > can get the .rb file from inside jars, so the rails-integration jar > should > be able to contain these as well. Conceivably I guess we could even > package > up gems as jar files to make self-contained web apps. > > I'm not sure about the best way to deal with the static files. The > FileServlet approach isn't great, however rearranging the Rails app > isn't > ideal either. We could suggest that if people intend the Rails app > to be > mostly used with JRuby, then they rearrange the structure to move > public to > the top. Alternatively, if they're wanting something that's > compatible with > both Ruby and JRuby, then they go with FileServlet. > > Cheers, > Robert > > > > Fausto Lelli wrote: > Hi Robert, > > helloworld is working and the static files are reachable, > but I needed to add the WEB-INF/ruby/builtin directory into > the helloworld dir and add the loadpath in the RailsServlet > > // setup the load paths > List loadPaths = new ArrayList(); > loadPaths.add(railsRoot); > loadPaths.add(getPath("/WEB-INF/ruby")); > > I'm not using maven (I don't have it installed yet) so the dir thing > is settled by it, I just don't know. > > Cheers, > Fausto > > On 11/12/06, Robert Egglestone wrote: > > > Hi all, > > I've checked the latest version of the initial WAR code I had into the > subversion repository at: > svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration > > It currently contains two parts: > + rails-integration is a JAR library, which contains RailsServlet, > FileServlet, and associated Ruby code. > + samples/helloworld is a very simple Rails application plus > WEB-INF/web.xml and pom.xml. > > If anyone could try it out and see if you run into any problems it > would > be much appreciated. > > Some of the changes from before: > + Error messages are a lot better > + Fausto's real path fix has been added in > + The webapp directory layout is now the standard Rails one (This also > means that mvn jetty:run can be used to run them in-place). > + FileServlet has been added to handle static files > > Cheers, > Robert > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > > > > > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > > > > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > From Ashish.Sahni at Sun.COM Wed Nov 15 14:00:20 2006 From: Ashish.Sahni at Sun.COM (Ashish Sahni) Date: Wed, 15 Nov 2006 11:00:20 -0800 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <455AB82D.20807@cs.auckland.ac.nz> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> <45592F87.7030307@sun.com> <455A10B3.3090208@sun.com> <455A2989.8060104@cs.auckland.ac.nz> <455A6B14.9060407@sun.com> <455AB82D.20807@cs.auckland.ac.nz> Message-ID: <455B63C4.9030700@sun.com> Robert Egglestone wrote: > The redirect problem was caused by the status and location headers > getting mangled. This should be fixed now. Hmm ... I'm still seeing the redirect issue :( But the db insertions seem to be working - fantastic work! thanks ! -Ashish > > The form post data was because it wasn't taking consideration of > nested keys (e.g. account[name]). This part of it should be working > now, however there will still be a few other cases that have problems > (e.g. uploaded files). > > Cheers, > Robert > > > Ashish Sahni wrote: > >>Great ! Thanks ! >>Then the other issue of redirection probably falls in the same bucket - >>after a create action >>is completed a redirection page with the user agents ip address is >>displayed - >>'You are being redirected' >> >>With redirection link being of the form >>http://:///list >>The user-agent-ip-address should be replaced by the server's ip address >>but I think using relative URI might be better. >> >>Thanks >>Ashish >> >> >>Robert Egglestone wrote: >> >> >> >>>It looks like CgiResponse has some special handling of the >>>content-type header that I missed out of JavaServletResponse. >>> >>>Cheers, >>>Robert >>> >>> >>>Ashish Sahni wrote: >>> >>> >>> >>>>Looks like the content-type thingy is a bit of both. The rails >>>>app/framework deployed as a war >>>>does not set the content-type header and so its up to the container to >>>>set the content-type in >>>>the response. Its a bit odd but I guess its a question for the >>>>rails-framework folks. >>>> >>>>Has anybody got a rails-app-as-a-war working with the db ? Viewing the >>>>db contents >>>>seems to be working but editing/creating does not. Anyone ? >>>> >>>>Thanks >>>>Ashish >>>> >>>> >>>> >>>>Ashish Sahni wrote: >>>> >>>> >>>> >>>> >>>> >>>>>Hi Folks, >>>>> >>>>>I'm able to connect a rails app deployed as a war file and it seems to >>>>>be working (to an extent) ! >>>>> >>>>>The problem seems to be with the content-type of the http response. The >>>>>browser >>>>>is interpreting it as text/plain but it really is html content. Its >>>>>deployed on glassfish appserver. >>>>>Any ideas - is it a rails-on-jruby thingy or the container issue ? >>>>> >>>>>(snip) >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>Inside a war file we could put all the rails files into a directory >>>>>>(previously they were in WEB-INF/rails), however for an exploded webapp >>>>>>it may become a problem for anyone that wants to take an existing rails >>>>>>application and use it with jruby without changing the existing structure. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>I don't quite see the problem you are referring to. Could you explain a >>>>>bit more ? >>>>> >>>>>Thanks >>>>>Ashish >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>javaRequest and javaResponse are the actual servlet request/response >>>>>>objects. They're passed through from the RailsServlet: >>>>>>protected void service(HttpServletRequest request, HttpServletResponse >>>>>>response) throws ServletException, IOException { >>>>>> Object[] args = { request, response }; >>>>>> JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, >>>>>>void.class); >>>>>>} >>>>>>I believe JavaEmbedUtils wraps them in RubyObjects so that they can be >>>>>>used directly in Ruby code. >>>>>> >>>>>>Cheers, >>>>>>Robert >>>>>> >>>>>>Ashish Sahni wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>Hi Robert, >>>>>>>Thanks for all the great work ! I've been trying to get a rails app >>>>>>>run as a web app, so this >>>>>>>effort is awesome and I'm now able to get the helloworld sample >>>>>>>working ;) >>>>>>> >>>>>>>Some comments/questions: >>>>>>>- I think it would be useful it the jruby interpreter is acquire via >>>>>>>the javax.scripting interface(jsr223 - new in >>>>>>>mustang). I don't know if it'll be a seemless transition from the >>>>>>>JavaEmbedUtils but should make things a lot >>>>>>>more standardized. Ofcourse it require use of java 1.6 >>>>>>>- The rails servlet executes just one ruby script - basically a >>>>>>>combination of 'require config/environment' >>>>>>>and 'require java_servlet_dispatcher' >>>>>>>- Move all the ruby-rails files and directories under a single >>>>>>>directory. CUrrently they are all in a top-level >>>>>>>web application dir. So it would look something like >>>>>>>-- WEB-INF >>>>>>>-- railsFiles/app >>>>>>>-- railsFiles/config >>>>>>>-- railsFiles/components ... >>>>>>>- Since I'm new to the ruby language and rails I'd like to understand >>>>>>>how/where in the ruby framework >>>>>>>do the javaRequest and javaResponse parameters in self.dispatch method >>>>>>>in java-servlet-dipatcher code >>>>>>>get created/bound to the underlying actual http-servlet >>>>>>>request/response objects. Anyone ? >>>>>>> >>>>>>>Thanks >>>>>>>Ashish >>>>>>> >>>>>>> >>>>>>> >>>>>>>Robert Egglestone wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>Ah, oops, it turns out I had the jars on my classpath. I've fixed up >>>>>>>>the build file and readme with the changes, thanks. >>>>>>>> >>>>>>>>I'm not very familiar with rake, but certainly being able to package >>>>>>>>everything up from a single command would make things easier. >>>>>>>> >>>>>>>>Cheers, >>>>>>>>Robert >>>>>>>> >>>>>>>>Fausto Lelli wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>>Hi Robert, >>>>>>>>>an outstanding job as usual, just two things: >>>>>>>>>1) in the ant file, also the servlet api jar need to included in the >>>>>>>>>classpath >>>>>>>>>jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot >>>>>>>>>make the >>>>>>>>>patch myself because I don't know the best way to deal this kind >>>>>>>>>of dependence within maven) >>>>>>>>>2)in the read me file, also remember to copy all the jruby related jar >>>>>>>>>file in the lib directory of the webapp (jruby,asm,bsf ecc) >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>be able to contain these as well. Conceivably I guess we could even >>>>>>>>>>package >>>>>>>>>>up gems as jar files to make self-contained web apps. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>Intriguing, really. >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>ideal either. We could suggest that if people intend the Rails app >>>>>>>>>>to be >>>>>>>>>>mostly used with JRuby, then they rearrange the structure to move >>>>>>>>>>public to >>>>>>>>>>the top. Alternatively, if they're wanting something that's >>>>>>>>>>compatible with >>>>>>>>>>both Ruby and JRuby, then they go with FileServlet. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>Exactly. There's choices even! Anyway the FileServlet approach >>>>>>>>>seems the more >>>>>>>>>confortable at the moment, by far. My only concern is in the fact >>>>>>>>>that, in the case >>>>>>>>>that there a are lot (a lot!) of static files to be served, the >>>>>>>>>FileServlet could be hit >>>>>>>>>quite heavely, and this could degrade the overall performance. But >>>>>>>>>probably this is >>>>>>>>>just speculation and won't be a great problem in practice. >>>>>>>>> >>>>>>>>>I also think that a rake goal to procude a war-packaged rails app is >>>>>>>>>waiting at the >>>>>>>>>door, do you think ;-) ? >>>>>>>>> >>>>>>>>>Fausto >>>>>>>>> >>>>>>>>> >>>>>>>>>On 11/12/06, Robert Egglestone wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>Hi Fausto, >>>>>>>>>> >>>>>>>>>>Thanks for trying it out. I've added in an Ant build file which >>>>>>>>>>should make >>>>>>>>>>things easier. >>>>>>>>>> >>>>>>>>>>I was expecting to have to use /WEB-INF/ruby, but it turns out that >>>>>>>>>>JRuby >>>>>>>>>>can get the .rb file from inside jars, so the rails-integration jar >>>>>>>>>>should >>>>>>>>>>be able to contain these as well. Conceivably I guess we could even >>>>>>>>>>package >>>>>>>>>>up gems as jar files to make self-contained web apps. >>>>>>>>>> >>>>>>>>>>I'm not sure about the best way to deal with the static files. The >>>>>>>>>>FileServlet approach isn't great, however rearranging the Rails app >>>>>>>>>>isn't >>>>>>>>>>ideal either. We could suggest that if people intend the Rails app >>>>>>>>>>to be >>>>>>>>>>mostly used with JRuby, then they rearrange the structure to move >>>>>>>>>>public to >>>>>>>>>>the top. Alternatively, if they're wanting something that's >>>>>>>>>>compatible with >>>>>>>>>>both Ruby and JRuby, then they go with FileServlet. >>>>>>>>>> >>>>>>>>>>Cheers, >>>>>>>>>>Robert >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>Fausto Lelli wrote: >>>>>>>>>>Hi Robert, >>>>>>>>>> >>>>>>>>>>helloworld is working and the static files are reachable, >>>>>>>>>>but I needed to add the WEB-INF/ruby/builtin directory into >>>>>>>>>>the helloworld dir and add the loadpath in the RailsServlet >>>>>>>>>> >>>>>>>>>>// setup the load paths >>>>>>>>>>List loadPaths = new ArrayList(); >>>>>>>>>>loadPaths.add(railsRoot); >>>>>>>>>>loadPaths.add(getPath("/WEB-INF/ruby")); >>>>>>>>>> >>>>>>>>>>I'm not using maven (I don't have it installed yet) so the dir thing >>>>>>>>>>is settled by it, I just don't know. >>>>>>>>>> >>>>>>>>>>Cheers, >>>>>>>>>>Fausto >>>>>>>>>> >>>>>>>>>>On 11/12/06, Robert Egglestone wrote: >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>Hi all, >>>>>>>>>> >>>>>>>>>>I've checked the latest version of the initial WAR code I had into the >>>>>>>>>>subversion repository at: >>>>>>>>>>svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>>>>>>>>> >>>>>>>>>>It currently contains two parts: >>>>>>>>>>+ rails-integration is a JAR library, which contains RailsServlet, >>>>>>>>>>FileServlet, and associated Ruby code. >>>>>>>>>>+ samples/helloworld is a very simple Rails application plus >>>>>>>>>>WEB-INF/web.xml and pom.xml. >>>>>>>>>> >>>>>>>>>>If anyone could try it out and see if you run into any problems it >>>>>>>>>>would >>>>>>>>>>be much appreciated. >>>>>>>>>> >>>>>>>>>>Some of the changes from before: >>>>>>>>>>+ Error messages are a lot better >>>>>>>>>>+ Fausto's real path fix has been added in >>>>>>>>>>+ The webapp directory layout is now the standard Rails one (This also >>>>>>>>>>means that mvn jetty:run can be used to run them in-place). >>>>>>>>>>+ FileServlet has been added to handle static files >>>>>>>>>> >>>>>>>>>>Cheers, >>>>>>>>>>Robert >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>_______________________________________________ >>>>>>>>>>Jruby-extras-devel mailing list >>>>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>_______________________________________________ >>>>>>>>>>Jruby-extras-devel mailing list >>>>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>_______________________________________________ >>>>>>>>>>Jruby-extras-devel mailing list >>>>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>_______________________________________________ >>>>>>>>>Jruby-extras-devel mailing list >>>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>------------------------------------------------------------------------ >>>>>>>> >>>>>>>>_______________________________________________ >>>>>>>>Jruby-extras-devel mailing list >>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>_______________________________________________ >>>>>>Jruby-extras-devel mailing list >>>>>>Jruby-extras-devel at rubyforge.org >>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>_______________________________________________ >>>>>Jruby-extras-devel mailing list >>>>>Jruby-extras-devel at rubyforge.org >>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>_______________________________________________ >>>>Jruby-extras-devel mailing list >>>>Jruby-extras-devel at rubyforge.org >>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>> >>>> >>>> >>>> >>>------------------------------------------------------------------------ >>> >>>_______________________________________________ >>>Jruby-extras-devel mailing list >>>Jruby-extras-devel at rubyforge.org >>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >>> >>> >> >>_______________________________________________ >>Jruby-extras-devel mailing list >>Jruby-extras-devel at rubyforge.org >>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >------------------------------------------------------------------------ > >_______________________________________________ >Jruby-extras-devel mailing list >Jruby-extras-devel at rubyforge.org >http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > From robert at cs.auckland.ac.nz Wed Nov 15 15:13:23 2006 From: robert at cs.auckland.ac.nz (Robert Egglestone) Date: Thu, 16 Nov 2006 09:13:23 +1300 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <455B63C4.9030700@sun.com> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> <45592F87.7030307@sun.com> <455A10B3.3090208@sun.com> <455A2989.8060104@cs.auckland.ac.nz> <455A6B14.9060407@sun.com> <455AB82D.20807@cs.auckland.ac.nz> <455B63C4.9030700@sun.com> Message-ID: <455B74E3.3080302@cs.auckland.ac.nz> Would it be possible to post the full response that's being sent back to the browser please? This might help to see what's going on: curl -i --interface 127.0.0.1 http://localhost:8080/scaffoldtest/accounts/update/1 -d "account[name]=hello&account[budget]=2&commit=Edit" Cheers, Robert Ashish Sahni wrote: > Robert Egglestone wrote: > > >> The redirect problem was caused by the status and location headers >> getting mangled. This should be fixed now. >> > > Hmm ... I'm still seeing the redirect issue :( > But the db insertions seem to be working - fantastic work! thanks ! > > -Ashish > > >> The form post data was because it wasn't taking consideration of >> nested keys (e.g. account[name]). This part of it should be working >> now, however there will still be a few other cases that have problems >> (e.g. uploaded files). >> >> Cheers, >> Robert >> >> >> Ashish Sahni wrote: >> >> >>> Great ! Thanks ! >>> Then the other issue of redirection probably falls in the same bucket - >>> after a create action >>> is completed a redirection page with the user agents ip address is >>> displayed - >>> 'You are being redirected' >>> >>> With redirection link being of the form >>> http://:///list >>> The user-agent-ip-address should be replaced by the server's ip address >>> but I think using relative URI might be better. >>> >>> Thanks >>> Ashish >>> >>> >>> Robert Egglestone wrote: >>> >>> >>> >>> >>>> It looks like CgiResponse has some special handling of the >>>> content-type header that I missed out of JavaServletResponse. >>>> >>>> Cheers, >>>> Robert >>>> >>>> >>>> Ashish Sahni wrote: >>>> >>>> >>>> >>>> >>>>> Looks like the content-type thingy is a bit of both. The rails >>>>> app/framework deployed as a war >>>>> does not set the content-type header and so its up to the container to >>>>> set the content-type in >>>>> the response. Its a bit odd but I guess its a question for the >>>>> rails-framework folks. >>>>> >>>>> Has anybody got a rails-app-as-a-war working with the db ? Viewing the >>>>> db contents >>>>> seems to be working but editing/creating does not. Anyone ? >>>>> >>>>> Thanks >>>>> Ashish >>>>> >>>>> >>>>> >>>>> Ashish Sahni wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> Hi Folks, >>>>>> >>>>>> I'm able to connect a rails app deployed as a war file and it seems to >>>>>> be working (to an extent) ! >>>>>> >>>>>> The problem seems to be with the content-type of the http response. The >>>>>> browser >>>>>> is interpreting it as text/plain but it really is html content. Its >>>>>> deployed on glassfish appserver. >>>>>> Any ideas - is it a rails-on-jruby thingy or the container issue ? >>>>>> >>>>>> (snip) >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> Inside a war file we could put all the rails files into a directory >>>>>>> (previously they were in WEB-INF/rails), however for an exploded webapp >>>>>>> it may become a problem for anyone that wants to take an existing rails >>>>>>> application and use it with jruby without changing the existing structure. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> I don't quite see the problem you are referring to. Could you explain a >>>>>> bit more ? >>>>>> >>>>>> Thanks >>>>>> Ashish >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> javaRequest and javaResponse are the actual servlet request/response >>>>>>> objects. They're passed through from the RailsServlet: >>>>>>> protected void service(HttpServletRequest request, HttpServletResponse >>>>>>> response) throws ServletException, IOException { >>>>>>> Object[] args = { request, response }; >>>>>>> JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, >>>>>>> void.class); >>>>>>> } >>>>>>> I believe JavaEmbedUtils wraps them in RubyObjects so that they can be >>>>>>> used directly in Ruby code. >>>>>>> >>>>>>> Cheers, >>>>>>> Robert >>>>>>> >>>>>>> Ashish Sahni wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> Hi Robert, >>>>>>>> Thanks for all the great work ! I've been trying to get a rails app >>>>>>>> run as a web app, so this >>>>>>>> effort is awesome and I'm now able to get the helloworld sample >>>>>>>> working ;) >>>>>>>> >>>>>>>> Some comments/questions: >>>>>>>> - I think it would be useful it the jruby interpreter is acquire via >>>>>>>> the javax.scripting interface(jsr223 - new in >>>>>>>> mustang). I don't know if it'll be a seemless transition from the >>>>>>>> JavaEmbedUtils but should make things a lot >>>>>>>> more standardized. Ofcourse it require use of java 1.6 >>>>>>>> - The rails servlet executes just one ruby script - basically a >>>>>>>> combination of 'require config/environment' >>>>>>>> and 'require java_servlet_dispatcher' >>>>>>>> - Move all the ruby-rails files and directories under a single >>>>>>>> directory. CUrrently they are all in a top-level >>>>>>>> web application dir. So it would look something like >>>>>>>> -- WEB-INF >>>>>>>> -- railsFiles/app >>>>>>>> -- railsFiles/config >>>>>>>> -- railsFiles/components ... >>>>>>>> - Since I'm new to the ruby language and rails I'd like to understand >>>>>>>> how/where in the ruby framework >>>>>>>> do the javaRequest and javaResponse parameters in self.dispatch method >>>>>>>> in java-servlet-dipatcher code >>>>>>>> get created/bound to the underlying actual http-servlet >>>>>>>> request/response objects. Anyone ? >>>>>>>> >>>>>>>> Thanks >>>>>>>> Ashish >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Robert Egglestone wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> Ah, oops, it turns out I had the jars on my classpath. I've fixed up >>>>>>>>> the build file and readme with the changes, thanks. >>>>>>>>> >>>>>>>>> I'm not very familiar with rake, but certainly being able to package >>>>>>>>> everything up from a single command would make things easier. >>>>>>>>> >>>>>>>>> Cheers, >>>>>>>>> Robert >>>>>>>>> >>>>>>>>> Fausto Lelli wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> Hi Robert, >>>>>>>>>> an outstanding job as usual, just two things: >>>>>>>>>> 1) in the ant file, also the servlet api jar need to included in the >>>>>>>>>> classpath >>>>>>>>>> jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot >>>>>>>>>> make the >>>>>>>>>> patch myself because I don't know the best way to deal this kind >>>>>>>>>> of dependence within maven) >>>>>>>>>> 2)in the read me file, also remember to copy all the jruby related jar >>>>>>>>>> file in the lib directory of the webapp (jruby,asm,bsf ecc) >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> be able to contain these as well. Conceivably I guess we could even >>>>>>>>>>> package >>>>>>>>>>> up gems as jar files to make self-contained web apps. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> Intriguing, really. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> ideal either. We could suggest that if people intend the Rails app >>>>>>>>>>> to be >>>>>>>>>>> mostly used with JRuby, then they rearrange the structure to move >>>>>>>>>>> public to >>>>>>>>>>> the top. Alternatively, if they're wanting something that's >>>>>>>>>>> compatible with >>>>>>>>>>> both Ruby and JRuby, then they go with FileServlet. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> Exactly. There's choices even! Anyway the FileServlet approach >>>>>>>>>> seems the more >>>>>>>>>> confortable at the moment, by far. My only concern is in the fact >>>>>>>>>> that, in the case >>>>>>>>>> that there a are lot (a lot!) of static files to be served, the >>>>>>>>>> FileServlet could be hit >>>>>>>>>> quite heavely, and this could degrade the overall performance. But >>>>>>>>>> probably this is >>>>>>>>>> just speculation and won't be a great problem in practice. >>>>>>>>>> >>>>>>>>>> I also think that a rake goal to procude a war-packaged rails app is >>>>>>>>>> waiting at the >>>>>>>>>> door, do you think ;-) ? >>>>>>>>>> >>>>>>>>>> Fausto >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On 11/12/06, Robert Egglestone wrote: >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> Hi Fausto, >>>>>>>>>>> >>>>>>>>>>> Thanks for trying it out. I've added in an Ant build file which >>>>>>>>>>> should make >>>>>>>>>>> things easier. >>>>>>>>>>> >>>>>>>>>>> I was expecting to have to use /WEB-INF/ruby, but it turns out that >>>>>>>>>>> JRuby >>>>>>>>>>> can get the .rb file from inside jars, so the rails-integration jar >>>>>>>>>>> should >>>>>>>>>>> be able to contain these as well. Conceivably I guess we could even >>>>>>>>>>> package >>>>>>>>>>> up gems as jar files to make self-contained web apps. >>>>>>>>>>> >>>>>>>>>>> I'm not sure about the best way to deal with the static files. The >>>>>>>>>>> FileServlet approach isn't great, however rearranging the Rails app >>>>>>>>>>> isn't >>>>>>>>>>> ideal either. We could suggest that if people intend the Rails app >>>>>>>>>>> to be >>>>>>>>>>> mostly used with JRuby, then they rearrange the structure to move >>>>>>>>>>> public to >>>>>>>>>>> the top. Alternatively, if they're wanting something that's >>>>>>>>>>> compatible with >>>>>>>>>>> both Ruby and JRuby, then they go with FileServlet. >>>>>>>>>>> >>>>>>>>>>> Cheers, >>>>>>>>>>> Robert >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Fausto Lelli wrote: >>>>>>>>>>> Hi Robert, >>>>>>>>>>> >>>>>>>>>>> helloworld is working and the static files are reachable, >>>>>>>>>>> but I needed to add the WEB-INF/ruby/builtin directory into >>>>>>>>>>> the helloworld dir and add the loadpath in the RailsServlet >>>>>>>>>>> >>>>>>>>>>> // setup the load paths >>>>>>>>>>> List loadPaths = new ArrayList(); >>>>>>>>>>> loadPaths.add(railsRoot); >>>>>>>>>>> loadPaths.add(getPath("/WEB-INF/ruby")); >>>>>>>>>>> >>>>>>>>>>> I'm not using maven (I don't have it installed yet) so the dir thing >>>>>>>>>>> is settled by it, I just don't know. >>>>>>>>>>> >>>>>>>>>>> Cheers, >>>>>>>>>>> Fausto >>>>>>>>>>> >>>>>>>>>>> On 11/12/06, Robert Egglestone wrote: >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Hi all, >>>>>>>>>>> >>>>>>>>>>> I've checked the latest version of the initial WAR code I had into the >>>>>>>>>>> subversion repository at: >>>>>>>>>>> svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>>>>>>>>>> >>>>>>>>>>> It currently contains two parts: >>>>>>>>>>> + rails-integration is a JAR library, which contains RailsServlet, >>>>>>>>>>> FileServlet, and associated Ruby code. >>>>>>>>>>> + samples/helloworld is a very simple Rails application plus >>>>>>>>>>> WEB-INF/web.xml and pom.xml. >>>>>>>>>>> >>>>>>>>>>> If anyone could try it out and see if you run into any problems it >>>>>>>>>>> would >>>>>>>>>>> be much appreciated. >>>>>>>>>>> >>>>>>>>>>> Some of the changes from before: >>>>>>>>>>> + Error messages are a lot better >>>>>>>>>>> + Fausto's real path fix has been added in >>>>>>>>>>> + The webapp directory layout is now the standard Rails one (This also >>>>>>>>>>> means that mvn jetty:run can be used to run them in-place). >>>>>>>>>>> + FileServlet has been added to handle static files >>>>>>>>>>> >>>>>>>>>>> Cheers, >>>>>>>>>>> Robert >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> ------------------------------------------------------------------------ >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>> _______________________________________________ >>>>>>> Jruby-extras-devel mailing list >>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> _______________________________________________ >>>>>> Jruby-extras-devel mailing list >>>>>> Jruby-extras-devel at rubyforge.org >>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> _______________________________________________ >>>>> Jruby-extras-devel mailing list >>>>> Jruby-extras-devel at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>> >>>>> >>>>> >>>> ------------------------------------------------------------------------ >>>> >>>> _______________________________________________ >>>> Jruby-extras-devel mailing list >>>> Jruby-extras-devel at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>> >>>> >>>> >>>> >>>> >>> _______________________________________________ >>> Jruby-extras-devel mailing list >>> Jruby-extras-devel at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >>> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >> > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20061116/b7578dec/attachment-0001.html From charles.nutter at sun.com Wed Nov 22 11:11:27 2006 From: charles.nutter at sun.com (Charles Oliver Nutter) Date: Wed, 22 Nov 2006 10:11:27 -0600 Subject: [Jruby-extras-devel] SQLite2/3 JDBC driver Message-ID: <456476AF.2090501@sun.com> Someone pointed this out on #ruby-talk: http://www.ch-werner.de/javasqlite/ It uses JNI, like you'd expect, but it probably wouldn't be hard to wire into ActiveRecord-JDBC. -- Charles Oliver Nutter, JRuby Core Developer Blogging on Ruby and Java @ headius.blogspot.com Help spec out Ruby today! @ www.headius.com/rubyspec headius at headius.com -- charles.nutter at sun.com From ola.bini at ki.se Wed Nov 29 03:34:50 2006 From: ola.bini at ki.se (Ola Bini) Date: Wed, 29 Nov 2006 09:34:50 +0100 Subject: [Jruby-extras-devel] Something new. Or old. Sandbox Message-ID: <456D462A.3040508@ki.se> Yeah, boys an' girls. I've started work on implementing Sandbox. For this purpose there is a branch called sandbox in the JRuby tree. I don't see much changes from trunk in this branch, but you never know... The other part of the equation is the subproject javasand in JRuby-extras where the real functionality is. This will soon (as soon as it works) be installable as a gem, so basically, pretty soon you will be able to have all the sandbox goodness by gem install javasand. I'll keep you posted. -- Ola Bini (http://ola-bini.blogspot.com) JvYAML, RbYAML, JRuby and Jatha contributor System Developer, Karolinska Institutet (http://www.ki.se) OLogix Consulting (http://www.ologix.com) "Yields falsehood when quined" yields falsehood when quined. From Ashish.Sahni at Sun.COM Wed Nov 29 15:07:12 2006 From: Ashish.Sahni at Sun.COM (Ashish Sahni) Date: Wed, 29 Nov 2006 12:07:12 -0800 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <455B74E3.3080302@cs.auckland.ac.nz> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> <45592F87.7030307@sun.com> <455A10B3.3090208@sun.com> <455A2989.8060104@cs.auckland.ac.nz> <455A6B14.9060407@sun.com> <455AB82D.20807@cs.auckland.ac.nz> <455B63C4.9030700@sun.com> <455B74E3.3080302@cs.auckland.ac.nz> Message-ID: <456DE870.80701@sun.com> (apologies for the delayed response) The problem seems to be caused by the value of the 'Host' header in the response Relevant snippet from the attached file(129.145.133.50 is the http proxy server's ip) GET /helloworld/widget/show/3 HTTP/1.1 Host: 129.145.133.50:8080 Thanks Ashish Robert Egglestone wrote: > Would it be possible to post the full response that's being sent back > to the browser please? > This might help to see what's going on: > curl -i --interface 127.0.0.1 > http://localhost:8080/scaffoldtest/accounts/update/1 -d > "account[name]=hello&account[budget]=2&commit=Edit" > > Cheers, > Robert > > > Ashish Sahni wrote: > >>Robert Egglestone wrote: >> >> >> >>>The redirect problem was caused by the status and location headers >>>getting mangled. This should be fixed now. >>> >>> >> >>Hmm ... I'm still seeing the redirect issue :( >>But the db insertions seem to be working - fantastic work! thanks ! >> >>-Ashish >> >> >> >>>The form post data was because it wasn't taking consideration of >>>nested keys (e.g. account[name]). This part of it should be working >>>now, however there will still be a few other cases that have problems >>>(e.g. uploaded files). >>> >>>Cheers, >>>Robert >>> >>> >>>Ashish Sahni wrote: >>> >>> >>> >>>>Great ! Thanks ! >>>>Then the other issue of redirection probably falls in the same bucket - >>>>after a create action >>>>is completed a redirection page with the user agents ip address is >>>>displayed - >>>>'You are being redirected' >>>> >>>>With redirection link being of the form >>>>http://:///list >>>>The user-agent-ip-address should be replaced by the server's ip address >>>>but I think using relative URI might be better. >>>> >>>>Thanks >>>>Ashish >>>> >>>> >>>>Robert Egglestone wrote: >>>> >>>> >>>> >>>> >>>> >>>>>It looks like CgiResponse has some special handling of the >>>>>content-type header that I missed out of JavaServletResponse. >>>>> >>>>>Cheers, >>>>>Robert >>>>> >>>>> >>>>>Ashish Sahni wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>Looks like the content-type thingy is a bit of both. The rails >>>>>>app/framework deployed as a war >>>>>>does not set the content-type header and so its up to the container to >>>>>>set the content-type in >>>>>>the response. Its a bit odd but I guess its a question for the >>>>>>rails-framework folks. >>>>>> >>>>>>Has anybody got a rails-app-as-a-war working with the db ? Viewing the >>>>>>db contents >>>>>>seems to be working but editing/creating does not. Anyone ? >>>>>> >>>>>>Thanks >>>>>>Ashish >>>>>> >>>>>> >>>>>> >>>>>>Ashish Sahni wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>Hi Folks, >>>>>>> >>>>>>>I'm able to connect a rails app deployed as a war file and it seems to >>>>>>>be working (to an extent) ! >>>>>>> >>>>>>>The problem seems to be with the content-type of the http response. The >>>>>>>browser >>>>>>>is interpreting it as text/plain but it really is html content. Its >>>>>>>deployed on glassfish appserver. >>>>>>>Any ideas - is it a rails-on-jruby thingy or the container issue ? >>>>>>> >>>>>>>(snip) >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>Inside a war file we could put all the rails files into a directory >>>>>>>>(previously they were in WEB-INF/rails), however for an exploded webapp >>>>>>>>it may become a problem for anyone that wants to take an existing rails >>>>>>>>application and use it with jruby without changing the existing structure. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>I don't quite see the problem you are referring to. Could you explain a >>>>>>>bit more ? >>>>>>> >>>>>>>Thanks >>>>>>>Ashish >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>javaRequest and javaResponse are the actual servlet request/response >>>>>>>>objects. They're passed through from the RailsServlet: >>>>>>>>protected void service(HttpServletRequest request, HttpServletResponse >>>>>>>>response) throws ServletException, IOException { >>>>>>>>Object[] args = { request, response }; >>>>>>>>JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, >>>>>>>>void.class); >>>>>>>>} >>>>>>>>I believe JavaEmbedUtils wraps them in RubyObjects so that they can be >>>>>>>>used directly in Ruby code. >>>>>>>> >>>>>>>>Cheers, >>>>>>>>Robert >>>>>>>> >>>>>>>>Ashish Sahni wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>>Hi Robert, >>>>>>>>>Thanks for all the great work ! I've been trying to get a rails app >>>>>>>>>run as a web app, so this >>>>>>>>>effort is awesome and I'm now able to get the helloworld sample >>>>>>>>>working ;) >>>>>>>>> >>>>>>>>>Some comments/questions: >>>>>>>>>- I think it would be useful it the jruby interpreter is acquire via >>>>>>>>>the javax.scripting interface(jsr223 - new in >>>>>>>>>mustang). I don't know if it'll be a seemless transition from the >>>>>>>>>JavaEmbedUtils but should make things a lot >>>>>>>>>more standardized. Ofcourse it require use of java 1.6 >>>>>>>>>- The rails servlet executes just one ruby script - basically a >>>>>>>>>combination of 'require config/environment' >>>>>>>>>and 'require java_servlet_dispatcher' >>>>>>>>>- Move all the ruby-rails files and directories under a single >>>>>>>>>directory. CUrrently they are all in a top-level >>>>>>>>>web application dir. So it would look something like >>>>>>>>>-- WEB-INF >>>>>>>>>-- railsFiles/app >>>>>>>>>-- railsFiles/config >>>>>>>>>-- railsFiles/components ... >>>>>>>>>- Since I'm new to the ruby language and rails I'd like to understand >>>>>>>>>how/where in the ruby framework >>>>>>>>>do the javaRequest and javaResponse parameters in self.dispatch method >>>>>>>>>in java-servlet-dipatcher code >>>>>>>>>get created/bound to the underlying actual http-servlet >>>>>>>>>request/response objects. Anyone ? >>>>>>>>> >>>>>>>>>Thanks >>>>>>>>>Ashish >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>Robert Egglestone wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>Ah, oops, it turns out I had the jars on my classpath. I've fixed up >>>>>>>>>>the build file and readme with the changes, thanks. >>>>>>>>>> >>>>>>>>>>I'm not very familiar with rake, but certainly being able to package >>>>>>>>>>everything up from a single command would make things easier. >>>>>>>>>> >>>>>>>>>>Cheers, >>>>>>>>>>Robert >>>>>>>>>> >>>>>>>>>>Fausto Lelli wrote: >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>>Hi Robert, >>>>>>>>>>>an outstanding job as usual, just two things: >>>>>>>>>>>1) in the ant file, also the servlet api jar need to included in the >>>>>>>>>>>classpath >>>>>>>>>>>jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I cannot >>>>>>>>>>>make the >>>>>>>>>>>patch myself because I don't know the best way to deal this kind >>>>>>>>>>>of dependence within maven) >>>>>>>>>>>2)in the read me file, also remember to copy all the jruby related jar >>>>>>>>>>>file in the lib directory of the webapp (jruby,asm,bsf ecc) >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>>be able to contain these as well. Conceivably I guess we could even >>>>>>>>>>>>package >>>>>>>>>>>>up gems as jar files to make self-contained web apps. >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>Intriguing, really. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>>ideal either. We could suggest that if people intend the Rails app >>>>>>>>>>>>to be >>>>>>>>>>>>mostly used with JRuby, then they rearrange the structure to move >>>>>>>>>>>>public to >>>>>>>>>>>>the top. Alternatively, if they're wanting something that's >>>>>>>>>>>>compatible with >>>>>>>>>>>>both Ruby and JRuby, then they go with FileServlet. >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>Exactly. There's choices even! Anyway the FileServlet approach >>>>>>>>>>>seems the more >>>>>>>>>>>confortable at the moment, by far. My only concern is in the fact >>>>>>>>>>>that, in the case >>>>>>>>>>>that there a are lot (a lot!) of static files to be served, the >>>>>>>>>>>FileServlet could be hit >>>>>>>>>>>quite heavely, and this could degrade the overall performance. But >>>>>>>>>>>probably this is >>>>>>>>>>>just speculation and won't be a great problem in practice. >>>>>>>>>>> >>>>>>>>>>>I also think that a rake goal to procude a war-packaged rails app is >>>>>>>>>>>waiting at the >>>>>>>>>>>door, do you think ;-) ? >>>>>>>>>>> >>>>>>>>>>>Fausto >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>On 11/12/06, Robert Egglestone wrote: >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>>Hi Fausto, >>>>>>>>>>>> >>>>>>>>>>>>Thanks for trying it out. I've added in an Ant build file which >>>>>>>>>>>>should make >>>>>>>>>>>>things easier. >>>>>>>>>>>> >>>>>>>>>>>>I was expecting to have to use /WEB-INF/ruby, but it turns out that >>>>>>>>>>>>JRuby >>>>>>>>>>>>can get the .rb file from inside jars, so the rails-integration jar >>>>>>>>>>>>should >>>>>>>>>>>>be able to contain these as well. Conceivably I guess we could even >>>>>>>>>>>>package >>>>>>>>>>>>up gems as jar files to make self-contained web apps. >>>>>>>>>>>> >>>>>>>>>>>>I'm not sure about the best way to deal with the static files. The >>>>>>>>>>>>FileServlet approach isn't great, however rearranging the Rails app >>>>>>>>>>>>isn't >>>>>>>>>>>>ideal either. We could suggest that if people intend the Rails app >>>>>>>>>>>>to be >>>>>>>>>>>>mostly used with JRuby, then they rearrange the structure to move >>>>>>>>>>>>public to >>>>>>>>>>>>the top. Alternatively, if they're wanting something that's >>>>>>>>>>>>compatible with >>>>>>>>>>>>both Ruby and JRuby, then they go with FileServlet. >>>>>>>>>>>> >>>>>>>>>>>>Cheers, >>>>>>>>>>>>Robert >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>>Fausto Lelli wrote: >>>>>>>>>>>>Hi Robert, >>>>>>>>>>>> >>>>>>>>>>>>helloworld is working and the static files are reachable, >>>>>>>>>>>>but I needed to add the WEB-INF/ruby/builtin directory into >>>>>>>>>>>>the helloworld dir and add the loadpath in the RailsServlet >>>>>>>>>>>> >>>>>>>>>>>>// setup the load paths >>>>>>>>>>>>List loadPaths = new ArrayList(); >>>>>>>>>>>>loadPaths.add(railsRoot); >>>>>>>>>>>>loadPaths.add(getPath("/WEB-INF/ruby")); >>>>>>>>>>>> >>>>>>>>>>>>I'm not using maven (I don't have it installed yet) so the dir thing >>>>>>>>>>>>is settled by it, I just don't know. >>>>>>>>>>>> >>>>>>>>>>>>Cheers, >>>>>>>>>>>>Fausto >>>>>>>>>>>> >>>>>>>>>>>>On 11/12/06, Robert Egglestone wrote: >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>>Hi all, >>>>>>>>>>>> >>>>>>>>>>>>I've checked the latest version of the initial WAR code I had into the >>>>>>>>>>>>subversion repository at: >>>>>>>>>>>>svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>>>>>>>>>>> >>>>>>>>>>>>It currently contains two parts: >>>>>>>>>>>>+ rails-integration is a JAR library, which contains RailsServlet, >>>>>>>>>>>>FileServlet, and associated Ruby code. >>>>>>>>>>>>+ samples/helloworld is a very simple Rails application plus >>>>>>>>>>>>WEB-INF/web.xml and pom.xml. >>>>>>>>>>>> >>>>>>>>>>>>If anyone could try it out and see if you run into any problems it >>>>>>>>>>>>would >>>>>>>>>>>>be much appreciated. >>>>>>>>>>>> >>>>>>>>>>>>Some of the changes from before: >>>>>>>>>>>>+ Error messages are a lot better >>>>>>>>>>>>+ Fausto's real path fix has been added in >>>>>>>>>>>>+ The webapp directory layout is now the standard Rails one (This also >>>>>>>>>>>>means that mvn jetty:run can be used to run them in-place). >>>>>>>>>>>>+ FileServlet has been added to handle static files >>>>>>>>>>>> >>>>>>>>>>>>Cheers, >>>>>>>>>>>>Robert >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>>_______________________________________________ >>>>>>>>>>>>Jruby-extras-devel mailing list >>>>>>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>>_______________________________________________ >>>>>>>>>>>>Jruby-extras-devel mailing list >>>>>>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>>_______________________________________________ >>>>>>>>>>>>Jruby-extras-devel mailing list >>>>>>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>_______________________________________________ >>>>>>>>>>>Jruby-extras-devel mailing list >>>>>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>------------------------------------------------------------------------ >>>>>>>>>> >>>>>>>>>>_______________________________________________ >>>>>>>>>>Jruby-extras-devel mailing list >>>>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>_______________________________________________ >>>>>>>>Jruby-extras-devel mailing list >>>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>_______________________________________________ >>>>>>>Jruby-extras-devel mailing list >>>>>>>Jruby-extras-devel at rubyforge.org >>>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>_______________________________________________ >>>>>>Jruby-extras-devel mailing list >>>>>>Jruby-extras-devel at rubyforge.org >>>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>------------------------------------------------------------------------ >>>>> >>>>>_______________________________________________ >>>>>Jruby-extras-devel mailing list >>>>>Jruby-extras-devel at rubyforge.org >>>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>_______________________________________________ >>>>Jruby-extras-devel mailing list >>>>Jruby-extras-devel at rubyforge.org >>>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>> >>>> >>>> >>>> >>>------------------------------------------------------------------------ >>> >>>_______________________________________________ >>>Jruby-extras-devel mailing list >>>Jruby-extras-devel at rubyforge.org >>>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >>> >>> >> >>_______________________________________________ >>Jruby-extras-devel mailing list >>Jruby-extras-devel at rubyforge.org >>http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> >------------------------------------------------------------------------ > >_______________________________________________ >Jruby-extras-devel mailing list >Jruby-extras-devel at rubyforge.org >http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: headers.txt Url: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20061129/8571e07a/attachment-0001.txt From Ashish.Sahni at Sun.COM Wed Nov 29 15:10:46 2006 From: Ashish.Sahni at Sun.COM (Ashish Sahni) Date: Wed, 29 Nov 2006 12:10:46 -0800 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <456DE870.80701@sun.com> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> <45592F87.7030307@sun.com> <455A10B3.3090208@sun.com> <455A2989.8060104@cs.auckland.ac.nz> <455A6B14.9060407@sun.com> <455AB82D.20807@cs.auckland.ac.nz> <455B63C4.9030700@sun.com> <455B74E3.3080302@cs.auckland.ac.nz> <456DE870.80701@sun.com> Message-ID: <456DE946.6090903@sun.com> I think my brains are still in vacation mode ;) 129.145.133.50 is the ip of browser-host ie., user-agent Ashish Sahni wrote: > (apologies for the delayed response) > The problem seems to be caused by the value of the 'Host' header in > the response > Relevant snippet from the attached file(129.145.133.50 is the http > proxy server's ip) > > GET /helloworld/widget/show/3 HTTP/1.1 > Host: 129.145.133.50:8080 > > Thanks > Ashish > > Robert Egglestone wrote: > >> Would it be possible to post the full response that's being sent back >> to the browser please? >> This might help to see what's going on: >> curl -i --interface 127.0.0.1 >> http://localhost:8080/scaffoldtest/accounts/update/1 -d >> "account[name]=hello&account[budget]=2&commit=Edit" >> >> Cheers, >> Robert >> >> >> Ashish Sahni wrote: >> >>> Robert Egglestone wrote: >>> >>> >>> >>>> The redirect problem was caused by the status and location headers >>>> getting mangled. This should be fixed now. >>>> >>> >>> >>> Hmm ... I'm still seeing the redirect issue :( >>> But the db insertions seem to be working - fantastic work! thanks ! >>> >>> -Ashish >>> >>> >>> >>>> The form post data was because it wasn't taking consideration of >>>> nested keys (e.g. account[name]). This part of it should be working >>>> now, however there will still be a few other cases that have >>>> problems (e.g. uploaded files). >>>> >>>> Cheers, >>>> Robert >>>> >>>> >>>> Ashish Sahni wrote: >>>> >>>> >>>> >>>>> Great ! Thanks ! >>>>> Then the other issue of redirection probably falls in the same >>>>> bucket - after a create action >>>>> is completed a redirection page with the user agents ip address is >>>>> displayed - >>>>> 'You are being redirected' >>>>> >>>>> With redirection link being of the form >>>>> http://:///list >>>>> >>>>> The user-agent-ip-address should be replaced by the server's ip >>>>> address but I think using relative URI might be better. >>>>> >>>>> Thanks >>>>> Ashish >>>>> >>>>> >>>>> Robert Egglestone wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> It looks like CgiResponse has some special handling of the >>>>>> content-type header that I missed out of JavaServletResponse. >>>>>> >>>>>> Cheers, >>>>>> Robert >>>>>> >>>>>> >>>>>> Ashish Sahni wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> Looks like the content-type thingy is a bit of both. The rails >>>>>>> app/framework deployed as a war >>>>>>> does not set the content-type header and so its up to the >>>>>>> container to set the content-type in >>>>>>> the response. Its a bit odd but I guess its a question for the >>>>>>> rails-framework folks. >>>>>>> >>>>>>> Has anybody got a rails-app-as-a-war working with the db ? >>>>>>> Viewing the db contents >>>>>>> seems to be working but editing/creating does not. Anyone ? >>>>>>> >>>>>>> Thanks >>>>>>> Ashish >>>>>>> >>>>>>> >>>>>>> >>>>>>> Ashish Sahni wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> Hi Folks, >>>>>>>> >>>>>>>> I'm able to connect a rails app deployed as a war file and it >>>>>>>> seems to be working (to an extent) ! >>>>>>>> >>>>>>>> The problem seems to be with the content-type of the http >>>>>>>> response. The browser >>>>>>>> is interpreting it as text/plain but it really is html content. >>>>>>>> Its deployed on glassfish appserver. >>>>>>>> Any ideas - is it a rails-on-jruby thingy or the container >>>>>>>> issue ? >>>>>>>> >>>>>>>> (snip) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> Inside a war file we could put all the rails files into a >>>>>>>>> directory (previously they were in WEB-INF/rails), however for >>>>>>>>> an exploded webapp it may become a problem for anyone that >>>>>>>>> wants to take an existing rails application and use it with >>>>>>>>> jruby without changing the existing structure. >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> I don't quite see the problem you are referring to. Could you >>>>>>>> explain a bit more ? >>>>>>>> >>>>>>>> Thanks >>>>>>>> Ashish >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> javaRequest and javaResponse are the actual servlet >>>>>>>>> request/response objects. They're passed through from the >>>>>>>>> RailsServlet: >>>>>>>>> protected void service(HttpServletRequest request, >>>>>>>>> HttpServletResponse response) throws ServletException, >>>>>>>>> IOException { >>>>>>>>> Object[] args = { request, response }; >>>>>>>>> JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", >>>>>>>>> args, void.class); >>>>>>>>> } >>>>>>>>> I believe JavaEmbedUtils wraps them in RubyObjects so that >>>>>>>>> they can be used directly in Ruby code. >>>>>>>>> >>>>>>>>> Cheers, >>>>>>>>> Robert >>>>>>>>> >>>>>>>>> Ashish Sahni wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> Hi Robert, >>>>>>>>>> Thanks for all the great work ! I've been trying to get a >>>>>>>>>> rails app run as a web app, so this >>>>>>>>>> effort is awesome and I'm now able to get the helloworld >>>>>>>>>> sample working ;) >>>>>>>>>> >>>>>>>>>> Some comments/questions: >>>>>>>>>> - I think it would be useful it the jruby interpreter is >>>>>>>>>> acquire via the javax.scripting interface(jsr223 - new in >>>>>>>>>> mustang). I don't know if it'll be a seemless transition from >>>>>>>>>> the JavaEmbedUtils but should make things a lot >>>>>>>>>> more standardized. Ofcourse it require use of java 1.6 >>>>>>>>>> - The rails servlet executes just one ruby script - basically >>>>>>>>>> a combination of 'require config/environment' >>>>>>>>>> and 'require java_servlet_dispatcher' >>>>>>>>>> - Move all the ruby-rails files and directories under a >>>>>>>>>> single directory. CUrrently they are all in a top-level >>>>>>>>>> web application dir. So it would look something like >>>>>>>>>> -- WEB-INF >>>>>>>>>> -- railsFiles/app >>>>>>>>>> -- railsFiles/config >>>>>>>>>> -- railsFiles/components ... >>>>>>>>>> - Since I'm new to the ruby language and rails I'd like to >>>>>>>>>> understand how/where in the ruby framework >>>>>>>>>> do the javaRequest and javaResponse parameters in >>>>>>>>>> self.dispatch method in java-servlet-dipatcher code >>>>>>>>>> get created/bound to the underlying actual http-servlet >>>>>>>>>> request/response objects. Anyone ? >>>>>>>>>> >>>>>>>>>> Thanks >>>>>>>>>> Ashish >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Robert Egglestone wrote: >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> Ah, oops, it turns out I had the jars on my classpath. I've >>>>>>>>>>> fixed up the build file and readme with the changes, thanks. >>>>>>>>>>> >>>>>>>>>>> I'm not very familiar with rake, but certainly being able to >>>>>>>>>>> package everything up from a single command would make >>>>>>>>>>> things easier. >>>>>>>>>>> >>>>>>>>>>> Cheers, >>>>>>>>>>> Robert >>>>>>>>>>> >>>>>>>>>>> Fausto Lelli wrote: >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>> Hi Robert, >>>>>>>>>>>> an outstanding job as usual, just two things: >>>>>>>>>>>> 1) in the ant file, also the servlet api jar need to >>>>>>>>>>>> included in the classpath >>>>>>>>>>>> jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I >>>>>>>>>>>> cannot make the >>>>>>>>>>>> patch myself because I don't know the best way to deal this >>>>>>>>>>>> kind >>>>>>>>>>>> of dependence within maven) >>>>>>>>>>>> 2)in the read me file, also remember to copy all the jruby >>>>>>>>>>>> related jar >>>>>>>>>>>> file in the lib directory of the webapp (jruby,asm,bsf ecc) >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>>> be able to contain these as well. Conceivably I guess we >>>>>>>>>>>>> could even package >>>>>>>>>>>>> up gems as jar files to make self-contained web apps. >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Intriguing, really. >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>>> ideal either. We could suggest that if people intend the >>>>>>>>>>>>> Rails app to be >>>>>>>>>>>>> mostly used with JRuby, then they rearrange the structure >>>>>>>>>>>>> to move public to >>>>>>>>>>>>> the top. Alternatively, if they're wanting something >>>>>>>>>>>>> that's compatible with >>>>>>>>>>>>> both Ruby and JRuby, then they go with FileServlet. >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Exactly. There's choices even! Anyway the FileServlet >>>>>>>>>>>> approach seems the more >>>>>>>>>>>> confortable at the moment, by far. My only concern is in >>>>>>>>>>>> the fact >>>>>>>>>>>> that, in the case >>>>>>>>>>>> that there a are lot (a lot!) of static files to be served, >>>>>>>>>>>> the >>>>>>>>>>>> FileServlet could be hit >>>>>>>>>>>> quite heavely, and this could degrade the overall >>>>>>>>>>>> performance. But >>>>>>>>>>>> probably this is >>>>>>>>>>>> just speculation and won't be a great problem in practice. >>>>>>>>>>>> >>>>>>>>>>>> I also think that a rake goal to procude a war-packaged >>>>>>>>>>>> rails app is >>>>>>>>>>>> waiting at the >>>>>>>>>>>> door, do you think ;-) ? >>>>>>>>>>>> >>>>>>>>>>>> Fausto >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> On 11/12/06, Robert Egglestone >>>>>>>>>>>> wrote: >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>>> Hi Fausto, >>>>>>>>>>>>> >>>>>>>>>>>>> Thanks for trying it out. I've added in an Ant build file >>>>>>>>>>>>> which should make >>>>>>>>>>>>> things easier. >>>>>>>>>>>>> >>>>>>>>>>>>> I was expecting to have to use /WEB-INF/ruby, but it turns >>>>>>>>>>>>> out that JRuby >>>>>>>>>>>>> can get the .rb file from inside jars, so the >>>>>>>>>>>>> rails-integration jar should >>>>>>>>>>>>> be able to contain these as well. Conceivably I guess we >>>>>>>>>>>>> could even package >>>>>>>>>>>>> up gems as jar files to make self-contained web apps. >>>>>>>>>>>>> >>>>>>>>>>>>> I'm not sure about the best way to deal with the static >>>>>>>>>>>>> files. The >>>>>>>>>>>>> FileServlet approach isn't great, however rearranging the >>>>>>>>>>>>> Rails app isn't >>>>>>>>>>>>> ideal either. We could suggest that if people intend the >>>>>>>>>>>>> Rails app to be >>>>>>>>>>>>> mostly used with JRuby, then they rearrange the structure >>>>>>>>>>>>> to move public to >>>>>>>>>>>>> the top. Alternatively, if they're wanting something >>>>>>>>>>>>> that's compatible with >>>>>>>>>>>>> both Ruby and JRuby, then they go with FileServlet. >>>>>>>>>>>>> >>>>>>>>>>>>> Cheers, >>>>>>>>>>>>> Robert >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> Fausto Lelli wrote: >>>>>>>>>>>>> Hi Robert, >>>>>>>>>>>>> >>>>>>>>>>>>> helloworld is working and the static files are reachable, >>>>>>>>>>>>> but I needed to add the WEB-INF/ruby/builtin directory into >>>>>>>>>>>>> the helloworld dir and add the loadpath in the RailsServlet >>>>>>>>>>>>> >>>>>>>>>>>>> // setup the load paths >>>>>>>>>>>>> List loadPaths = new ArrayList(); >>>>>>>>>>>>> loadPaths.add(railsRoot); >>>>>>>>>>>>> loadPaths.add(getPath("/WEB-INF/ruby")); >>>>>>>>>>>>> >>>>>>>>>>>>> I'm not using maven (I don't have it installed yet) so the >>>>>>>>>>>>> dir thing >>>>>>>>>>>>> is settled by it, I just don't know. >>>>>>>>>>>>> >>>>>>>>>>>>> Cheers, >>>>>>>>>>>>> Fausto >>>>>>>>>>>>> >>>>>>>>>>>>> On 11/12/06, Robert Egglestone >>>>>>>>>>>>> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> Hi all, >>>>>>>>>>>>> >>>>>>>>>>>>> I've checked the latest version of the initial WAR code I >>>>>>>>>>>>> had into the >>>>>>>>>>>>> subversion repository at: >>>>>>>>>>>>> svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> It currently contains two parts: >>>>>>>>>>>>> + rails-integration is a JAR library, which contains >>>>>>>>>>>>> RailsServlet, >>>>>>>>>>>>> FileServlet, and associated Ruby code. >>>>>>>>>>>>> + samples/helloworld is a very simple Rails application plus >>>>>>>>>>>>> WEB-INF/web.xml and pom.xml. >>>>>>>>>>>>> >>>>>>>>>>>>> If anyone could try it out and see if you run into any >>>>>>>>>>>>> problems it would >>>>>>>>>>>>> be much appreciated. >>>>>>>>>>>>> >>>>>>>>>>>>> Some of the changes from before: >>>>>>>>>>>>> + Error messages are a lot better >>>>>>>>>>>>> + Fausto's real path fix has been added in >>>>>>>>>>>>> + The webapp directory layout is now the standard Rails >>>>>>>>>>>>> one (This also >>>>>>>>>>>>> means that mvn jetty:run can be used to run them in-place). >>>>>>>>>>>>> + FileServlet has been added to handle static files >>>>>>>>>>>>> >>>>>>>>>>>>> Cheers, >>>>>>>>>>>>> Robert >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> ------------------------------------------------------------------------ >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Jruby-extras-devel mailing list >>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Jruby-extras-devel mailing list >>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------ >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Jruby-extras-devel mailing list >>>>>> Jruby-extras-devel at rubyforge.org >>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ >>>>> Jruby-extras-devel mailing list >>>>> Jruby-extras-devel at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> >>>> _______________________________________________ >>>> Jruby-extras-devel mailing list >>>> Jruby-extras-devel at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>> >>>> >>>> >>> >>> >>> _______________________________________________ >>> Jruby-extras-devel mailing list >>> Jruby-extras-devel at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Jruby-extras-devel mailing list >> Jruby-extras-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >> >> > From Ashish.Sahni at Sun.COM Wed Nov 29 18:58:28 2006 From: Ashish.Sahni at Sun.COM (Ashish Sahni) Date: Wed, 29 Nov 2006 15:58:28 -0800 Subject: [Jruby-extras-devel] WAR'ing a RoR app Message-ID: <456E1EA4.9010102@sun.com> Hi Folks, I guess one of the (obvious) goals of the rails-integration project would be to come up with a simple way via which a standard RoR app can be bundled as a WAR file. Would rake file be the candidate here ? Also, when is rails-integration-snapshot going to make it as a separate binary downloadable ? Any other thoughts on the matter ? Thanks Ashish From charles.nutter at sun.com Wed Nov 29 23:40:37 2006 From: charles.nutter at sun.com (Charles Oliver Nutter) Date: Wed, 29 Nov 2006 22:40:37 -0600 Subject: [Jruby-extras-devel] WAR'ing a RoR app In-Reply-To: <456E1EA4.9010102@sun.com> References: <456E1EA4.9010102@sun.com> Message-ID: <456E60C5.7010505@sun.com> Ashish Sahni wrote: > Hi Folks, > > I guess one of the (obvious) goals of the rails-integration project would be > to come up with a simple way via which a standard RoR app can be bundled > as a WAR file. > > Would rake file be the candidate here ? Also, when is > rails-integration-snapshot > going to make it as a separate binary downloadable ? > Any other thoughts on the matter ? I'm obviously super interested in Rails-in-a-WAR, since suddenly Rails gets all the deployment benefit of a classic Java web application. And I believe it's possible; I already have an ant target that creates a complete Ruby interpreter in a single jar; the next step of stuffing Rails and a Rails app in there doesn't seem far away... -- Charles Oliver Nutter, JRuby Core Developer Blogging on Ruby and Java @ headius.blogspot.com Help spec out Ruby today! @ www.headius.com/rubyspec headius at headius.com -- charles.nutter at sun.com From Keefe.Hayes at sas.com Thu Nov 30 11:37:22 2006 From: Keefe.Hayes at sas.com (Keefe Hayes) Date: Thu, 30 Nov 2006 11:37:22 -0500 Subject: [Jruby-extras-devel] DB2 JDBC interprets IDs as strings Message-ID: I am using the activerecord-jdbc interface from rails under jruby to talk to a db2 data base. When selecting a row by id to display, the generated select quotes the id value: SELECT ... ID = '1' ... DB2 returns a type mismatch error. I looked at the 'quote' code that sanitize calls and see that the parameter 'value' passed in is of type String. I have poked back through the various 'find' methods to see where the type of ID is determined, but I cannot track this down. Perhaps this occurs well before this in building metadata about the table. Where should I be looking? I am hoping that the type data is simply not being recognized properly. From Ashish.Sahni at Sun.COM Thu Nov 30 13:54:41 2006 From: Ashish.Sahni at Sun.COM (Ashish Sahni) Date: Thu, 30 Nov 2006 10:54:41 -0800 Subject: [Jruby-extras-devel] WAR'ing a RoR app In-Reply-To: <456E60C5.7010505@sun.com> References: <456E1EA4.9010102@sun.com> <456E60C5.7010505@sun.com> Message-ID: <456F28F1.7070408@sun.com> Thats great ! For a ruby newbie like can you clarify ... Currently the ruby dependencies seem to be 1. JRuby runtime interpreter 2. Rails framework libraries 3. Rails-integration glue code 4. RoR application code. Is the goal of the complete-ruby to have all of these dependencies bundled as one ? Also, how are we envisioning the ruby developers to use this facility to go from have a RoR app to a war file in one-magical-command ? Thanks Ashish Charles Oliver Nutter wrote: > Ashish Sahni wrote: > >> Hi Folks, >> >> I guess one of the (obvious) goals of the rails-integration project would be >> to come up with a simple way via which a standard RoR app can be bundled >> as a WAR file. >> >> Would rake file be the candidate here ? Also, when is >> rails-integration-snapshot >> going to make it as a separate binary downloadable ? >> Any other thoughts on the matter ? >> > > I'm obviously super interested in Rails-in-a-WAR, since suddenly Rails > gets all the deployment benefit of a classic Java web application. And I > believe it's possible; I already have an ant target that creates a > complete Ruby interpreter in a single jar; the next step of stuffing > Rails and a Rails app in there doesn't seem far away... > > From Ashish.Sahni at Sun.COM Thu Nov 30 14:12:50 2006 From: Ashish.Sahni at Sun.COM (Ashish Sahni) Date: Thu, 30 Nov 2006 11:12:50 -0800 Subject: [Jruby-extras-devel] Multipleparameter assignment errors Message-ID: <456F2D32.6030204@sun.com> Hi Folks, Quite frequently I see this multipleparameter assignment error(see below) which seems to correct itself if the same action(db update) is attempted again. Any ideas how/why things get into an inconsistent state ? Thanks Ashish ActiveRecord::MultiparameterAssignmentErrors in RecipeController#update ActiveRecord::MultiparameterAssignmentErrors |RAILS_ROOT: /home/ashish/gf91/publish/glassfish/domains/domain1/applications/j2ee-modules/whatever/config/..| Application Trace | Framework Trace | Full Trace |/abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:2003:in `execute_callstack_for_multiparameter_attributes' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1984:in `assign_multiparameter_attributes' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1513:in `attributes=' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:44:in `update' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:947:in `send' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:947:in `perform_action' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:371:in `perform_action' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:68:in `perform_action' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `measure' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:76:in `perform_action' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform_action_with_rescue' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `send' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `process' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in `process_with_session_management_support' /home/ashish/gf91/publish/glassfish/domains/domain1/generated/jsp/j2ee-modules/whatever/loader/builtin/rails-integration/java_servlet_dispatcher.rb:14:in `dispatch' :-1| |/abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:2003:in `execute_callstack_for_multiparameter_attributes' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1984:in `assign_multiparameter_attributes' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1513:in `attributes=' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:44:in `update' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:947:in `send' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:947:in `perform_action' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:371:in `perform_action' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:68:in `perform_action' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `measure' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:76:in `perform_action' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform_action_with_rescue' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `send' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `process' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in `process_with_session_management_support' /home/ashish/gf91/publish/glassfish/domains/domain1/generated/jsp/j2ee-modules/whatever/loader/builtin/rails-integration/java_servlet_dispatcher.rb:14:in `dispatch'| |/abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:2003:in `execute_callstack_for_multiparameter_attributes' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1984:in `assign_multiparameter_attributes' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1513:in `attributes=' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:44:in `update' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:947:in `send' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:947:in `perform_action' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:371:in `perform_action' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:68:in `perform_action' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `measure' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:76:in `perform_action' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform_action_with_rescue' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `send' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `process' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process' /abc/jruby-0.9.1/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in `process_with_session_management_support' /home/ashish/gf91/publish/glassfish/domains/domain1/generated/jsp/j2ee-modules/whatever/loader/builtin/rails-integration/java_servlet_dispatcher.rb:14:in `dispatch' :-1| Request *Parameters*: {"id"=>"1", "recipe"=>{"id"=>"1", "date(3i)"=>"11", "title"=>"Hot Chips mmmm", "instructions"=>" aaaaaa Sprinkle hot-pepper sauce on corn chips.\r\n ", "description"=>"Only for the brave! bbbb", "date(1i)"=>"2007", "date(2i)"=>"11"}, "commit"=>"Update"} Show session dump --- Response *Headers*: {} From robert at cs.auckland.ac.nz Thu Nov 30 15:22:38 2006 From: robert at cs.auckland.ac.nz (Robert Egglestone) Date: Fri, 01 Dec 2006 09:22:38 +1300 Subject: [Jruby-extras-devel] WAR'ing a RoR app In-Reply-To: <456F28F1.7070408@sun.com> References: <456E1EA4.9010102@sun.com> <456E60C5.7010505@sun.com> <456F28F1.7070408@sun.com> Message-ID: <456F3D8E.50408@cs.auckland.ac.nz> Building the war file will most likely take the form of a Rake task, however as far as I know no-one has had a look at doing this yet. I'll have a go at it this weekend. Cheers, Robert Ashish Sahni wrote: > Thats great ! For a ruby newbie like can you clarify ... > > Currently the ruby dependencies seem to be > 1. JRuby runtime interpreter > 2. Rails framework libraries > 3. Rails-integration glue code > 4. RoR application code. > > Is the goal of the complete-ruby to have all of these dependencies > bundled as one ? > Also, how are we envisioning the ruby developers to use this facility to > go from > have a RoR app to a war file in one-magical-command ? > > Thanks > Ashish > > Charles Oliver Nutter wrote: > >> Ashish Sahni wrote: >> >> >>> Hi Folks, >>> >>> I guess one of the (obvious) goals of the rails-integration project would be >>> to come up with a simple way via which a standard RoR app can be bundled >>> as a WAR file. >>> >>> Would rake file be the candidate here ? Also, when is >>> rails-integration-snapshot >>> going to make it as a separate binary downloadable ? >>> Any other thoughts on the matter ? >>> >>> >> I'm obviously super interested in Rails-in-a-WAR, since suddenly Rails >> gets all the deployment benefit of a classic Java web application. And I >> believe it's possible; I already have an ant target that creates a >> complete Ruby interpreter in a single jar; the next step of stuffing >> Rails and a Rails app in there doesn't seem far away... >> >> >> > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20061201/c2fb7a89/attachment.html From robert at cs.auckland.ac.nz Thu Nov 30 15:11:31 2006 From: robert at cs.auckland.ac.nz (Robert Egglestone) Date: Fri, 01 Dec 2006 09:11:31 +1300 Subject: [Jruby-extras-devel] WAR deployment In-Reply-To: <456DE946.6090903@sun.com> References: <4554B46D.2050502@perspecsys.com> <4556DF3F.9040403@cs.auckland.ac.nz> <455794A5.8050806@cs.auckland.ac.nz> <4557D399.5040301@cs.auckland.ac.nz> <4558DDA5.9050302@sun.com> <4558E8B1.7020208@cs.auckland.ac.nz> <45592F87.7030307@sun.com> <455A10B3.3090208@sun.com> <455A2989.8060104@cs.auckland.ac.nz> <455A6B14.9060407@sun.com> <455AB82D.20807@cs.auckland.ac.nz> <455B63C4.9030700@sun.com> <455B74E3.3080302@cs.auckland.ac.nz> <456DE870.80701@sun.com> <456DE946.6090903@sun.com> Message-ID: <456F3AF3.2030604@cs.auckland.ac.nz> I've checked in a change that should fix the redirect problem. I had thought request.host referred to the client's address, but it's really the address of the server. Cheers, Robert Ashish Sahni wrote: > I think my brains are still in vacation mode ;) > 129.145.133.50 is the ip of browser-host ie., user-agent > > Ashish Sahni wrote: > >> (apologies for the delayed response) >> The problem seems to be caused by the value of the 'Host' header in >> the response >> Relevant snippet from the attached file(129.145.133.50 is the http >> proxy server's ip) >> >> GET /helloworld/widget/show/3 HTTP/1.1 >> Host: 129.145.133.50:8080 >> >> Thanks >> Ashish >> >> Robert Egglestone wrote: >> >>> Would it be possible to post the full response that's being sent >>> back to the browser please? >>> This might help to see what's going on: >>> curl -i --interface 127.0.0.1 >>> http://localhost:8080/scaffoldtest/accounts/update/1 -d >>> "account[name]=hello&account[budget]=2&commit=Edit" >>> >>> Cheers, >>> Robert >>> >>> >>> Ashish Sahni wrote: >>> >>>> Robert Egglestone wrote: >>>> >>>> >>>> >>>>> The redirect problem was caused by the status and location headers >>>>> getting mangled. This should be fixed now. >>>>> >>>> >>>> >>>> Hmm ... I'm still seeing the redirect issue :( >>>> But the db insertions seem to be working - fantastic work! thanks ! >>>> >>>> -Ashish >>>> >>>> >>>> >>>>> The form post data was because it wasn't taking consideration of >>>>> nested keys (e.g. account[name]). This part of it should be >>>>> working now, however there will still be a few other cases that >>>>> have problems (e.g. uploaded files). >>>>> >>>>> Cheers, >>>>> Robert >>>>> >>>>> >>>>> Ashish Sahni wrote: >>>>> >>>>> >>>>>> Great ! Thanks ! >>>>>> Then the other issue of redirection probably falls in the same >>>>>> bucket - after a create action >>>>>> is completed a redirection page with the user agents ip address >>>>>> is displayed - >>>>>> 'You are being redirected' >>>>>> >>>>>> With redirection link being of the form >>>>>> http://:///list >>>>>> >>>>>> The user-agent-ip-address should be replaced by the server's ip >>>>>> address but I think using relative URI might be better. >>>>>> >>>>>> Thanks >>>>>> Ashish >>>>>> >>>>>> >>>>>> Robert Egglestone wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> It looks like CgiResponse has some special handling of the >>>>>>> content-type header that I missed out of JavaServletResponse. >>>>>>> >>>>>>> Cheers, >>>>>>> Robert >>>>>>> >>>>>>> >>>>>>> Ashish Sahni wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>>> Looks like the content-type thingy is a bit of both. The rails >>>>>>>> app/framework deployed as a war >>>>>>>> does not set the content-type header and so its up to the >>>>>>>> container to set the content-type in >>>>>>>> the response. Its a bit odd but I guess its a question for the >>>>>>>> rails-framework folks. >>>>>>>> >>>>>>>> Has anybody got a rails-app-as-a-war working with the db ? >>>>>>>> Viewing the db contents >>>>>>>> seems to be working but editing/creating does not. Anyone ? >>>>>>>> >>>>>>>> Thanks >>>>>>>> Ashish >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Ashish Sahni wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> Hi Folks, >>>>>>>>> >>>>>>>>> I'm able to connect a rails app deployed as a war file and it >>>>>>>>> seems to be working (to an extent) ! >>>>>>>>> >>>>>>>>> The problem seems to be with the content-type of the http >>>>>>>>> response. The browser >>>>>>>>> is interpreting it as text/plain but it really is html >>>>>>>>> content. Its deployed on glassfish appserver. >>>>>>>>> Any ideas - is it a rails-on-jruby thingy or the container >>>>>>>>> issue ? >>>>>>>>> >>>>>>>>> (snip) >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> Inside a war file we could put all the rails files into a >>>>>>>>>> directory (previously they were in WEB-INF/rails), however >>>>>>>>>> for an exploded webapp it may become a problem for anyone >>>>>>>>>> that wants to take an existing rails application and use it >>>>>>>>>> with jruby without changing the existing structure. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> I don't quite see the problem you are referring to. Could you >>>>>>>>> explain a bit more ? >>>>>>>>> >>>>>>>>> Thanks >>>>>>>>> Ashish >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> javaRequest and javaResponse are the actual servlet >>>>>>>>>> request/response objects. They're passed through from the >>>>>>>>>> RailsServlet: >>>>>>>>>> protected void service(HttpServletRequest request, >>>>>>>>>> HttpServletResponse response) throws ServletException, >>>>>>>>>> IOException { >>>>>>>>>> Object[] args = { request, response }; >>>>>>>>>> JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", >>>>>>>>>> args, void.class); >>>>>>>>>> } >>>>>>>>>> I believe JavaEmbedUtils wraps them in RubyObjects so that >>>>>>>>>> they can be used directly in Ruby code. >>>>>>>>>> >>>>>>>>>> Cheers, >>>>>>>>>> Robert >>>>>>>>>> >>>>>>>>>> Ashish Sahni wrote: >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> Hi Robert, >>>>>>>>>>> Thanks for all the great work ! I've been trying to get a >>>>>>>>>>> rails app run as a web app, so this >>>>>>>>>>> effort is awesome and I'm now able to get the helloworld >>>>>>>>>>> sample working ;) >>>>>>>>>>> >>>>>>>>>>> Some comments/questions: >>>>>>>>>>> - I think it would be useful it the jruby interpreter is >>>>>>>>>>> acquire via the javax.scripting interface(jsr223 - new in >>>>>>>>>>> mustang). I don't know if it'll be a seemless transition >>>>>>>>>>> from the JavaEmbedUtils but should make things a lot >>>>>>>>>>> more standardized. Ofcourse it require use of java 1.6 >>>>>>>>>>> - The rails servlet executes just one ruby script - >>>>>>>>>>> basically a combination of 'require config/environment' >>>>>>>>>>> and 'require java_servlet_dispatcher' >>>>>>>>>>> - Move all the ruby-rails files and directories under a >>>>>>>>>>> single directory. CUrrently they are all in a top-level >>>>>>>>>>> web application dir. So it would look something like >>>>>>>>>>> -- WEB-INF >>>>>>>>>>> -- railsFiles/app >>>>>>>>>>> -- railsFiles/config >>>>>>>>>>> -- railsFiles/components ... >>>>>>>>>>> - Since I'm new to the ruby language and rails I'd like to >>>>>>>>>>> understand how/where in the ruby framework >>>>>>>>>>> do the javaRequest and javaResponse parameters in >>>>>>>>>>> self.dispatch method in java-servlet-dipatcher code >>>>>>>>>>> get created/bound to the underlying actual http-servlet >>>>>>>>>>> request/response objects. Anyone ? >>>>>>>>>>> >>>>>>>>>>> Thanks >>>>>>>>>>> Ashish >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Robert Egglestone wrote: >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>> Ah, oops, it turns out I had the jars on my classpath. I've >>>>>>>>>>>> fixed up the build file and readme with the changes, thanks. >>>>>>>>>>>> >>>>>>>>>>>> I'm not very familiar with rake, but certainly being able >>>>>>>>>>>> to package everything up from a single command would make >>>>>>>>>>>> things easier. >>>>>>>>>>>> >>>>>>>>>>>> Cheers, >>>>>>>>>>>> Robert >>>>>>>>>>>> >>>>>>>>>>>> Fausto Lelli wrote: >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>>> Hi Robert, >>>>>>>>>>>>> an outstanding job as usual, just two things: >>>>>>>>>>>>> 1) in the ant file, also the servlet api jar need to >>>>>>>>>>>>> included in the classpath >>>>>>>>>>>>> jasper-runtime.jar, jsp-api.jar, and servlet-api.jar (I >>>>>>>>>>>>> cannot make the >>>>>>>>>>>>> patch myself because I don't know the best way to deal >>>>>>>>>>>>> this kind >>>>>>>>>>>>> of dependence within maven) >>>>>>>>>>>>> 2)in the read me file, also remember to copy all the jruby >>>>>>>>>>>>> related jar >>>>>>>>>>>>> file in the lib directory of the webapp (jruby,asm,bsf ecc) >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>>> be able to contain these as well. Conceivably I guess we >>>>>>>>>>>>>> could even package >>>>>>>>>>>>>> up gems as jar files to make self-contained web apps. >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> Intriguing, really. >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>>> ideal either. We could suggest that if people intend the >>>>>>>>>>>>>> Rails app to be >>>>>>>>>>>>>> mostly used with JRuby, then they rearrange the structure >>>>>>>>>>>>>> to move public to >>>>>>>>>>>>>> the top. Alternatively, if they're wanting something >>>>>>>>>>>>>> that's compatible with >>>>>>>>>>>>>> both Ruby and JRuby, then they go with FileServlet. >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> Exactly. There's choices even! Anyway the FileServlet >>>>>>>>>>>>> approach seems the more >>>>>>>>>>>>> confortable at the moment, by far. My only concern is in >>>>>>>>>>>>> the fact >>>>>>>>>>>>> that, in the case >>>>>>>>>>>>> that there a are lot (a lot!) of static files to be >>>>>>>>>>>>> served, the >>>>>>>>>>>>> FileServlet could be hit >>>>>>>>>>>>> quite heavely, and this could degrade the overall >>>>>>>>>>>>> performance. But >>>>>>>>>>>>> probably this is >>>>>>>>>>>>> just speculation and won't be a great problem in practice. >>>>>>>>>>>>> >>>>>>>>>>>>> I also think that a rake goal to procude a war-packaged >>>>>>>>>>>>> rails app is >>>>>>>>>>>>> waiting at the >>>>>>>>>>>>> door, do you think ;-) ? >>>>>>>>>>>>> >>>>>>>>>>>>> Fausto >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> On 11/12/06, Robert Egglestone >>>>>>>>>>>>> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>>> Hi Fausto, >>>>>>>>>>>>>> >>>>>>>>>>>>>> Thanks for trying it out. I've added in an Ant build file >>>>>>>>>>>>>> which should make >>>>>>>>>>>>>> things easier. >>>>>>>>>>>>>> >>>>>>>>>>>>>> I was expecting to have to use /WEB-INF/ruby, but it >>>>>>>>>>>>>> turns out that JRuby >>>>>>>>>>>>>> can get the .rb file from inside jars, so the >>>>>>>>>>>>>> rails-integration jar should >>>>>>>>>>>>>> be able to contain these as well. Conceivably I guess we >>>>>>>>>>>>>> could even package >>>>>>>>>>>>>> up gems as jar files to make self-contained web apps. >>>>>>>>>>>>>> >>>>>>>>>>>>>> I'm not sure about the best way to deal with the static >>>>>>>>>>>>>> files. The >>>>>>>>>>>>>> FileServlet approach isn't great, however rearranging the >>>>>>>>>>>>>> Rails app isn't >>>>>>>>>>>>>> ideal either. We could suggest that if people intend the >>>>>>>>>>>>>> Rails app to be >>>>>>>>>>>>>> mostly used with JRuby, then they rearrange the structure >>>>>>>>>>>>>> to move public to >>>>>>>>>>>>>> the top. Alternatively, if they're wanting something >>>>>>>>>>>>>> that's compatible with >>>>>>>>>>>>>> both Ruby and JRuby, then they go with FileServlet. >>>>>>>>>>>>>> >>>>>>>>>>>>>> Cheers, >>>>>>>>>>>>>> Robert >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> Fausto Lelli wrote: >>>>>>>>>>>>>> Hi Robert, >>>>>>>>>>>>>> >>>>>>>>>>>>>> helloworld is working and the static files are reachable, >>>>>>>>>>>>>> but I needed to add the WEB-INF/ruby/builtin directory into >>>>>>>>>>>>>> the helloworld dir and add the loadpath in the RailsServlet >>>>>>>>>>>>>> >>>>>>>>>>>>>> // setup the load paths >>>>>>>>>>>>>> List loadPaths = new ArrayList(); >>>>>>>>>>>>>> loadPaths.add(railsRoot); >>>>>>>>>>>>>> loadPaths.add(getPath("/WEB-INF/ruby")); >>>>>>>>>>>>>> >>>>>>>>>>>>>> I'm not using maven (I don't have it installed yet) so >>>>>>>>>>>>>> the dir thing >>>>>>>>>>>>>> is settled by it, I just don't know. >>>>>>>>>>>>>> >>>>>>>>>>>>>> Cheers, >>>>>>>>>>>>>> Fausto >>>>>>>>>>>>>> >>>>>>>>>>>>>> On 11/12/06, Robert Egglestone >>>>>>>>>>>>>> wrote: >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> Hi all, >>>>>>>>>>>>>> >>>>>>>>>>>>>> I've checked the latest version of the initial WAR code I >>>>>>>>>>>>>> had into the >>>>>>>>>>>>>> subversion repository at: >>>>>>>>>>>>>> svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> It currently contains two parts: >>>>>>>>>>>>>> + rails-integration is a JAR library, which contains >>>>>>>>>>>>>> RailsServlet, >>>>>>>>>>>>>> FileServlet, and associated Ruby code. >>>>>>>>>>>>>> + samples/helloworld is a very simple Rails application plus >>>>>>>>>>>>>> WEB-INF/web.xml and pom.xml. >>>>>>>>>>>>>> >>>>>>>>>>>>>> If anyone could try it out and see if you run into any >>>>>>>>>>>>>> problems it would >>>>>>>>>>>>>> be much appreciated. >>>>>>>>>>>>>> >>>>>>>>>>>>>> Some of the changes from before: >>>>>>>>>>>>>> + Error messages are a lot better >>>>>>>>>>>>>> + Fausto's real path fix has been added in >>>>>>>>>>>>>> + The webapp directory layout is now the standard Rails >>>>>>>>>>>>>> one (This also >>>>>>>>>>>>>> means that mvn jetty:run can be used to run them in-place). >>>>>>>>>>>>>> + FileServlet has been added to handle static files >>>>>>>>>>>>>> >>>>>>>>>>>>>> Cheers, >>>>>>>>>>>>>> Robert >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> ------------------------------------------------------------------------ >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Jruby-extras-devel mailing list >>>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Jruby-extras-devel mailing list >>>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------ >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Jruby-extras-devel mailing list >>>>>>> Jruby-extras-devel at rubyforge.org >>>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Jruby-extras-devel mailing list >>>>>> Jruby-extras-devel at rubyforge.org >>>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>>> >>>>>> >>>>>> >>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> >>>>> _______________________________________________ >>>>> Jruby-extras-devel mailing list >>>>> Jruby-extras-devel at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>>> >>>>> >>>>> >>>> >>>> >>>> _______________________________________________ >>>> Jruby-extras-devel mailing list >>>> Jruby-extras-devel at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>>> >>>> >>> ------------------------------------------------------------------------ >>> >>> >>> _______________________________________________ >>> Jruby-extras-devel mailing list >>> Jruby-extras-devel at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> >> > From headius at headius.com Thu Nov 30 16:45:25 2006 From: headius at headius.com (Charles Oliver Nutter) Date: Thu, 30 Nov 2006 15:45:25 -0600 Subject: [Jruby-extras-devel] DB2 JDBC interprets IDs as strings In-Reply-To: References: Message-ID: <456F50F5.5030301@headius.com> Keefe Hayes wrote: > I am using the activerecord-jdbc interface from rails under jruby to talk to a db2 data base. When selecting a row by id to display, the generated select quotes the id value: > > SELECT ... ID = '1' ... > > DB2 returns a type mismatch error. I looked at the 'quote' code that sanitize calls and see that the parameter 'value' passed in is of type String. > > I have poked back through the various 'find' methods to see where the type of ID is determined, but I cannot track this down. Perhaps this occurs well before this in building metadata about the table. Where should I be looking? I am hoping that the type data is simply not being recognized properly. I'm guessing this is related to the heuristic that attempts to "guess" the correct type based on DB metadata. We're probably not doing the right thing for DB2. Someone want to take a crack at this? I'm gonna be busy getting ready for a conference. It's our first DB2 bug report :) -- Charles Oliver Nutter, JRuby Core Developer Blogging on Ruby and Java @ headius.blogspot.com Help spec out Ruby today! @ www.headius.com/rubyspec headius at headius.com -- charles.nutter at sun.com From charles.nutter at sun.com Thu Nov 30 16:57:29 2006 From: charles.nutter at sun.com (Charles Oliver Nutter) Date: Thu, 30 Nov 2006 15:57:29 -0600 Subject: [Jruby-extras-devel] WAR'ing a RoR app In-Reply-To: <456F3D8E.50408@cs.auckland.ac.nz> References: <456E1EA4.9010102@sun.com> <456E60C5.7010505@sun.com> <456F28F1.7070408@sun.com> <456F3D8E.50408@cs.auckland.ac.nz> Message-ID: <456F53C9.3010203@sun.com> Robert Egglestone wrote: > Building the war file will most likely take the form of a Rake task, > however as far as I know no-one has had a look at doing this yet. > I'll have a go at it this weekend. Ashish: Yes, that's the goal. All in one WAR file, with reasonable defaults for handling requests and hooking up to the DB. Robert: rake is one option I've talked about before, but another option would be a generator: jruby script/generate warfile -- Charles Oliver Nutter, JRuby Core Developer Blogging on Ruby and Java @ headius.blogspot.com Help spec out Ruby today! @ www.headius.com/rubyspec headius at headius.com -- charles.nutter at sun.com