File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
src/main/java/org/jruby/rack Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change 7
7
8
8
package org .jruby .rack ;
9
9
10
- import java . io . IOException ;
10
+
11
11
import java .io .File ;
12
+ import java .io .IOException ;
13
+ import java .io .InputStream ;
12
14
import java .lang .reflect .InvocationTargetException ;
13
15
import java .lang .reflect .Method ;
14
16
import java .net .URISyntaxException ;
@@ -531,15 +533,21 @@ private String resolveRackupScript() throws RackInitializationException {
531
533
}
532
534
}
533
535
534
- if (rackup != null ) {
535
- rackupLocation = rackContext .getRealPath (rackup );
536
- try {
537
- rackup = IOHelpers .inputStreamToString (rackContext .getResourceAsStream (rackup ));
536
+ InputStream is = null ;
537
+ try {
538
+ if (rackup != null ) {
539
+ is = rackContext .getResourceAsStream (rackup );
540
+ rackupLocation = rackContext .getRealPath (rackup );
538
541
}
539
- catch ( IOException e ) {
540
- rackContext . log ( RackLogger . ERROR , "failed to read rackup from '" + rackup + "' (" + e + ") " );
541
- throw new RackInitializationException ( "failed to read rackup input" , e ) ;
542
+ else {
543
+ is = Thread . currentThread (). getContextClassLoader (). getResourceAsStream ( "config.ru " );
544
+ rackupLocation = "uri:classloader://config.ru" ;
542
545
}
546
+ rackup = IOHelpers .inputStreamToString (is );
547
+ }
548
+ catch (IOException e ) {
549
+ rackContext .log (RackLogger .ERROR , "failed to read rackup from '" + rackup + "' (" + e + ")" );
550
+ throw new RackInitializationException ("failed to read rackup input" , e );
543
551
}
544
552
}
545
553
You can’t perform that action at this time.
0 commit comments