thick 0.0.6-java → 0.0.7-java
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +11 -0
- data/lib/jars/netty-4.0.0.Alpha8.jar +0 -0
- data/lib/jars/thick-0.0.1.jar +0 -0
- data/lib/thick.rb +4 -2
- data/lib/thick/buffer.rb +47 -0
- data/lib/thick/loader.rb +4 -1
- data/lib/thick/version.rb +1 -1
- data/lib/thick/websocket.rb +21 -0
- metadata +37 -22
- data/lib/jars/netty-4.0.0.Alpha7.jar +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 0.7 (20.12.2012)
|
2
|
+
|
3
|
+
* update Netty to 4th version
|
4
|
+
* support for WebSockets
|
5
|
+
* new buffer for uploaded data
|
6
|
+
* simpler interface for async responses
|
7
|
+
|
8
|
+
## 0.6 (01.12.2012)
|
9
|
+
|
10
|
+
* some weird version
|
11
|
+
|
1
12
|
## 0.5 (30.11.2012)
|
2
13
|
|
3
14
|
* update Netty to 3.5.11
|
Binary file
|
data/lib/jars/thick-0.0.1.jar
CHANGED
Binary file
|
data/lib/thick.rb
CHANGED
@@ -2,10 +2,12 @@ require 'rack'
|
|
2
2
|
|
3
3
|
require 'java'
|
4
4
|
|
5
|
-
require File.expand_path('../jars/netty-4.0.0.
|
5
|
+
require File.expand_path('../jars/netty-4.0.0.Alpha8.jar', __FILE__)
|
6
6
|
require File.expand_path('../jars/thick-0.0.1.jar', __FILE__)
|
7
7
|
|
8
8
|
require 'thick/java'
|
9
9
|
require 'thick/version'
|
10
10
|
require 'thick/thick'
|
11
|
-
require 'thick/loader'
|
11
|
+
require 'thick/loader'
|
12
|
+
require 'thick/buffer'
|
13
|
+
require 'thick/websocket'
|
data/lib/thick/buffer.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
module Thick
|
2
|
+
|
3
|
+
class Buffer
|
4
|
+
|
5
|
+
java_import "io.netty.buffer.ByteBuf"
|
6
|
+
java_import "io.netty.buffer.Unpooled"
|
7
|
+
|
8
|
+
def initialize(buffer=nil)
|
9
|
+
@buffer = buffer || Unpooled.buffer
|
10
|
+
end
|
11
|
+
|
12
|
+
def write(buffer)
|
13
|
+
raise ArgumentError.new('ByteBuf is expected') unless buffer.kind_of?(ByteBuf)
|
14
|
+
@buffer.writeBytes(buffer)
|
15
|
+
end
|
16
|
+
|
17
|
+
def rewind
|
18
|
+
@buffer.reset_reader_index
|
19
|
+
end
|
20
|
+
|
21
|
+
def read(n=nil, buffer=nil)
|
22
|
+
return n ? nil : '' unless @buffer.readable
|
23
|
+
buffer ||= ""
|
24
|
+
n ||= @buffer.readable_bytes
|
25
|
+
buffer << java.lang.String.new(@buffer.read_bytes(n).array).to_s
|
26
|
+
end
|
27
|
+
|
28
|
+
def each(&block)
|
29
|
+
while (data = gets)
|
30
|
+
block.call( data || "")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def gets
|
35
|
+
return nil unless @buffer.readable
|
36
|
+
nl = @buffer.bytes_before(10)
|
37
|
+
if nl == -1
|
38
|
+
nl = @buffer.readable_bytes
|
39
|
+
else
|
40
|
+
nl += 1
|
41
|
+
end
|
42
|
+
read(nl)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
data/lib/thick/loader.rb
CHANGED
@@ -11,11 +11,14 @@ module Thick
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def call(env)
|
14
|
-
|
14
|
+
# ToDo: Does not work with Netty4 !!
|
15
|
+
env['rack.input'] = Buffer.new(env['rack.input'])
|
15
16
|
env['rack.errors'] = env['rack.errors'].to_io
|
16
17
|
|
17
18
|
status, headers, body = @application.call(env)
|
18
19
|
|
20
|
+
return if env['thick.response_bypass']
|
21
|
+
|
19
22
|
response = env['thick.response']
|
20
23
|
|
21
24
|
response.setStatus(status)
|
data/lib/thick/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Thick
|
2
|
+
|
3
|
+
java_import 'cz.marekjelen.thick.WebSocketHandler'
|
4
|
+
|
5
|
+
class WebSocket < WebSocketHandler
|
6
|
+
|
7
|
+
def on_open
|
8
|
+
raise NotImplementedError.new("You should implement '#on_open' method.")
|
9
|
+
end
|
10
|
+
|
11
|
+
def on_data(data)
|
12
|
+
raise NotImplementedError.new("You should implement '#on_data(data)' method.")
|
13
|
+
end
|
14
|
+
|
15
|
+
def on_close
|
16
|
+
raise NotImplementedError.new("You should implement '#on_close' method.")
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: java
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -31,15 +31,33 @@ dependencies:
|
|
31
31
|
name: rspec
|
32
32
|
version_requirements: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- - '
|
34
|
+
- - ! '>='
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
36
|
+
version: !binary |-
|
37
|
+
Mg==
|
37
38
|
none: false
|
38
39
|
requirement: !ruby/object:Gem::Requirement
|
39
40
|
requirements:
|
40
|
-
- - '
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: !binary |-
|
44
|
+
Mg==
|
45
|
+
none: false
|
46
|
+
prerelease: false
|
47
|
+
type: :development
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rake
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10'
|
55
|
+
none: false
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
41
59
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
60
|
+
version: '10'
|
43
61
|
none: false
|
44
62
|
prerelease: false
|
45
63
|
type: :development
|
@@ -51,22 +69,16 @@ executables:
|
|
51
69
|
extensions: []
|
52
70
|
extra_rdoc_files: []
|
53
71
|
files:
|
54
|
-
-
|
55
|
-
|
56
|
-
-
|
57
|
-
|
58
|
-
-
|
59
|
-
|
60
|
-
-
|
61
|
-
|
62
|
-
-
|
63
|
-
|
64
|
-
- !binary |-
|
65
|
-
bGliL3RoaWNrL3ZlcnNpb24ucmI=
|
66
|
-
- !binary |-
|
67
|
-
bGliL2phcnMvbmV0dHktNC4wLjAuQWxwaGE3Lmphcg==
|
68
|
-
- !binary |-
|
69
|
-
bGliL2phcnMvdGhpY2stMC4wLjEuamFy
|
72
|
+
- bin/thick
|
73
|
+
- lib/thick.rb
|
74
|
+
- lib/jars/netty-4.0.0.Alpha8.jar
|
75
|
+
- lib/jars/thick-0.0.1.jar
|
76
|
+
- lib/thick/buffer.rb
|
77
|
+
- lib/thick/java.rb
|
78
|
+
- lib/thick/loader.rb
|
79
|
+
- lib/thick/thick.rb
|
80
|
+
- lib/thick/version.rb
|
81
|
+
- lib/thick/websocket.rb
|
70
82
|
- LICENSE
|
71
83
|
- README.md
|
72
84
|
- ROADMAP.md
|
@@ -91,8 +103,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
103
|
requirements:
|
92
104
|
- - ! '>='
|
93
105
|
- !ruby/object:Gem::Version
|
106
|
+
segments:
|
107
|
+
- 0
|
94
108
|
version: !binary |-
|
95
109
|
MA==
|
110
|
+
hash: 2
|
96
111
|
none: false
|
97
112
|
requirements: []
|
98
113
|
rubyforge_project:
|
Binary file
|