Skip to content

Commit

Permalink
3.1.5 because it simply does not work with 3.2.0 alpha
Browse files Browse the repository at this point in the history
Fixed headers
  • Loading branch information
pepite committed Mar 5, 2010
1 parent 2c692c2 commit ee3784d
Show file tree
Hide file tree
Showing 8 changed files with 240 additions and 47 deletions.
84 changes: 82 additions & 2 deletions commands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

if play_command == ('netty:run'):
check_application()
load_modules()
Expand All @@ -13,4 +12,85 @@
java_cmd.insert(2, '-Dplay.debug=yes')
subprocess.call(java_cmd, env=os.environ)
print
sys.exit(0)
sys.exit(0)
if play_command == ('netty:test'):
play_id = 'test'
check_application()
load_modules()
do_classpath()
disable_check_jpda = False
if remaining_args.count('-f') == 1:
disable_check_jpda = True
remaining_args.remove('-f')
do_java('play.modules.netty.Server')
print "~ Running in test mode"
print "~ Ctrl+C to stop"
print "~ "
check_jpda()
java_cmd.insert(2, '-Xdebug')
java_cmd.insert(2, '-Xrunjdwp:transport=dt_socket,address=%s,server=y,suspend=n' % jpda_port)
java_cmd.insert(2, '-Dplay.debug=yes')
subprocess.call(java_cmd, env=os.environ)
print
sys.exit(0)
if play_command == 'netty:auto-test':
play_id = 'test'
check_application()
load_modules()
do_classpath()
do_java('play.modules.netty.Server')
print "~ Running in test mode"
print "~ Ctrl+C to stop"
print "~ "
print "~ Deleting %s" % os.path.normpath(os.path.join(application_path, 'tmp'))
if os.path.exists(os.path.join(application_path, 'tmp')):
shutil.rmtree(os.path.join(application_path, 'tmp'))
print "~"
test_result = os.path.join(application_path, 'test-result')
if os.path.exists(test_result):
shutil.rmtree(test_result)
sout = open(os.path.join(log_path, 'system.out'), 'w')
play_process = subprocess.Popen(java_cmd, env=os.environ, stdout=sout)
soutint = open(os.path.join(log_path, 'system.out'), 'r')
while True:
if play_process.poll():
print "~"
print "~ Oops, application has not started?"
print "~"
sys.exit(-1)
line = soutint.readline().strip()
if line:
print line
if line.find('Listening for HTTP') > -1:
soutint.close()
break
# Launch the browser
print "~"
print "~ Loading the test runner at %s ..." % ('http://localhost:%s/@tests' % http_port)
try:
proxy_handler = urllib2.ProxyHandler({})
opener = urllib2.build_opener(proxy_handler)
opener.open('http://localhost:%s/@tests' % http_port);
except urllib2.HTTPError, e:
print "~"
print "~ There are compilation errors... (%s)" % (e.code)
print "~"
kill(play_process.pid)
sys.exit(-1)
print "~ Launching a web browser at http://localhost:%s/@tests?select=all&auto=yes ..." % http_port
webbrowser.open('http://localhost:%s/@tests?select=all&auto=yes' % http_port)
while True:
time.sleep(1)
if os.path.exists(os.path.join(application_path, 'test-result/result.passed')):
print "~"
print "~ All tests passed"
print "~"
kill(play_process.pid)
break
if os.path.exists(os.path.join(application_path, 'test-result/result.failed')):
print "~"
print "~ Some tests have failed. See file://%s for results" % test_result
print "~"
kill(play_process.pid)
break
sys.exit(0)
4 changes: 2 additions & 2 deletions documentation/manual/home.textile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
h1. Netty module

p(note). **Warning! This version contains JBoss Netty 3.2.0 alpha 4. Be sure to remove the previous version of Netty in your module directory**
p(note). **Warning! This version contains JBoss Netty 3.1.5 GA. Be sure to remove the previous version of Netty in your module directory**

The netty module allows you to use JBoss Netty:http://jboss.org/netty as a play! server.

Version 3.2.0 alpha 4 of Netty.
Version 3.1.5 GA of Netty.

h2. <a>Enable the Netty module for the application</a>

Expand Down
Binary file added lib/netty-3.1.5.GA.jar
Binary file not shown.
Binary file removed lib/netty-3.2.0.ALPHA4.jar
Binary file not shown.
10 changes: 9 additions & 1 deletion src/play/modules/netty/FileChannelBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ public int getBytes(int index, GatheringByteChannel out, int length)
return out.write(bb);
}

public void setByte(int i, int i1) {
throw new RuntimeException();
}

public void getBytes(int index, OutputStream out, int length)
throws IOException {
byte[] b = new byte[length];
Expand Down Expand Up @@ -315,6 +319,10 @@ public void readBytes(OutputStream out, int length) throws IOException {
}

public String toString(int q,int a,java.lang.String b) {
return null;
throw new RuntimeException();
}

public void setShort(int a,int b) {
throw new RuntimeException();
}
}
14 changes: 7 additions & 7 deletions src/play/modules/netty/HttpServerPipelineFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ public class HttpServerPipelineFactory implements ChannelPipelineFactory {
public ChannelPipeline getPipeline() throws Exception {

Integer max = Integer.valueOf(Play.configuration.getProperty("play.module.netty.maxContentLength", "-1"));
if (max == -1) {
max = Integer.MAX_VALUE;
}
// if (max == -1) {
// max = Integer.MAX_VALUE;
// }

Integer threshold = Integer.valueOf(Play.configuration.getProperty("play.module.netty.threshold", "8192"));
if (max == -1) {
max = Integer.MAX_VALUE;
}


ChannelPipeline pipeline = pipeline();

pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast("aggregator", new StreamChunkAggregator(max));
pipeline.addLast("encoder", new HttpResponseEncoder());
//pipeline.addLast("aggregator", new HttpChunkAggregator(max));
pipeline.addLast("encoder", new HttpResponseEncoder());
pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());

pipeline.addLast("handler", new PlayHandler());


return pipeline;
}
}
Expand Down
Loading

0 comments on commit ee3784d

Please sign in to comment.