hc-httpclient 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ === 3.1.1 / 2009-1-24 (TBD)
2
+
3
+ * Inital release based on Apache HttpClient 3.1
@@ -0,0 +1,11 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ pom.xml
6
+ assembly.xml
7
+ lib/hc-httpclient/base.rb
8
+ lib/hc-httpclient.rb
9
+ test/test_httpclient.rb
10
+ lib/hc-httpclient/commons-httpclient-3.1.jar
11
+ lib/hc-httpclient/commons-codec-1.2.jar
@@ -0,0 +1,77 @@
1
+ = hc-httpclient
2
+
3
+ * http://rjack.rubyforge.org
4
+ * http://rubyforge.org/projects/rjack
5
+
6
+ == Description
7
+
8
+ A gem packaging of the {HttpComponents}[http://hc.apache.org/]
9
+ (formerly Jakarta Commons) HTTP Client for JRuby.
10
+
11
+ * Provides commons-httpclient and commons-codec jars.
12
+ * Provides a HC::HTTPClient::ManagerFacade for client and connection
13
+ manager setup, start, shutdown.
14
+
15
+ == Synopsis
16
+
17
+ require 'logback'
18
+ require 'hc-httpclient'
19
+
20
+ include HC::HTTPClient
21
+
22
+ mf = ManagerFacade.new
23
+ mf.manager_params.max_total_connections = 200
24
+ mf.client_params.so_timeout = 3000 #ms
25
+ mf.start
26
+
27
+ mf.client # --> org.apache.commons.HttpClient
28
+
29
+ mf.shutdown
30
+
31
+ See {org.apache.commons.HttpClient}[http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/HttpClient.html].
32
+
33
+ == Requirements
34
+
35
+ * slf4j[http://rjack.rubyforge.org/slf4j] (rjack gem).
36
+
37
+ * An slf4j output adaptor such as 'slf4j/simple' or
38
+ logback[http://rjack.rubyforge.org/logback] must be require'd before
39
+ hc-httpclient. (The logback gem is listed as a development
40
+ dependency only.)
41
+
42
+ == License
43
+
44
+ === hc-httpclient ruby gem
45
+
46
+ Copyright (C) 2009 David Kellum
47
+
48
+ Licensed under the Apache License, Version 2.0 (the "License"); you
49
+ may not use this file except in compliance with the License. You
50
+ may obtain a copy of the License at:
51
+
52
+ http://www.apache.org/licenses/LICENSE-2.0
53
+
54
+ Unless required by applicable law or agreed to in writing, software
55
+ distributed under the License is distributed on an "AS IS" BASIS,
56
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
57
+ implied. See the License for the specific language governing
58
+ permissions and limitations under the License.
59
+
60
+ === Jakarta Commons HTTPClient (java)
61
+
62
+ Copyright 1999-2007 The Apache Software Foundation
63
+
64
+ Licensed to the Apache Software Foundation (ASF) under one or more
65
+ contributor license agreements. See the NOTICE file distributed with
66
+ this work for additional information regarding copyright ownership.
67
+ The ASF licenses this file to You under the Apache License, Version
68
+ 2.0 (the "License"); you may not use this file except in compliance
69
+ with the License. You may obtain a copy of the License at
70
+
71
+ http://www.apache.org/licenses/LICENSE-2.0
72
+
73
+ Unless required by applicable law or agreed to in writing, software
74
+ distributed under the License is distributed on an "AS IS" BASIS,
75
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
76
+ implied. See the License for the specific language governing
77
+ permissions and limitations under the License.
@@ -0,0 +1,90 @@
1
+ # -*- ruby -*-
2
+ #--
3
+ # Copyright (C) 2008-2009 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
7
+ # may 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
+ ENV['NODOT'] = "no thank you"
21
+ require 'hoe'
22
+
23
+ $LOAD_PATH << './lib'
24
+ require 'hc-httpclient/base'
25
+
26
+ ASSEMBLY = "target/httpclient-1.0-bin.dir"
27
+
28
+ desc "Update the Manifest with actual jars"
29
+ task :manifest => [ ASSEMBLY ] do
30
+ out = File.new( 'Manifest.txt', 'w' )
31
+ begin
32
+ out.write <<END
33
+ History.txt
34
+ Manifest.txt
35
+ README.txt
36
+ Rakefile
37
+ pom.xml
38
+ assembly.xml
39
+ lib/hc-httpclient/base.rb
40
+ lib/hc-httpclient.rb
41
+ test/test_httpclient.rb
42
+ END
43
+ out.puts( Dir.glob( File.join( ASSEMBLY, '*.jar' ) ).map do |jar|
44
+ File.join( 'lib', 'hc-httpclient', File.basename( jar ) )
45
+ end )
46
+ ensure
47
+ out.close
48
+ end
49
+ end
50
+
51
+ file ASSEMBLY => [ 'pom.xml', 'assembly.xml' ] do
52
+ sh( 'mvn package' )
53
+ end
54
+
55
+ JAR_FILES = File.new( 'Manifest.txt' ).readlines.map { |f| f.strip }\
56
+ .select { |f| f =~ /\.jar$/ }
57
+
58
+ JARS = JAR_FILES.map { |f| File.basename( f.strip ) }
59
+
60
+ JARS.each do |jar|
61
+ file "lib/hc-httpclient/#{jar}" => [ ASSEMBLY ] do
62
+ cp_r( File.join( ASSEMBLY, jar ), 'lib/hc-httpclient' )
63
+ end
64
+ end
65
+ [ :gem, :test ].each { |t| task t => JAR_FILES }
66
+
67
+ task :mvn_clean do
68
+ rm_f( JAR_FILES )
69
+ sh( 'mvn clean' )
70
+ end
71
+
72
+ task :clean => :mvn_clean
73
+
74
+ task :tag do
75
+ tag = "hc-httpclient-#{HC::HTTPClient::VERSION}"
76
+ dname = File.dirname( __FILE__ )
77
+ dname = '.' if Dir.getwd == dname
78
+ sh( "git status --only #{dname}" ) do |ok,res|
79
+ raise "Commit these changes before tagging." if ok #changes present
80
+ end
81
+ sh %{git tag -s -f -m "tag [#{tag}]" "#{tag}"}
82
+ end
83
+
84
+ hoe = Hoe.new( "hc-httpclient", HC::HTTPClient::VERSION ) do |p|
85
+ p.developer( "David Kellum", "dek-oss@gravitext.com" )
86
+ p.extra_deps << [ 'slf4j', '~> 1.5.6.1' ]
87
+ p.extra_dev_deps << [ 'logback', '>= 1.9.14' ]
88
+ p.rubyforge_name = "rjack"
89
+ p.rdoc_pattern = /^(lib.*\.(rb|txt))|[^\/]*\.txt$/
90
+ end
@@ -0,0 +1,15 @@
1
+ <assembly>
2
+ <id>bin</id>
3
+ <formats>
4
+ <format>dir</format>
5
+ </formats>
6
+ <includeBaseDirectory>false</includeBaseDirectory>
7
+ <dependencySets>
8
+ <dependencySet>
9
+ <includes>
10
+ <include>commons-httpclient:commons-httpclient</include>
11
+ <include>commons-codec:commons-codec</include>
12
+ </includes>
13
+ </dependencySet>
14
+ </dependencySets>
15
+ </assembly>
@@ -0,0 +1,102 @@
1
+ #--
2
+ # Copyright (C) 2008-2009 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 'rubygems'
18
+ require 'slf4j'
19
+ require 'slf4j/jcl-over-slf4j'
20
+
21
+ require 'hc-httpclient/base'
22
+
23
+ # "HC" stands for "Http Components" the latest project name, at:
24
+ #
25
+ # http://hc.apache.org
26
+ #
27
+ # which has inherited "Jakarta Commons HttpClient" 3.x and released
28
+ # "HttpComponents Client" 4.x currently in beta. The HC module name is
29
+ # inserted to distinguish this module from others named "HTTPClient",
30
+ # including:
31
+ #
32
+ # * http://dev.ctor.org/http-access2
33
+ # * http://rubyforge.org/projects/soap4r
34
+ #
35
+ module HC
36
+ module HTTPClient
37
+
38
+ Dir.glob( File.join( HTTPCLIENT_DIR, '*.jar' ) ).each { |jar| require jar }
39
+
40
+ import 'org.apache.commons.httpclient.params.HttpConnectionManagerParams'
41
+ import 'org.apache.commons.httpclient.params.HttpClientParams'
42
+ import 'org.apache.commons.httpclient.params.HttpMethodParams'
43
+ import 'org.apache.commons.httpclient.DefaultHttpMethodRetryHandler'
44
+ import 'org.apache.commons.httpclient.MultiThreadedHttpConnectionManager'
45
+ import 'org.apache.commons.httpclient.HttpClient'
46
+
47
+ # Facade over http client and connection manager, setup, start, shutdown
48
+ #
49
+ # == Example Settings
50
+ #
51
+ # See: http://hc.apache.org/httpclient-3.x/preference-api.html
52
+ #
53
+ # manager_params.max_total_connections = 200
54
+ # manager_params.connection_timeout = 1500 #ms
55
+ # manager_params.default_max_connections_per_host = 20
56
+ # manager_params.stale_checking_enabled = false
57
+ # client_params.connection_manager_timeout = 3000 #ms
58
+ # client_params.so_timeout = 3000 #ms
59
+ # client_params.set_parameter( HttpMethodParams::RETRY_HANDLER,
60
+ # DefaultHttpMethodRetryHandler.new( 2, false ) )
61
+ # client_params.cookie_policy = CookiePolicy::IGNORE_COOKIES
62
+ #
63
+ # Note, use of set_parameter style settings will increase the
64
+ # likelihood of 4.x compatibility
65
+ class ManagerFacade
66
+
67
+ # The HttpClient instance available after start
68
+ attr_reader :client
69
+
70
+ # Manager parameters
71
+ attr_reader :manager_params
72
+
73
+ # Client parameters
74
+ attr_reader :client_params
75
+
76
+ def initialize
77
+ @manager_params = HttpConnectionManagerParams.new
78
+
79
+ @client_params = HttpClientParams.new
80
+
81
+ @client = nil
82
+ @connection_manager = nil
83
+ end
84
+
85
+ # Given previously set parameters, construct connection manager
86
+ # and client.
87
+ def start
88
+ @connection_manager = MultiThreadedHttpConnectionManager.new()
89
+ @connection_manager.params = @manager_params
90
+
91
+ @client = HttpClient.new( @client_params, @connection_manager );
92
+ end
93
+
94
+ # Shutdown and close the connection manager and client.
95
+ def shutdown
96
+ @connection_manager.shutdown if @connection_manager
97
+ @client = nil
98
+ @connection_manager = nil
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,24 @@
1
+ #--
2
+ # Copyright (C) 2008-2009 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 HC
18
+ module HTTPClient
19
+ HTTPCLIENT_VERSION = '3.1'
20
+ VERSION = HTTPCLIENT_VERSION + '.1'
21
+
22
+ HTTPCLIENT_DIR = File.dirname( __FILE__ ) # :nodoc:
23
+ end
24
+ end
data/pom.xml ADDED
@@ -0,0 +1,61 @@
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>com.gravitext</groupId>
5
+ <artifactId>httpclient</artifactId>
6
+ <packaging>pom</packaging>
7
+ <version>1.0</version>
8
+ <name>HTTPClient Assembly for Gem</name>
9
+
10
+ <dependencies>
11
+
12
+ <dependency>
13
+ <groupId>commons-httpclient</groupId>
14
+ <artifactId>commons-httpclient</artifactId>
15
+ <version>3.1</version>
16
+ <exclusions>
17
+ <exclusion>
18
+ <groupId>commons-logging</groupId>
19
+ <artifactId>commons-logging</artifactId>
20
+ </exclusion>
21
+ </exclusions>
22
+ </dependency>
23
+
24
+ </dependencies>
25
+
26
+ <build>
27
+ <plugins>
28
+ <plugin>
29
+ <artifactId>maven-assembly-plugin</artifactId>
30
+ <configuration>
31
+ <descriptors>
32
+ <descriptor>assembly.xml</descriptor>
33
+ </descriptors>
34
+ <tarLongFileMode>gnu</tarLongFileMode>
35
+ </configuration>
36
+ <executions>
37
+ <execution>
38
+ <id>assembly</id>
39
+ <phase>package</phase>
40
+ <goals>
41
+ <goal>attached</goal>
42
+ </goals>
43
+ </execution>
44
+ </executions>
45
+ </plugin>
46
+ <plugin>
47
+ <artifactId>maven-compiler-plugin</artifactId>
48
+ <configuration>
49
+ <source>1.5</source>
50
+ <target>1.5</target>
51
+ <optimize>true</optimize>
52
+ <debug>true</debug>
53
+ <encoding>UTF-8</encoding>
54
+ <showDeprecation>true</showDeprecation>
55
+ <showWarnings>true</showWarnings>
56
+ </configuration>
57
+ </plugin>
58
+ </plugins>
59
+ </build>
60
+
61
+ </project>
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env jruby
2
+ #--
3
+ # Copyright (C) 2008-2009 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
7
+ # may 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
+ gem( 'logback', '>= 0.9.14' )
20
+
21
+ require 'logback'
22
+ Logback.root.level = Logback::DEBUG
23
+
24
+ require 'test/unit'
25
+
26
+ $LOAD_PATH.unshift File.join( File.dirname(__FILE__), "..", "lib" )
27
+
28
+ require 'hc-httpclient'
29
+
30
+ class TestClient < Test::Unit::TestCase
31
+ include HC::HTTPClient
32
+ def test_setup
33
+ m = ManagerFacade.new
34
+ m.manager_params.max_total_connections = 200
35
+ m.client_params.so_timeout = 3000 #ms
36
+ m.start
37
+
38
+ assert_not_nil m.client
39
+
40
+ m.shutdown
41
+
42
+ assert_nil m.client
43
+ end
44
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ required_ruby_version: !ruby/object:Gem::Requirement
3
+ requirements:
4
+ - - '>='
5
+ - !ruby/object:Gem::Version
6
+ version: "0"
7
+ version:
8
+ email:
9
+ - dek-oss@gravitext.com
10
+ cert_chain: []
11
+
12
+ summary: A gem packaging of the {HttpComponents}[http://hc.apache.org/] (formerly
13
+ Jakarta Commons) HTTP Client for JRuby
14
+ post_install_message:
15
+ extra_rdoc_files:
16
+ - History.txt
17
+ - Manifest.txt
18
+ - README.txt
19
+ homepage: http://rjack.rubyforge.org
20
+ signing_key:
21
+ name: hc-httpclient
22
+ rdoc_options:
23
+ - --main
24
+ - README.txt
25
+ autorequire:
26
+ rubyforge_project: rjack
27
+ executables: []
28
+
29
+ description: A gem packaging of the {HttpComponents}[http://hc.apache.org/] (formerly
30
+ Jakarta Commons) HTTP Client for JRuby. * Provides commons-httpclient and commons-codec
31
+ jars. * Provides a HC::HTTPClient::ManagerFacade for client and connection manager
32
+ setup, start, shutdown.
33
+ specification_version: 2
34
+ default_executable:
35
+ files:
36
+ - History.txt
37
+ - Manifest.txt
38
+ - README.txt
39
+ - Rakefile
40
+ - pom.xml
41
+ - assembly.xml
42
+ - lib/hc-httpclient/base.rb
43
+ - lib/hc-httpclient.rb
44
+ - test/test_httpclient.rb
45
+ - lib/hc-httpclient/commons-httpclient-3.1.jar
46
+ - lib/hc-httpclient/commons-codec-1.2.jar
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - '>='
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ extensions: []
54
+
55
+ rubygems_version: 1.3.1
56
+ requirements: []
57
+
58
+ authors:
59
+ - David Kellum
60
+ date: 2009-02-22 08:00:00 +00:00
61
+ platform: ruby
62
+ test_files:
63
+ - test/test_httpclient.rb
64
+ version: !ruby/object:Gem::Version
65
+ version: 3.1.1
66
+ require_paths:
67
+ - lib
68
+ dependencies:
69
+ - !ruby/object:Gem::Dependency
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ version: 1.5.6.1
75
+ version:
76
+ type: :runtime
77
+ version_requirement:
78
+ name: slf4j
79
+ - !ruby/object:Gem::Dependency
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - '>='
83
+ - !ruby/object:Gem::Version
84
+ version: 1.9.14
85
+ version:
86
+ type: :development
87
+ version_requirement:
88
+ name: logback
89
+ - !ruby/object:Gem::Dependency
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: 1.8.2
95
+ version:
96
+ type: :development
97
+ version_requirement:
98
+ name: hoe
99
+ bindir: bin
100
+ has_rdoc: true