Skip to content

Instantly share code, notes, and snippets.

@qmx
Forked from napcs/Gemfile
Created June 10, 2011 03:25
Show Gist options
  • Save qmx/1018183 to your computer and use it in GitHub Desktop.
Save qmx/1018183 to your computer and use it in GitHub Desktop.
warbler + sinatra problem
reproducable warbler issue. Change the public directory in lib/server.rb to someplace with jquery.min.js in it and serve it.
Under JRuby with
rackup config.ru
everything works great.
But with
jruby -S warble executable war
and then running with java -jar warname.war
when I visit http://localhost:8080/jquery.min.js
It truncates for me with safari, ff, chrome, and curl. I'm extremely lost.
require 'rubygems'
require 'lib/server'
set :run, false
run Sinatra::Application
source :rubygems
gem 'sinatra', '1.2.3'
gem 'tilt', "1.3"
gem 'rack', "1.2.2"
gem 'sinatra-respond_to', '0.7.0'
## THIS MUST BE IN lib/server.rb BUT GIST WON'T LET ME PUT IT THERE!
require 'bundler/setup'
require 'fileutils'
require 'sinatra'
#Sinatra::Application.register Sinatra::RespondTo
set :public, "/Users/brianhogan/oss/files"
get "/" do
puts "hai there."
end
# Disable Rake-environment-task framework detection by uncommenting/setting to false
# Warbler.framework_detection = false
# Warbler web application assembly configuration file
Warbler::Config.new do |config|
# Features: additional options controlling how the jar is built.
# Currently the following features are supported:
# - gemjar: package the gem repository in a jar file in WEB-INF/lib
# - executable: embed a web server and make the war executable
# - compiled: compile .rb files to .class files
config.features = %w(executable)
# Application directories to be included in the webapp.
config.dirs = %w(app config lib log vendor tmp)
# Additional files/directories to include, above those in config.dirs
# config.includes = FileList["db"]
# Additional files/directories to exclude
# config.excludes = FileList["lib/tasks/*"]
# Additional Java .jar files to include. Note that if .jar files are placed
# in lib (and not otherwise excluded) then they need not be mentioned here.
# JRuby and JRuby-Rack are pre-loaded in this list. Be sure to include your
# own versions if you directly set the value
# config.java_libs += FileList["lib/java/*.jar"]
# Loose Java classes and miscellaneous files to be included.
# config.java_classes = FileList["target/classes/**.*"]
# One or more pathmaps defining how the java classes should be copied into
# the archive. The example pathmap below accompanies the java_classes
# configuration above. See http://rake.rubyforge.org/classes/String.html#M000017
# for details of how to specify a pathmap.
# config.pathmaps.java_classes << "%{target/classes/,}p"
# Bundler support is built-in. If Warbler finds a Gemfile in the
# project directory, it will be used to collect the gems to bundle
# in your application. If you wish to explicitly disable this
# functionality, uncomment here.
# config.bundler = false
# An array of Bundler groups to avoid including in the war file.
# Defaults to ["development", "test"].
# config.bundle_without = []
# Other gems to be included. If you don't use Bundler or a gemspec
# file, you need to tell Warbler which gems your application needs
# so that they can be packaged in the archive.
# For Rails applications, the Rails gems are included by default
# unless the vendor/rails directory is present.
# config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl"]
# config.gems << "tzinfo"
# Uncomment this if you don't want to package rails gem.
# config.gems -= ["rails"]
# The most recent versions of gems are used.
# You can specify versions of gems by using a hash assignment:
# config.gems["rails"] = "2.3.10"
# You can also use regexps or Gem::Dependency objects for flexibility or
# finer-grained control.
# config.gems << /^merb-/
# config.gems << Gem::Dependency.new("merb-core", "= 0.9.3")
# Include gem dependencies not mentioned specifically. Default is
# true, uncomment to turn off.
# config.gem_dependencies = false
# Array of regular expressions matching relative paths in gems to be
# excluded from the war. Defaults to empty, but you can set it like
# below, which excludes test files.
# config.gem_excludes = [/^(test|spec)\//]
# Pathmaps for controlling how application files are copied into the archive
# config.pathmaps.application = ["WEB-INF/%p"]
# Name of the archive (without the extension). Defaults to the basename
# of the project directory.
# config.jar_name = "mywar"
# Name of the MANIFEST.MF template for the war file. Defaults to a simple
# MANIFEST.MF that contains the version of Warbler used to create the war file.
# config.manifest_file = "config/MANIFEST.MF"
# When using the 'compiled' feature and specified, only these Ruby
# files will be compiled. Default is to compile all \.rb files in
# the application.
# config.compiled_ruby_files = FileList['app/**/*.rb']
# === War files only below here ===
# Path to the pre-bundled gem directory inside the war file. Default
# is 'WEB-INF/gems'. Specify path if gems are already bundled
# before running Warbler. This also sets 'gem.path' inside web.xml.
# config.gem_path = "WEB-INF/vendor/bundler_gems"
# Files for WEB-INF directory (next to web.xml). This contains
# web.xml by default. If there is an .erb-File it will be processed
# with webxml-config. You may want to exclude this file via
# config.excludes.
# config.webinf_files += FileList["jboss-web.xml"]
# Files to be included in the root of the webapp. Note that files in public
# will have the leading 'public/' part of the path stripped during staging.
# config.public_html = FileList["public/**/*", "doc/**/*"]
# Pathmaps for controlling how public HTML files are copied into the .war
# config.pathmaps.public_html = ["%{public/,}p"]
# Value of RAILS_ENV for the webapp -- default as shown below
# config.webxml.rails.env = ENV['RAILS_ENV'] || 'production'
# Application booter to use, one of :rack, :rails, or :merb (autodetected by default)
# config.webxml.booter = :rails
# Set JRuby to run in 1.9 mode.
# config.webxml.jruby.compat.version = "1.9"
# When using the :rack booter, "Rackup" script to use.
# - For 'rackup.path', the value points to the location of the rackup
# script in the web archive file. You need to make sure this file
# gets included in the war, possibly by adding it to config.includes
# or config.webinf_files above.
# - For 'rackup', the rackup script you provide as an inline string
# is simply embedded in web.xml.
# The script is evaluated in a Rack::Builder to load the application.
# Examples:
# config.webxml.rackup.path = 'WEB-INF/hello.ru'
# config.webxml.rackup = %{require './lib/demo'; run Rack::Adapter::Camping.new(Demo)}
# config.webxml.rackup = require 'cgi' && CGI::escapeHTML(File.read("config.ru"))
# Control the pool of Rails runtimes. Leaving unspecified means
# the pool will grow as needed to service requests. It is recommended
# that you fix these values when running a production server!
# config.webxml.jruby.min.runtimes = 2
# config.webxml.jruby.max.runtimes = 4
# JNDI data source name
# config.webxml.jndi = 'jdbc/rails'
end
--2011-06-10 00:32:41-- http://localhost:8080/jquery.min.js
Resolving localhost... ::1, fe80::1, 127.0.0.1
Connecting to localhost|::1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 91342 (89K) [application/javascript]
Saving to: `jquery.min.js.5'
0K .......... .......... .... 26% 1.76M=0.01s
2011-06-10 00:32:51 (1.76 MB/s) - Connection closed at byte 24576. Retrying.
--2011-06-10 00:32:52-- (try: 2) http://localhost:8080/jquery.min.js
Connecting to localhost|::1|:8080... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 91342 (89K), 66766 (65K) remaining [application/javascript]
Saving to: `jquery.min.js.5'
0K ,,,,,,,,,, ,,,,,,,,,, ,,,,...... .......... ........ 53% 1.67M=0.01s
2011-06-10 00:33:02 (1.67 MB/s) - Connection closed at byte 49152. Retrying.
--2011-06-10 00:33:04-- (try: 3) http://localhost:8080/jquery.min.js
Connecting to localhost|::1|:8080... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 91342 (89K), 42190 (41K) remaining [application/javascript]
Saving to: `jquery.min.js.5'
0K ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,.. 56% 3.97G 0s
50K .......... .......... .. 80% 1.32M=0.02s
2011-06-10 00:33:14 (1.44 MB/s) - Connection closed at byte 73728. Retrying.
--2011-06-10 00:33:17-- (try: 4) http://localhost:8080/jquery.min.js
Connecting to localhost|::1|:8080... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 91342 (89K), 17614 (17K) remaining [application/javascript]
Saving to: `jquery.min.js.5'
[ skipping 50K ]
50K ,,,,,,,,,, ,,,,,,,,,, ,,........ ........ 98% 1.21M=0.01s
2011-06-10 00:33:27 (1.21 MB/s) - Connection closed at byte 90112. Retrying.
--2011-06-10 00:33:31-- (try: 5) http://localhost:8080/jquery.min.js
Connecting to localhost|::1|:8080... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 91342 (89K), 1230 (1.2K) remaining [application/javascript]
Saving to: `jquery.min.js.5'
[ skipping 50K ]
50K ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,. 100% 130M=0s
2011-06-10 00:33:31 (130 MB/s) - `jquery.min.js.5' saved [91342/91342]
[webapp 2011/06/10 00:32:08] - jruby 1.6.1 (ruby-1.8.7-p330) (2011-04-12 85838f6) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_22) [darwin-x86_64-java]
[Winstone 2011/06/10 00:32:17] - Listener winstone.ajp13.Ajp13Listener not found / disabled - ignoring
[Winstone 2011/06/10 00:32:17] - Listener winstone.ssl.HttpsListener not found / disabled - ignoring
[Winstone 2011/06/10 00:32:17] - Winstone Servlet Engine v0.9.10 running: controlPort=disabled
[Winstone 2011/06/10 00:32:17] - HTTP Listener started: port=8080
[webapp 2011/06/10 00:32:34] - 0:0:0:0:0:0:0:1%0 - [10/Jun/2011 00:32:34] "GET /jquery.min.js " 200 91342 0.0190
[webapp 2011/06/10 00:32:41] - 0:0:0:0:0:0:0:1%0 - [10/Jun/2011 00:32:41] "GET /jquery.min.js " 200 91342 0.0040
[webapp 2011/06/10 00:32:52] - 0:0:0:0:0:0:0:1%0 - [10/Jun/2011 00:32:52] "GET /jquery.min.js " 206 66766 0.0040
[webapp 2011/06/10 00:33:04] - 0:0:0:0:0:0:0:1%0 - [10/Jun/2011 00:33:04] "GET /jquery.min.js " 206 42190 0.0040
[webapp 2011/06/10 00:33:17] - 0:0:0:0:0:0:0:1%0 - [10/Jun/2011 00:33:17] "GET /jquery.min.js " 206 17614 0.0040
[webapp 2011/06/10 00:33:31] - 0:0:0:0:0:0:0:1%0 - [10/Jun/2011 00:33:31] "GET /jquery.min.js " 206 1230 0.0140
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment