rjack-async-httpclient 1.6.5.0-java

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -0,0 +1,2 @@
1
+ === 1.6.5.0 (2011-10-1)
2
+ * Initial release based on Async Http Client 1.6.5
@@ -0,0 +1,11 @@
1
+ History.rdoc
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ assembly.xml
6
+ pom.xml
7
+ lib/rjack-async-httpclient/base.rb
8
+ lib/rjack-async-httpclient.rb
9
+ test/test_httpclient.rb
10
+ lib/rjack-async-httpclient/async-http-client-1.6.5.jar
11
+ lib/rjack-async-httpclient/netty-3.2.5.Final.jar
@@ -0,0 +1,76 @@
1
+ = rjack-async-httpclient
2
+
3
+ * http://rjack.rubyforge.org
4
+ * http://rubyforge.org/projects/rjack
5
+
6
+ == Description
7
+
8
+ A gem packaging of the
9
+ {Async Http Client}[http://groups.google.com/group/asynchttpclient]
10
+ for JRuby.
11
+
12
+ * Provides async-http-client and netty jars.
13
+ * Provides simple adaption for jruby based configuration.
14
+
15
+ == Synopsis
16
+
17
+ require 'rjack-logback'
18
+ require 'rjack-async-httpclient'
19
+
20
+ include RJack::AsyncHTTPClient
21
+
22
+ client = build_client( :idle_connection_timeout_in_ms => 10_000,
23
+ :connection_timeout_in_ms => 4_000 )
24
+ #...
25
+ client.close
26
+
27
+ == License
28
+
29
+ === rjack-async-httpclient gem
30
+
31
+ Copyright (c) 2011 David Kellum
32
+
33
+ Licensed under the Apache License, Version 2.0 (the "License"); you
34
+ may not use this file except in compliance with the License. You
35
+ may obtain a copy of the License at:
36
+
37
+ http://www.apache.org/licenses/LICENSE-2.0
38
+
39
+ Unless required by applicable law or agreed to in writing, software
40
+ distributed under the License is distributed on an "AS IS" BASIS,
41
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
42
+ implied. See the License for the specific language governing
43
+ permissions and limitations under the License.
44
+
45
+ === Async Http Client (java)
46
+
47
+ Copyright (c) 2010-2011 Sonatype, Inc.
48
+ Copyright (c) 2010 Ning, Inc.
49
+
50
+ Ning licenses this file to you under the Apache License, version 2.0
51
+ (the "License"); you may not use this file except in compliance with
52
+ the License. You may obtain a copy of the License at:
53
+
54
+ http://www.apache.org/licenses/LICENSE-2.0
55
+
56
+ Unless required by applicable law or agreed to in writing, software
57
+ distributed under the License is distributed on an "AS IS" BASIS,
58
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
59
+ implied. See the License for the specific language governing
60
+ permissions and limitations under the License.
61
+
62
+ === Netty (java)
63
+
64
+ Copyright (c) 2009 Red Hat, Inc.
65
+
66
+ Red Hat licenses this file to you under the Apache License, version
67
+ 2.0 (the "License"); you may not use this file except in compliance
68
+ with the License. You may obtain a copy of the License at:
69
+
70
+ http://www.apache.org/licenses/LICENSE-2.0
71
+
72
+ Unless required by applicable law or agreed to in writing, software
73
+ distributed under the License is distributed on an "AS IS" BASIS,
74
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
75
+ implied. See the License for the specific language governing
76
+ permissions and limitations under the License.
@@ -0,0 +1,43 @@
1
+ # -*- ruby -*-
2
+
3
+ $LOAD_PATH << './lib'
4
+ require 'rjack-async-httpclient/base'
5
+
6
+ require 'rubygems'
7
+ gem 'rjack-tarpit', '~> 1.4'
8
+ require 'rjack-tarpit'
9
+
10
+ include RJack
11
+
12
+ t = TarPit.new( 'rjack-async-httpclient',
13
+ AsyncHTTPClient::VERSION,
14
+ :jars_from_assembly, :java_platform )
15
+
16
+ t.specify do |h|
17
+ h.developer( "David Kellum", "dek-oss@gravitext.com" )
18
+ h.extra_deps += [ [ 'rjack-slf4j', '~> 1.6.1' ] ]
19
+
20
+ h.testlib = :minitest
21
+ h.extra_dev_deps += [ [ 'rjack-logback', '~> 1.0' ],
22
+ [ 'minitest', '~> 2.3' ] ]
23
+ h.rdoc_locations << "dekellum@rubyforge.org:/var/www/gforge-projects/rjack/async-httpclient"
24
+ end
25
+
26
+ t.assembly_version = 1.0
27
+
28
+ task :check_pom_deps do
29
+ t.test_line_match( 'pom.xml',
30
+ %r[<version>#{ AsyncHTTPClient::CLIENT_VERSION }</version>] )
31
+ end
32
+ task :check_history_version do
33
+ t.test_line_match( 'History.rdoc', /^==/, / #{t.version} / )
34
+ end
35
+ task :check_history_date do
36
+ t.test_line_match( 'History.rdoc', /^==/, /\([0-9\-]+\)$/ )
37
+ end
38
+
39
+ task :gem => [ :check_pom_deps, :check_history_version ]
40
+ task :tag => [ :check_pom_deps, :check_history_version, :check_history_date ]
41
+ task :push => [ :check_history_date ]
42
+
43
+ t.define_tasks
@@ -0,0 +1,16 @@
1
+ <assembly>
2
+ <id>bin</id>
3
+ <formats>
4
+ <format>dir</format>
5
+ </formats>
6
+ <includeBaseDirectory>false</includeBaseDirectory>
7
+ <dependencySets>
8
+ <dependencySet>
9
+ <useProjectArtifact>false</useProjectArtifact>
10
+ <includes>
11
+ <include>com.ning:async-http-client</include>
12
+ <include>org.jboss.netty:netty</include>
13
+ </includes>
14
+ </dependencySet>
15
+ </dependencySets>
16
+ </assembly>
@@ -0,0 +1,101 @@
1
+ #--
2
+ # Copyright (c) 2011 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You may
6
+ # obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ require 'rjack-slf4j'
18
+ require 'rjack-async-httpclient/base'
19
+
20
+ require 'java'
21
+
22
+ module RJack
23
+ module AsyncHTTPClient
24
+
25
+ Dir.glob( File.join( CLIENT_DIR, '*.jar' ) ).each { |jar| require jar }
26
+
27
+ import 'com.ning.http.client.AsyncHttpClientConfig'
28
+ import 'com.ning.http.client.AsyncHttpClient'
29
+
30
+ # Extensions to com.ning.http.client.AsyncHttpClientConfig supporting
31
+ # inspection as a options hash.
32
+ class AsyncHttpClientConfig
33
+
34
+ GET_TO_SETTERS = {
35
+ :async_http_provider_config => :async_http_client_provider_config,
36
+ :max_connection_per_host => :maximum_connections_per_host,
37
+ :max_redirects => :maximum_number_of_redirects,
38
+ :max_total_connections => :maximum_connections_total,
39
+ :reaper => :scheduled_executor_service,
40
+ :redirect_enabled => :follow_redirects,
41
+ :remove_query_param_on_redirect => :remove_query_params_on_redirect,
42
+ :ssl_connection_pool_enabled => :allow_ssl_connection_pool
43
+ }
44
+
45
+ # Return a Hash represention of self, suitable for use a template to
46
+ # AsyncHTTPClient.build_client
47
+ def to_hash
48
+ props = self.methods.
49
+ map { |m| m =~ /^(is|get)_([a-z0-9_]+)$/ && $2 }.
50
+ compact
51
+
52
+ props -= %w[ class closed ] #bogus
53
+ props += %w[ reaper executor_service ] #without get_
54
+
55
+ props.map! { |p| p.to_sym }
56
+ props.inject( {} ) do |h,p|
57
+ h[ GET_TO_SETTERS[ p ] || p ] = send( p )
58
+ h
59
+ end
60
+ end
61
+
62
+ # Return sorted, multi-line print of to_hash
63
+ def to_s
64
+ out = "{ "
65
+ kv = to_hash.sort { |p,n| p[0].to_s <=> n[0].to_s }
66
+ kv.each do |k,v|
67
+ out << ",\n " if out.length > 2
68
+ out << ":#{ k } => #{ v_inspect( v ) }"
69
+ end
70
+ out << " }"
71
+ out
72
+ end
73
+
74
+ private
75
+
76
+ def v_inspect( v )
77
+ v.respond_to?( :java_class ) ? v.to_string : v.inspect
78
+ end
79
+ end
80
+
81
+ module_function
82
+
83
+ # Build a new AsyncHttpClient from build_client_config( options )
84
+ # Caller should close this client when done with it.
85
+ def build_client( options )
86
+ AsyncHttpClient.new( build_client_config( options ) )
87
+ end
88
+
89
+ # Build AsyncHttpClientConfig from an options Hash
90
+ # Use AsyncHttpClientConfig.new.to_s or test_httpclient.rb -v to
91
+ # see available settings and defaults in Hash notation.
92
+ def build_client_config( options )
93
+ builder = AsyncHttpClientConfig::Builder.new
94
+ options.each do |k,v|
95
+ builder.send( "set_#{k}", v )
96
+ end
97
+ builder.build
98
+ end
99
+
100
+ end
101
+ end
@@ -0,0 +1,24 @@
1
+ #--
2
+ # Copyright (c) 2011 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You may
6
+ # obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ module RJack
18
+ module AsyncHTTPClient
19
+ CLIENT_VERSION = '1.6.5'
20
+ VERSION = CLIENT_VERSION + '.0'
21
+
22
+ CLIENT_DIR = File.dirname( __FILE__ ) # :nodoc:
23
+ end
24
+ end
data/pom.xml ADDED
@@ -0,0 +1,49 @@
1
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2
+
3
+ <modelVersion>4.0.0</modelVersion>
4
+ <groupId>rjack</groupId>
5
+ <artifactId>rjack-async-httpclient</artifactId>
6
+ <packaging>pom</packaging>
7
+ <version>1.0</version>
8
+ <name>Async HTTP Client for Gem</name>
9
+
10
+ <properties>
11
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12
+ </properties>
13
+
14
+ <dependencies>
15
+ <dependency>
16
+ <groupId>com.ning</groupId>
17
+ <artifactId>async-http-client</artifactId>
18
+ <version>1.6.5</version>
19
+ </dependency>
20
+ </dependencies>
21
+
22
+ <build>
23
+ <plugins>
24
+
25
+ <plugin>
26
+ <artifactId>maven-assembly-plugin</artifactId>
27
+ <version>2.2.1</version>
28
+ <configuration>
29
+ <attach>false</attach>
30
+ <ignoreDirFormatExtensions>false</ignoreDirFormatExtensions>
31
+ <descriptors>
32
+ <descriptor>assembly.xml</descriptor>
33
+ </descriptors>
34
+ </configuration>
35
+ <executions>
36
+ <execution>
37
+ <id>assembly</id>
38
+ <phase>package</phase>
39
+ <goals>
40
+ <goal>single</goal>
41
+ </goals>
42
+ </execution>
43
+ </executions>
44
+ </plugin>
45
+
46
+ </plugins>
47
+ </build>
48
+
49
+ </project>
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env jruby
2
+ #--
3
+ # Copyright (c) 2011 David Kellum
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
6
+ # may not use this file except in compliance with the License. You may
7
+ # obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14
+ # implied. See the License for the specific language governing
15
+ # permissions and limitations under the License.
16
+ #++
17
+
18
+ require 'rubygems'
19
+
20
+ require 'rjack-logback'
21
+
22
+ RJack::Logback.config_console( :stderr => true, :level => RJack::Logback::WARN )
23
+ if ARGV.include?( '-v' ) || ARGV.include?( '--verbose' )
24
+ RJack::Logback.root.level = RJack::Logback::DEBUG
25
+ end
26
+
27
+ require 'minitest/unit'
28
+ require 'minitest/autorun'
29
+
30
+ $LOAD_PATH.unshift File.join( File.dirname(__FILE__), "..", "lib" )
31
+
32
+ require 'rjack-async-httpclient'
33
+
34
+ class TestClient < MiniTest::Unit::TestCase
35
+ include RJack::AsyncHTTPClient
36
+
37
+ def test_load
38
+
39
+ cfg = build_client_config( { :idle_connection_timeout_in_ms => 10_000,
40
+ :connection_timeout_in_ms => 4_000 } )
41
+
42
+ client = AsyncHttpClient.new( cfg )
43
+ client.close
44
+
45
+ end
46
+
47
+ def test_default_config
48
+ RJack::SLF4J[ self.class ].debug do
49
+ "Default config:\n" + build_client_config( {} ).to_s
50
+ end
51
+ pass
52
+ end
53
+
54
+ def test_config_as_hash_round_trip
55
+ sfun = method :select_basic
56
+
57
+ cfg0 = build_client_config( {} )
58
+ basics0 = cfg0.to_hash.select( &sfun )
59
+
60
+ cfg1 = build_client_config( basics0 )
61
+ basics1 = cfg1.to_hash.select( &sfun )
62
+
63
+ assert_equal( basics0, basics1 )
64
+ end
65
+
66
+ def select_basic( _, value )
67
+ ! value.respond_to?( :java_class )
68
+ end
69
+
70
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rjack-async-httpclient
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.6.5.0
6
+ platform: java
7
+ authors:
8
+ - David Kellum
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-10-01 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rjack-slf4j
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 1.6.1
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: rjack-logback
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: "1.0"
35
+ type: :development
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: minitest
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: "2.3"
46
+ type: :development
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: rjack-tarpit
50
+ prerelease: false
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: 1.4.0
57
+ type: :development
58
+ version_requirements: *id004
59
+ description: |-
60
+ A gem packaging of the
61
+ {Async Http Client}[http://groups.google.com/group/asynchttpclient]
62
+ for JRuby.
63
+
64
+ * Provides async-http-client and netty jars.
65
+ * Provides simple adaption for jruby based configuration.
66
+ email:
67
+ - dek-oss@gravitext.com
68
+ executables: []
69
+
70
+ extensions: []
71
+
72
+ extra_rdoc_files:
73
+ - Manifest.txt
74
+ - History.rdoc
75
+ - README.rdoc
76
+ files:
77
+ - History.rdoc
78
+ - Manifest.txt
79
+ - README.rdoc
80
+ - Rakefile
81
+ - assembly.xml
82
+ - pom.xml
83
+ - lib/rjack-async-httpclient/base.rb
84
+ - lib/rjack-async-httpclient.rb
85
+ - test/test_httpclient.rb
86
+ - lib/rjack-async-httpclient/async-http-client-1.6.5.jar
87
+ - lib/rjack-async-httpclient/netty-3.2.5.Final.jar
88
+ - .gemtest
89
+ homepage: http://rjack.rubyforge.org
90
+ licenses: []
91
+
92
+ post_install_message:
93
+ rdoc_options:
94
+ - --main
95
+ - README.rdoc
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: "0"
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: "0"
110
+ requirements: []
111
+
112
+ rubyforge_project: rjack-async-httpclient
113
+ rubygems_version: 1.8.10
114
+ signing_key:
115
+ specification_version: 3
116
+ summary: A gem packaging of the {Async Http Client}[http://groups.google.com/group/asynchttpclient] for JRuby
117
+ test_files:
118
+ - test/test_httpclient.rb