rjack-httpclient-4 4.0.1.1-java
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +23 -0
- data/Manifest.static +11 -0
- data/Manifest.txt +13 -0
- data/NOTICE.txt +10 -0
- data/README.rdoc +82 -0
- data/Rakefile +57 -0
- data/assembly.xml +15 -0
- data/lib/rjack-httpclient-4.rb +175 -0
- data/lib/rjack-httpclient-4/base.rb +24 -0
- data/lib/rjack-httpclient-4/httpclient-4.0.1.jar +0 -0
- data/lib/rjack-httpclient-4/httpcore-4.0.1.jar +0 -0
- data/pom.xml +75 -0
- data/test/test_httpclient.rb +60 -0
- metadata +117 -0
data/History.rdoc
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
=== 4.0.1.1 (2010-3-6)
|
2
|
+
* Set gem platform to java
|
3
|
+
* Upgraded to tarpit ~> 1.2.0
|
4
|
+
|
5
|
+
=== 4.0.1.0 (2009-12-19)
|
6
|
+
* Upgrade to HttpComponents HttpClient 4.0.1
|
7
|
+
* Upgrade to tarpit-1.1.0 (gemcutter)
|
8
|
+
|
9
|
+
=== 4.0.0 (2009-10-10)
|
10
|
+
* Update jars and docs for HTTPComponents 4.0 HttpClient and dependencies.
|
11
|
+
* Rename gem rjack-httpclient-4 and as module RJack::HTTPClient4
|
12
|
+
|
13
|
+
=== 3.1.3 (2009-10-10)
|
14
|
+
* Rename gem rjack-httpclient-3 and as module RJack::HTTPClient3
|
15
|
+
* Update/relax rjack-slf4j dependency to '~> 1.5.8' (tested with slf4j 1.5.8.1).
|
16
|
+
* Replace included commons-codec with rjack-commons-codec gem dependency.
|
17
|
+
* Use rjack-tarpit for build.
|
18
|
+
|
19
|
+
=== 3.1.2 (2009-5-29)
|
20
|
+
* Use rdoc 2.4.3 and hoe 1.12.2 for build.
|
21
|
+
|
22
|
+
=== 3.1.1 (2009-2-22)
|
23
|
+
* Inital release based on HttpClient 3.1
|
data/Manifest.static
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Manifest.static
|
2
|
+
Manifest.txt
|
3
|
+
README.rdoc
|
4
|
+
History.rdoc
|
5
|
+
NOTICE.txt
|
6
|
+
Rakefile
|
7
|
+
pom.xml
|
8
|
+
assembly.xml
|
9
|
+
lib/rjack-httpclient-4/base.rb
|
10
|
+
lib/rjack-httpclient-4.rb
|
11
|
+
test/test_httpclient.rb
|
12
|
+
lib/rjack-httpclient-4/httpclient-4.0.1.jar
|
13
|
+
lib/rjack-httpclient-4/httpcore-4.0.1.jar
|
data/NOTICE.txt
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
rjack-httpclient-4 gem
|
2
|
+
Copyright (c) 2009 David Kellum
|
3
|
+
|
4
|
+
This product includes software developed by:
|
5
|
+
|
6
|
+
Apache HttpComponents Client
|
7
|
+
Copyright 1999-2009 The Apache Software Foundation
|
8
|
+
|
9
|
+
This project contains annotations derived from JCIP-ANNOTATIONS
|
10
|
+
Copyright (c) 2005 Brian Goetz and Tim Peierls. See http://www.jcip.net
|
data/README.rdoc
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
= rjack-httpclient-4
|
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/] HTTP
|
9
|
+
Client 4.x for JRuby.
|
10
|
+
|
11
|
+
* Provides httpclient and httpcore jars.
|
12
|
+
* Provides a RJack::HTTPClient4::ManagerFacade for client and connection
|
13
|
+
manager setup, start, shutdown.
|
14
|
+
|
15
|
+
== Synopsis
|
16
|
+
|
17
|
+
require 'rjack-logback'
|
18
|
+
require 'rjack-httpclient-4'
|
19
|
+
|
20
|
+
mf = RJack::HTTPClient4::ManagerFacade.new
|
21
|
+
|
22
|
+
mf.connection_params.so_timeout = 2000 #ms
|
23
|
+
mf.manager_params.timeout = 2000 #ms
|
24
|
+
mf.manager_params.max_total_connections = 200
|
25
|
+
mf.manager_params.connections_per_route = 10
|
26
|
+
mf.client_params.default_headers = { "X-Name" => "value" }
|
27
|
+
mf.client_params.cookie_policy = CookiePolicy::BEST_MATCH
|
28
|
+
mf.start
|
29
|
+
|
30
|
+
mf.client # --> org.apache.http.client.HttpClient
|
31
|
+
|
32
|
+
mf.shutdown
|
33
|
+
|
34
|
+
See {org.apache.http.client.HttpClient}[http://hc.apache.org/httpcomponents-client/httpclient/apidocs/org/apache/http/client/HttpClient.html].
|
35
|
+
|
36
|
+
== Requirements
|
37
|
+
|
38
|
+
* rjack-commons-codec[http://rjack.rubyforge.org/commons-codec].
|
39
|
+
|
40
|
+
* rjack-slf4j[http://rjack.rubyforge.org/slf4j].
|
41
|
+
|
42
|
+
* An SLF4J output adaptor such as 'rjack-slf4j/simple' or
|
43
|
+
rjack-logback[http://rjack.rubyforge.org/logback] must be require'd
|
44
|
+
before rjack-httpclient. (The rjack-logback gem is listed as a
|
45
|
+
development dependency only.)
|
46
|
+
|
47
|
+
== License
|
48
|
+
|
49
|
+
=== rjack-httpclient-4 gem
|
50
|
+
|
51
|
+
Copyright (c) 2008-2009 David Kellum
|
52
|
+
|
53
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you
|
54
|
+
may not use this file except in compliance with the License. You
|
55
|
+
may obtain a copy of the License at:
|
56
|
+
|
57
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
58
|
+
|
59
|
+
Unless required by applicable law or agreed to in writing, software
|
60
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
61
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
62
|
+
implied. See the License for the specific language governing
|
63
|
+
permissions and limitations under the License.
|
64
|
+
|
65
|
+
=== HttpComponents Client (java)
|
66
|
+
|
67
|
+
Copyright (c) 1999-2009 The Apache Software Foundation
|
68
|
+
|
69
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
70
|
+
contributor license agreements. See the NOTICE file distributed with
|
71
|
+
this work for additional information regarding copyright ownership.
|
72
|
+
The ASF licenses this file to You under the Apache License, Version
|
73
|
+
2.0 (the "License"); you may not use this file except in compliance
|
74
|
+
with the License. You may obtain a copy of the License at
|
75
|
+
|
76
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
77
|
+
|
78
|
+
Unless required by applicable law or agreed to in writing, software
|
79
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
80
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
81
|
+
implied. See the License for the specific language governing
|
82
|
+
permissions and limitations under the License.
|
data/Rakefile
ADDED
@@ -0,0 +1,57 @@
|
|
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
|
+
$LOAD_PATH << './lib'
|
19
|
+
require 'rjack-httpclient-4/base'
|
20
|
+
|
21
|
+
require 'rubygems'
|
22
|
+
gem 'rjack-tarpit', '~> 1.2.0'
|
23
|
+
require 'rjack-tarpit'
|
24
|
+
|
25
|
+
include RJack
|
26
|
+
|
27
|
+
t = TarPit.new( 'rjack-httpclient-4',
|
28
|
+
HTTPClient4::VERSION,
|
29
|
+
:jars_from_assembly, :java_platform )
|
30
|
+
|
31
|
+
t.specify do |h|
|
32
|
+
h.developer( "David Kellum", "dek-oss@gravitext.com" )
|
33
|
+
h.extra_deps += [ [ 'rjack-slf4j', '~> 1.5.8' ],
|
34
|
+
[ 'rjack-commons-codec', '~> 1.4.0' ] ]
|
35
|
+
h.extra_dev_deps << [ 'rjack-logback', '>= 0.9.17' ]
|
36
|
+
h.rubyforge_name = "rjack"
|
37
|
+
h.remote_rdoc_dir = "httpclient-4"
|
38
|
+
end
|
39
|
+
|
40
|
+
t.assembly_version = 1.0
|
41
|
+
|
42
|
+
task :check_pom_deps do
|
43
|
+
t.test_line_match( 'pom.xml',
|
44
|
+
%r[<version>#{ HTTPClient4::HTTPCLIENT_VERSION }</version>] )
|
45
|
+
end
|
46
|
+
task :check_history_version do
|
47
|
+
t.test_line_match( 'History.rdoc', /^==/, / #{t.version} / )
|
48
|
+
end
|
49
|
+
task :check_history_date do
|
50
|
+
t.test_line_match( 'History.rdoc', /^==/, /\([0-9\-]+\)$/ )
|
51
|
+
end
|
52
|
+
|
53
|
+
task :gem => [ :check_pom_deps, :check_history_version ]
|
54
|
+
task :tag => [ :check_pom_deps, :check_history_version, :check_history_date ]
|
55
|
+
task :push => [ :check_history_date ]
|
56
|
+
|
57
|
+
t.define_tasks
|
data/assembly.xml
ADDED
@@ -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>org.apache.httpcomponents:httpclient</include>
|
11
|
+
<include>org.apache.httpcomponents:httpcore</include>
|
12
|
+
</includes>
|
13
|
+
</dependencySet>
|
14
|
+
</dependencySets>
|
15
|
+
</assembly>
|
@@ -0,0 +1,175 @@
|
|
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
|
+
|
19
|
+
require 'rjack-slf4j'
|
20
|
+
require 'rjack-slf4j/jcl-over-slf4j'
|
21
|
+
require 'rjack-commons-codec'
|
22
|
+
require 'rjack-httpclient-4/base'
|
23
|
+
|
24
|
+
module RJack
|
25
|
+
module HTTPClient4
|
26
|
+
|
27
|
+
Dir.glob( File.join( HTTPCLIENT_DIR, '*.jar' ) ).each { |jar| require jar }
|
28
|
+
|
29
|
+
import 'org.apache.http.client.params.ClientParamBean'
|
30
|
+
import 'org.apache.http.client.params.CookiePolicy'
|
31
|
+
import 'org.apache.http.conn.MultihomePlainSocketFactory'
|
32
|
+
import 'org.apache.http.conn.params.ConnManagerParamBean'
|
33
|
+
import 'org.apache.http.conn.params.ConnPerRouteBean'
|
34
|
+
import 'org.apache.http.conn.scheme.Scheme'
|
35
|
+
import 'org.apache.http.conn.scheme.SchemeRegistry'
|
36
|
+
import 'org.apache.http.conn.ssl.SSLSocketFactory'
|
37
|
+
import 'org.apache.http.impl.client.DefaultHttpClient'
|
38
|
+
import 'org.apache.http.impl.client.DefaultHttpRequestRetryHandler'
|
39
|
+
import 'org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager'
|
40
|
+
import 'org.apache.http.message.BasicHeader'
|
41
|
+
import 'org.apache.http.params.BasicHttpParams'
|
42
|
+
import 'org.apache.http.params.HttpConnectionParamBean'
|
43
|
+
|
44
|
+
# Facade over http client and connection manager, supporting
|
45
|
+
# setup -> start() -> shutdown()
|
46
|
+
class ManagerFacade
|
47
|
+
# {Manager parameters}[http://hc.apache.org/httpcomponents-client/httpclient/apidocs/org/apache/http/conn/params/ConnManagerParamBean.html]
|
48
|
+
# "bean", responding to various setters:
|
49
|
+
#
|
50
|
+
# manager_params.max_total_connections = 200
|
51
|
+
# manager_params.timeout = 2000 #milliseconds
|
52
|
+
# manager_params.connections_per_route = 10
|
53
|
+
#
|
54
|
+
attr_reader :manager_params
|
55
|
+
|
56
|
+
# {Client parameters}[http://hc.apache.org/httpcomponents-client/httpclient/apidocs/org/apache/http/client/params/ClientParamBean.html]
|
57
|
+
# "bean", responding to various setters:
|
58
|
+
#
|
59
|
+
# client_params.allow_circular_redirects = false
|
60
|
+
# client_params.cookie_policy = CookiePolicy::BEST_MATCH
|
61
|
+
# client_params.default_headers = { "X-Name" => "value" }
|
62
|
+
# client_params.handle_redirects = true
|
63
|
+
# client_params.reject_relative_redirect = true
|
64
|
+
#
|
65
|
+
attr_reader :client_params
|
66
|
+
|
67
|
+
# {Connection parameters}[http://hc.apache.org/httpcomponents-core/httpcore/apidocs/org/apache/http/params/HttpConnectionParamBean.html]
|
68
|
+
# "bean", responding to various setters:
|
69
|
+
#
|
70
|
+
# connection_params.connection_timeout = 2000 #milliseconds
|
71
|
+
# connection_params.so_timeout = 3000 #milliseconds
|
72
|
+
# connection_params.linger = 2 #seconds
|
73
|
+
# connection_params.socket_buffer_size = 2 * 1024 #bytes
|
74
|
+
# connection_params.stale_checking_enabled = true
|
75
|
+
# connection_params.tcp_no_delay = false
|
76
|
+
#
|
77
|
+
attr_reader :connection_params
|
78
|
+
|
79
|
+
# {org.apache.http.client.HttpClient}[http://hc.apache.org/httpcomponents-client/httpclient/apidocs/org/apache/http/client/HttpClient.html]
|
80
|
+
# available after start()
|
81
|
+
attr_reader :client
|
82
|
+
|
83
|
+
# New facade ready for setup
|
84
|
+
def initialize
|
85
|
+
@mparams = BasicHttpParams.new
|
86
|
+
@cparams = BasicHttpParams.new
|
87
|
+
|
88
|
+
@manager_params = ConnManagerParamBean.new( @mparams )
|
89
|
+
@client_params = ClientParamBean.new( @cparams )
|
90
|
+
@connection_params = HttpConnectionParamBean.new( @cparams )
|
91
|
+
|
92
|
+
@client = nil
|
93
|
+
@connection_manager = nil
|
94
|
+
@retry_handler = nil
|
95
|
+
end
|
96
|
+
|
97
|
+
# Setup a DefaultHttpRequestRetryHandler
|
98
|
+
def set_retry_handler( count, retry_if_sent = false )
|
99
|
+
@retry_handler =
|
100
|
+
DefaultHttpRequestRetryHandler.new( count, retry_if_sent )
|
101
|
+
end
|
102
|
+
|
103
|
+
# Given previous setup, create connection manager, create, and
|
104
|
+
# return client.
|
105
|
+
def start
|
106
|
+
@scheme_registry = create_scheme_registry
|
107
|
+
@connection_manager = create_connection_manager
|
108
|
+
|
109
|
+
@client = create_http_client
|
110
|
+
end
|
111
|
+
|
112
|
+
# Shutdown client and connection manager.
|
113
|
+
def shutdown
|
114
|
+
@connection_manager.shutdown if @connection_manager
|
115
|
+
@client = nil
|
116
|
+
@connection_manager = nil
|
117
|
+
end
|
118
|
+
|
119
|
+
# Create a default SchemeRegistry with http and https enabled.
|
120
|
+
def create_scheme_registry
|
121
|
+
sr = SchemeRegistry.new
|
122
|
+
sr.register( Scheme.new( "http", plain_factory, 80 ) )
|
123
|
+
sr.register( Scheme.new( "https", ssl_factory, 443 ) )
|
124
|
+
sr
|
125
|
+
end
|
126
|
+
|
127
|
+
# Return MultihomePlainSocketFactory instance
|
128
|
+
def plain_factory
|
129
|
+
MultihomePlainSocketFactory::socket_factory
|
130
|
+
end
|
131
|
+
|
132
|
+
# Return SSLSocketFactory instance
|
133
|
+
def ssl_factory
|
134
|
+
SSLSocketFactory::socket_factory
|
135
|
+
end
|
136
|
+
|
137
|
+
# Create default ThreadSafeClientConnManager using a set manager_params
|
138
|
+
def create_connection_manager
|
139
|
+
ThreadSafeClientConnManager.new( @mparams, @scheme_registry )
|
140
|
+
end
|
141
|
+
|
142
|
+
# Create DefaultHttpClient given connection manager and any set
|
143
|
+
# client or connection_params
|
144
|
+
def create_http_client
|
145
|
+
c = DefaultHttpClient.new( @connection_manager, @cparams )
|
146
|
+
c.http_request_retry_handler = @retry_handler if @retry_handler
|
147
|
+
c
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
# ConnManagerParamBean reopen
|
153
|
+
class ConnManagerParamBean
|
154
|
+
# Convert to ConnPerRouteBean.new( value ) unless is one.
|
155
|
+
def connections_per_route=( value )
|
156
|
+
unless value.is_a?( ConnPerRouteBean )
|
157
|
+
value = ConnPerRouteBean.new( value.to_i )
|
158
|
+
end
|
159
|
+
setConnectionsPerRoute( value )
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# ClientParamBean reopen
|
164
|
+
class ClientParamBean
|
165
|
+
# Convert to [ BasicHeader.new( k,v ) ] if value is hash.
|
166
|
+
def default_headers=( value )
|
167
|
+
if value.is_a?( Hash )
|
168
|
+
value = value.map { |nv| BasicHeader.new( *nv ) }
|
169
|
+
end
|
170
|
+
setDefaultHeaders( value )
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
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 RJack
|
18
|
+
module HTTPClient4
|
19
|
+
HTTPCLIENT_VERSION = '4.0.1'
|
20
|
+
VERSION = HTTPCLIENT_VERSION + '.1'
|
21
|
+
|
22
|
+
HTTPCLIENT_DIR = File.dirname( __FILE__ ) # :nodoc:
|
23
|
+
end
|
24
|
+
end
|
Binary file
|
Binary file
|
data/pom.xml
ADDED
@@ -0,0 +1,75 @@
|
|
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-httpclient-4</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>org.apache.httpcomponents</groupId>
|
14
|
+
<artifactId>httpclient</artifactId>
|
15
|
+
<version>4.0.1</version>
|
16
|
+
<exclusions>
|
17
|
+
<exclusion>
|
18
|
+
<groupId>commons-logging</groupId>
|
19
|
+
<artifactId>commons-logging</artifactId>
|
20
|
+
</exclusion>
|
21
|
+
</exclusions>
|
22
|
+
</dependency>
|
23
|
+
|
24
|
+
<!--
|
25
|
+
<dependency>
|
26
|
+
<groupId>org.apache.httpcomponents</groupId>
|
27
|
+
<artifactId>httpmime</artifactId>
|
28
|
+
<version>4.0</version>
|
29
|
+
<exclusions>
|
30
|
+
<exclusion>
|
31
|
+
<groupId>commons-logging</groupId>
|
32
|
+
<artifactId>commons-logging</artifactId>
|
33
|
+
</exclusion>
|
34
|
+
</exclusions>
|
35
|
+
</dependency>
|
36
|
+
-->
|
37
|
+
|
38
|
+
</dependencies>
|
39
|
+
|
40
|
+
<build>
|
41
|
+
<plugins>
|
42
|
+
<plugin>
|
43
|
+
<artifactId>maven-assembly-plugin</artifactId>
|
44
|
+
<configuration>
|
45
|
+
<descriptors>
|
46
|
+
<descriptor>assembly.xml</descriptor>
|
47
|
+
</descriptors>
|
48
|
+
<tarLongFileMode>gnu</tarLongFileMode>
|
49
|
+
</configuration>
|
50
|
+
<executions>
|
51
|
+
<execution>
|
52
|
+
<id>assembly</id>
|
53
|
+
<phase>package</phase>
|
54
|
+
<goals>
|
55
|
+
<goal>attached</goal>
|
56
|
+
</goals>
|
57
|
+
</execution>
|
58
|
+
</executions>
|
59
|
+
</plugin>
|
60
|
+
<plugin>
|
61
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
62
|
+
<configuration>
|
63
|
+
<source>1.5</source>
|
64
|
+
<target>1.5</target>
|
65
|
+
<optimize>true</optimize>
|
66
|
+
<debug>true</debug>
|
67
|
+
<encoding>UTF-8</encoding>
|
68
|
+
<showDeprecation>true</showDeprecation>
|
69
|
+
<showWarnings>true</showWarnings>
|
70
|
+
</configuration>
|
71
|
+
</plugin>
|
72
|
+
</plugins>
|
73
|
+
</build>
|
74
|
+
|
75
|
+
</project>
|
@@ -0,0 +1,60 @@
|
|
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( 'rjack-logback', '>= 0.9.17.1' )
|
20
|
+
|
21
|
+
require 'rjack-logback'
|
22
|
+
Logback.config_console( :level => Logback::DEBUG )
|
23
|
+
|
24
|
+
require 'test/unit'
|
25
|
+
|
26
|
+
$LOAD_PATH.unshift File.join( File.dirname(__FILE__), "..", "lib" )
|
27
|
+
|
28
|
+
require 'rjack-httpclient-4'
|
29
|
+
|
30
|
+
class TestClient < Test::Unit::TestCase
|
31
|
+
include RJack::HTTPClient4
|
32
|
+
def test_setup
|
33
|
+
mf = ManagerFacade.new
|
34
|
+
|
35
|
+
mf.manager_params.max_total_connections = 200
|
36
|
+
mf.manager_params.timeout = 2000 #milliseconds
|
37
|
+
mf.manager_params.connections_per_route = 10
|
38
|
+
mf.client_params.allow_circular_redirects = false
|
39
|
+
mf.client_params.cookie_policy = CookiePolicy::BEST_MATCH
|
40
|
+
mf.client_params.default_headers = { "X-Name" => "value" }
|
41
|
+
mf.client_params.handle_redirects = true
|
42
|
+
mf.client_params.reject_relative_redirect = true
|
43
|
+
mf.connection_params.connection_timeout = 2000 #milliseconds
|
44
|
+
mf.connection_params.so_timeout = 3000 #milliseconds
|
45
|
+
mf.connection_params.linger = 2 #seconds
|
46
|
+
mf.connection_params.socket_buffer_size = 2 * 1024 #bytes
|
47
|
+
mf.connection_params.stale_checking_enabled = true
|
48
|
+
mf.connection_params.tcp_no_delay = false
|
49
|
+
|
50
|
+
mf.set_retry_handler( 2 )
|
51
|
+
|
52
|
+
mf.start
|
53
|
+
|
54
|
+
assert_not_nil mf.client
|
55
|
+
|
56
|
+
mf.shutdown
|
57
|
+
|
58
|
+
assert_nil mf.client
|
59
|
+
end
|
60
|
+
end
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rjack-httpclient-4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 4.0.1.1
|
5
|
+
platform: java
|
6
|
+
authors:
|
7
|
+
- David Kellum
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-03-06 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rjack-slf4j
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.5.8
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rjack-commons-codec
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.4.0
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rjack-logback
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.9.17
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: rjack-tarpit
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.2.0
|
54
|
+
version:
|
55
|
+
description: |-
|
56
|
+
A gem packaging of the {HttpComponents}[http://hc.apache.org/] HTTP
|
57
|
+
Client 4.x for JRuby.
|
58
|
+
|
59
|
+
* Provides httpclient and httpcore jars.
|
60
|
+
* Provides a RJack::HTTPClient4::ManagerFacade for client and connection
|
61
|
+
manager setup, start, shutdown.
|
62
|
+
email:
|
63
|
+
- dek-oss@gravitext.com
|
64
|
+
executables: []
|
65
|
+
|
66
|
+
extensions: []
|
67
|
+
|
68
|
+
extra_rdoc_files:
|
69
|
+
- Manifest.txt
|
70
|
+
- NOTICE.txt
|
71
|
+
- README.rdoc
|
72
|
+
- History.rdoc
|
73
|
+
files:
|
74
|
+
- Manifest.static
|
75
|
+
- Manifest.txt
|
76
|
+
- README.rdoc
|
77
|
+
- History.rdoc
|
78
|
+
- NOTICE.txt
|
79
|
+
- Rakefile
|
80
|
+
- pom.xml
|
81
|
+
- assembly.xml
|
82
|
+
- lib/rjack-httpclient-4/base.rb
|
83
|
+
- lib/rjack-httpclient-4.rb
|
84
|
+
- test/test_httpclient.rb
|
85
|
+
- lib/rjack-httpclient-4/httpclient-4.0.1.jar
|
86
|
+
- lib/rjack-httpclient-4/httpcore-4.0.1.jar
|
87
|
+
has_rdoc: true
|
88
|
+
homepage: http://rjack.rubyforge.org
|
89
|
+
licenses: []
|
90
|
+
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options:
|
93
|
+
- --main
|
94
|
+
- README.rdoc
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: "0"
|
102
|
+
version:
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: "0"
|
108
|
+
version:
|
109
|
+
requirements: []
|
110
|
+
|
111
|
+
rubyforge_project: rjack
|
112
|
+
rubygems_version: 1.3.5
|
113
|
+
signing_key:
|
114
|
+
specification_version: 3
|
115
|
+
summary: A gem packaging of the {HttpComponents}[http://hc.apache.org/] HTTP Client 4.x for JRuby
|
116
|
+
test_files:
|
117
|
+
- test/test_httpclient.rb
|