iudex-httpclient-3 1.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc ADDED
@@ -0,0 +1,2 @@
1
+ === 1.0.0 (2011-04-04)
2
+ * Initial release.
data/Manifest.txt ADDED
@@ -0,0 +1,10 @@
1
+ History.rdoc
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ pom.xml
6
+ lib/iudex-httpclient-3/base.rb
7
+ lib/iudex-httpclient-3.rb
8
+ test/setup.rb
9
+ test/test_httpclient.rb
10
+ lib/iudex-httpclient-3/iudex-httpclient-3-1.0.0.jar
data/README.rdoc ADDED
@@ -0,0 +1,25 @@
1
+ = iudex-httpclient-3
2
+
3
+ * http://github.com/dekellum/iudex
4
+
5
+ == Description
6
+
7
+ Iudex is a general purpose web crawler and feed processor in
8
+ ruby/java. This gem is an rjack-httpclient-3 based implementation of
9
+ the iudex-http interfaces.
10
+
11
+ == License
12
+
13
+ Copyright (c) 2008-2011 David Kellum
14
+
15
+ Licensed under the Apache License, Version 2.0 (the "License"); you
16
+ may not use this file except in compliance with the License. You
17
+ may obtain a copy of the License at:
18
+
19
+ http://www.apache.org/licenses/LICENSE-2.0
20
+
21
+ Unless required by applicable law or agreed to in writing, software
22
+ distributed under the License is distributed on an "AS IS" BASIS,
23
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
24
+ implied. See the License for the specific language governing
25
+ permissions and limitations under the License.
data/Rakefile ADDED
@@ -0,0 +1,42 @@
1
+ # -*- ruby -*-
2
+
3
+ $LOAD_PATH << './lib'
4
+ require 'iudex-httpclient-3/base'
5
+
6
+ require 'rubygems'
7
+ gem 'rjack-tarpit', '~> 1.2'
8
+ require 'rjack-tarpit'
9
+
10
+ t = RJack::TarPit.new( 'iudex-httpclient-3',
11
+ Iudex::HTTPClient3::VERSION,
12
+ :no_assembly, :java_platform )
13
+
14
+ t.specify do |h|
15
+ h.developer( "David Kellum", "dek-oss@gravitext.com" )
16
+
17
+ h.extra_deps += [ [ 'iudex-http', '~> 1.0.0' ],
18
+ [ 'rjack-httpclient-3', '~> 3.1.3' ],
19
+ [ 'hooker', '~> 1.0.0' ] ]
20
+
21
+ h.testlib = :minitest
22
+ h.extra_dev_deps += [ [ 'minitest', '>= 1.7.1', '< 2.1' ],
23
+ [ 'rjack-logback', '~> 1.0' ] ]
24
+ end
25
+
26
+ file 'Manifest.txt' => "lib/#{t.name}/base.rb"
27
+
28
+ task :check_pom_version do
29
+ t.test_line_match( 'pom.xml', /<version>/, /#{t.version}/ )
30
+ end
31
+ task :check_history_version do
32
+ t.test_line_match( 'History.rdoc', /^==/, / #{t.version} / )
33
+ end
34
+ task :check_history_date do
35
+ t.test_line_match( 'History.rdoc', /^==/, /\([0-9\-]+\)$/ )
36
+ end
37
+
38
+ task :gem => [ :check_pom_version, :check_history_version ]
39
+ task :tag => [ :check_pom_version, :check_history_version, :check_history_date ]
40
+ task :push => [ :check_history_date ]
41
+
42
+ t.define_tasks
@@ -0,0 +1,23 @@
1
+ #--
2
+ # Copyright (c) 2008-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
6
+ # may 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 Iudex
18
+ module HTTPClient3
19
+ VERSION = '1.0.0'
20
+
21
+ LIB_DIR = File.dirname( __FILE__ ) # :nodoc:
22
+ end
23
+ end
@@ -0,0 +1,57 @@
1
+ #--
2
+ # Copyright (c) 2008-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
6
+ # may 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 'iudex-http'
18
+ require 'rjack-httpclient-3'
19
+ require 'hooker'
20
+
21
+ require 'iudex-httpclient-3/base'
22
+
23
+ require 'java'
24
+
25
+ module Iudex
26
+
27
+ module HTTPClient3
28
+ require "#{LIB_DIR}/iudex-httpclient-3-#{VERSION}.jar"
29
+
30
+ import 'iudex.httpclient3.HTTPClient3'
31
+
32
+ def self.create_manager
33
+ mgr = RJack::HTTPClient3::ManagerFacade.new
34
+
35
+ # Sensible defaults:
36
+ mgr.manager_params.max_total_connections = 100
37
+ mgr.manager_params.default_max_connections_per_host = 2
38
+ mgr.manager_params.stale_checking_enabled = false
39
+ mgr.client_params.connection_manager_timeout = 3_000 #ms
40
+ mgr.client_params.so_timeout = 5_000 #ms
41
+
42
+ mgr.client_params.set_parameter(
43
+ RJack::HTTPClient3::HttpMethodParams::RETRY_HANDLER,
44
+ RJack::HTTPClient3::DefaultHttpMethodRetryHandler.new( 2, false ) )
45
+
46
+ # FIXME: Use scoped per-session cookies?
47
+ cp = Java::org.apache.commons.httpclient.cookie.CookiePolicy
48
+ mgr.client_params.cookie_policy = cp::IGNORE_COOKIES
49
+
50
+ Hooker.apply( [ :iudex, :http_client_3 ], mgr )
51
+
52
+ mgr
53
+ end
54
+
55
+ end
56
+
57
+ end
data/pom.xml ADDED
@@ -0,0 +1,62 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <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">
3
+
4
+ <modelVersion>4.0.0</modelVersion>
5
+ <groupId>iudex</groupId>
6
+ <artifactId>iudex-httpclient-3</artifactId>
7
+ <packaging>jar</packaging>
8
+ <version>1.0.0</version>
9
+ <name>Iudex Core System</name>
10
+
11
+ <parent>
12
+ <groupId>iudex</groupId>
13
+ <artifactId>iudex-parent</artifactId>
14
+ <version>1.0</version>
15
+ <relativePath>..</relativePath>
16
+ </parent>
17
+
18
+ <repositories>
19
+ <repository>
20
+ <id>maven2-repository.dev.java.net</id>
21
+ <name>Java.net Repository for Maven</name>
22
+ <url>http://download.java.net/maven/2/</url>
23
+ <layout>default</layout>
24
+ </repository>
25
+ </repositories>
26
+
27
+ <dependencies>
28
+
29
+ <dependency>
30
+ <groupId>iudex</groupId>
31
+ <artifactId>iudex-http</artifactId>
32
+ <version>[1.0,1.1)</version>
33
+ </dependency>
34
+
35
+ <dependency>
36
+ <groupId>commons-httpclient</groupId>
37
+ <artifactId>commons-httpclient</artifactId>
38
+ <version>3.1</version>
39
+ <exclusions>
40
+ <exclusion>
41
+ <groupId>commons-logging</groupId>
42
+ <artifactId>commons-logging</artifactId>
43
+ </exclusion>
44
+ </exclusions>
45
+ </dependency>
46
+
47
+ </dependencies>
48
+
49
+ <build>
50
+ <plugins>
51
+ <plugin>
52
+ <!-- Parent settings -->
53
+ <artifactId>maven-compiler-plugin</artifactId>
54
+ </plugin>
55
+ <plugin>
56
+ <!-- Parent settings -->
57
+ <artifactId>maven-source-plugin</artifactId>
58
+ </plugin>
59
+ </plugins>
60
+ </build>
61
+
62
+ </project>
data/test/setup.rb ADDED
@@ -0,0 +1,35 @@
1
+ #--
2
+ # Copyright (c) 2008-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
6
+ # may 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
+ #### General test setup: LOAD_PATH, logging, console output ####
18
+
19
+ ldir = File.join( File.dirname( __FILE__ ), "..", "lib" )
20
+ $LOAD_PATH.unshift( ldir ) unless $LOAD_PATH.include?( ldir )
21
+
22
+ require 'rubygems'
23
+ require 'rjack-logback'
24
+ RJack::Logback.config_console( :stderr => true )
25
+ RJack::Logback.root.level = RJack::Logback::DEBUG if ARGV.include?( '-v' )
26
+
27
+ require 'minitest/unit'
28
+ require 'minitest/autorun'
29
+
30
+ # Make test output logging compatible: no partial lines.
31
+ class TestOut
32
+ def print( *a ); $stdout.puts( *a ); end
33
+ def puts( *a ); $stdout.puts( *a ); end
34
+ end
35
+ MiniTest::Unit.output = TestOut.new
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env jruby
2
+ #.hashdot.profile += jruby-shortlived
3
+
4
+ #--
5
+ # Copyright (c) 2008-2011 David Kellum
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
8
+ # may not use this file except in compliance with the License. You
9
+ # may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16
+ # implied. See the License for the specific language governing
17
+ # permissions and limitations under the License.
18
+ #++
19
+
20
+ require File.join( File.dirname( __FILE__ ), "setup" )
21
+
22
+ require 'iudex-httpclient-3'
23
+
24
+ class TestHTTPClient < MiniTest::Unit::TestCase
25
+ include Iudex
26
+
27
+ def test_config
28
+
29
+ called = :not
30
+ Hooker.with( :iudex ) do |h|
31
+ h.setup_http_client_3 do |mgr|
32
+ assert_equal( 100, mgr.manager_params.max_total_connections )
33
+ called = :called
34
+ end
35
+ end
36
+
37
+ mgr = HTTPClient3.create_manager
38
+ assert( mgr )
39
+ assert_equal( :called, called )
40
+
41
+ mgr.start
42
+ assert( mgr.client )
43
+ mgr.shutdown
44
+
45
+ end
46
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iudex-httpclient-3
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.0.0
6
+ platform: java
7
+ authors:
8
+ - David Kellum
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-04-04 00:00:00 -07:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: iudex-http
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: 1.0.0
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: rjack-httpclient-3
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ~>
34
+ - !ruby/object:Gem::Version
35
+ version: 3.1.3
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: hooker
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.0
47
+ type: :runtime
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: minitest
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 1.7.1
58
+ - - <
59
+ - !ruby/object:Gem::Version
60
+ version: "2.1"
61
+ type: :development
62
+ version_requirements: *id004
63
+ - !ruby/object:Gem::Dependency
64
+ name: rjack-logback
65
+ prerelease: false
66
+ requirement: &id005 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ~>
70
+ - !ruby/object:Gem::Version
71
+ version: "1.0"
72
+ type: :development
73
+ version_requirements: *id005
74
+ - !ruby/object:Gem::Dependency
75
+ name: rjack-tarpit
76
+ prerelease: false
77
+ requirement: &id006 !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 1.3.0
83
+ type: :development
84
+ version_requirements: *id006
85
+ description: |-
86
+ Iudex is a general purpose web crawler and feed processor in
87
+ ruby/java. This gem is an rjack-httpclient-3 based implementation of
88
+ the iudex-http interfaces.
89
+ email:
90
+ - dek-oss@gravitext.com
91
+ executables: []
92
+
93
+ extensions: []
94
+
95
+ extra_rdoc_files:
96
+ - Manifest.txt
97
+ - History.rdoc
98
+ - README.rdoc
99
+ files:
100
+ - History.rdoc
101
+ - Manifest.txt
102
+ - README.rdoc
103
+ - Rakefile
104
+ - pom.xml
105
+ - lib/iudex-httpclient-3/base.rb
106
+ - lib/iudex-httpclient-3.rb
107
+ - test/setup.rb
108
+ - test/test_httpclient.rb
109
+ - lib/iudex-httpclient-3/iudex-httpclient-3-1.0.0.jar
110
+ has_rdoc: true
111
+ homepage: http://github.com/dekellum/iudex
112
+ licenses: []
113
+
114
+ post_install_message:
115
+ rdoc_options:
116
+ - --main
117
+ - README.rdoc
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: "0"
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: "0"
132
+ requirements: []
133
+
134
+ rubyforge_project: iudex-httpclient-3
135
+ rubygems_version: 1.5.1
136
+ signing_key:
137
+ specification_version: 3
138
+ summary: Iudex is a general purpose web crawler and feed processor in ruby/java
139
+ test_files:
140
+ - test/test_httpclient.rb