Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 251740 | Differences between
and this patch

Collapse All | Expand All

(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/.classpath (+7 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/.gitignore (+1 lines)
Added Link Here
1
bin
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/.options (+16 lines)
Added Link Here
1
# Debugging options for the org.eclipse.ecf.provider.filetransfer.httpclient plug-in
2
3
# Turn on general debugging for the org.eclipse.ecf.provider.filetransfer.httpclient plug-in
4
org.eclipse.ecf.provider.filetransfer.httpclient/debug=false
5
org.eclipse.ecf.provider.filetransfer.httpclient/debug/filter = *
6
org.eclipse.ecf.provider.filetransfer.httpclient/debug/flag = false
7
8
# Trace when exceptions are caught
9
org.eclipse.ecf.provider.filetransfer.httpclient/debug/exceptions/catching=false
10
# Trace when exceptions are thrown
11
org.eclipse.ecf.provider.filetransfer.httpclient/debug/exceptions/throwing=false
12
13
# Trace when methods are entered
14
org.eclipse.ecf.provider.filetransfer.httpclient/debug/methods/entering=false
15
# Trace when methods are exited
16
org.eclipse.ecf.provider.filetransfer.httpclient/debug/methods/exiting=false
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/.project (+34 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.eclipse.ecf.provider.filetransfer.httpclient</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
		<buildCommand>
24
			<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
25
			<arguments>
26
			</arguments>
27
		</buildCommand>
28
	</buildSpec>
29
	<natures>
30
		<nature>org.eclipse.pde.PluginNature</nature>
31
		<nature>org.eclipse.jdt.core.javanature</nature>
32
		<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
33
	</natures>
34
</projectDescription>
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/.settings/org.eclipse.jdt.core.prefs (+351 lines)
Added Link Here
1
#Fri Jan 29 14:30:16 PST 2010
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
4
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
5
org.eclipse.jdt.core.builder.invalidClasspath=abort
6
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
7
org.eclipse.jdt.core.circularClasspath=error
8
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
9
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
10
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
11
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
12
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
13
org.eclipse.jdt.core.compiler.compliance=1.4
14
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
15
org.eclipse.jdt.core.compiler.debug.localVariable=generate
16
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
17
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
18
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
19
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
20
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
21
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
22
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
23
org.eclipse.jdt.core.compiler.problem.deadCode=warning
24
org.eclipse.jdt.core.compiler.problem.deprecation=warning
25
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
26
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
27
org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
28
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
29
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
30
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
31
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
32
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
33
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
34
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
35
org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore
36
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
37
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
38
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
39
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
40
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
41
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=disabled
42
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
43
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
44
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
45
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
46
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
47
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
48
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
49
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
50
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
51
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
52
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
53
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
54
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
55
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
56
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
57
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
58
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
59
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
60
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
61
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
62
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
63
org.eclipse.jdt.core.compiler.problem.nullReference=warning
64
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
65
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
66
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
67
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
68
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
69
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
70
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
71
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
72
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
73
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
74
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
75
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
76
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
77
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
78
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
79
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
80
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
81
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
82
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
83
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
84
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
85
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
86
org.eclipse.jdt.core.compiler.problem.unusedImport=error
87
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
88
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
89
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
90
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
91
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
92
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
93
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
94
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
95
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
96
org.eclipse.jdt.core.compiler.source=1.3
97
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
98
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
99
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
100
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
101
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
102
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
103
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
104
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
105
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
106
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
107
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
108
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
109
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
110
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
111
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
112
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
113
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
114
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
115
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
116
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
117
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
118
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
119
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
120
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
121
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
122
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
123
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
124
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
125
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
126
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
127
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
128
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
129
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
130
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
131
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
132
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
133
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
134
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
135
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
136
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
137
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
138
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
139
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
140
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
141
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
142
org.eclipse.jdt.core.formatter.comment.format_block_comments=false
143
org.eclipse.jdt.core.formatter.comment.format_header=false
144
org.eclipse.jdt.core.formatter.comment.format_html=true
145
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
146
org.eclipse.jdt.core.formatter.comment.format_line_comments=false
147
org.eclipse.jdt.core.formatter.comment.format_source_code=true
148
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
149
org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
150
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
151
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
152
org.eclipse.jdt.core.formatter.comment.line_length=80
153
org.eclipse.jdt.core.formatter.compact_else_if=true
154
org.eclipse.jdt.core.formatter.continuation_indentation=2
155
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
156
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
157
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
158
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
159
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
160
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
161
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
162
org.eclipse.jdt.core.formatter.indent_empty_lines=false
163
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
164
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
165
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
166
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
167
org.eclipse.jdt.core.formatter.indentation.size=4
168
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
169
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
170
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
171
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
172
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
173
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
174
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
175
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
176
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
177
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
178
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
179
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
180
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
181
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
182
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
183
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
184
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
185
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
186
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
187
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
188
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
189
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
190
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
191
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
192
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
193
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
194
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
195
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
196
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
197
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
198
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
199
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
200
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
201
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
202
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
203
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
204
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
205
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
206
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
207
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
208
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
209
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
210
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
211
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
212
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
213
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
214
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
215
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
216
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
217
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
218
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
219
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
220
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
221
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
222
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
223
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
224
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
225
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
226
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
227
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
228
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
229
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
230
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
231
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
232
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
233
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
234
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
235
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
236
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
237
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
238
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
239
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
240
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
241
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
242
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
243
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
244
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
245
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
246
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
247
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
248
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
249
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
250
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
251
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
252
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
253
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
254
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
255
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
256
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
257
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
258
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
259
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
260
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
261
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
262
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
263
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
264
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
265
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
266
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
267
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
268
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
269
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
270
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
271
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
272
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
273
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
274
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
275
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
276
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
277
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
278
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
279
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
280
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
281
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
282
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
283
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
284
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
285
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
286
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
287
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
288
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
289
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
290
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
291
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
292
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
293
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
294
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
295
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
296
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
297
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
298
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
299
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
300
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
301
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
302
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
303
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
304
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
305
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
306
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
307
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
308
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
309
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
310
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
311
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
312
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
313
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
314
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
315
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
316
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
317
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
318
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
319
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
320
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
321
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
322
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
323
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
324
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
325
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
326
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
327
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
328
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
329
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
330
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
331
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
332
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
333
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
334
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
335
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
336
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
337
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
338
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
339
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
340
org.eclipse.jdt.core.formatter.lineSplit=800
341
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
342
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
343
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
344
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
345
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
346
org.eclipse.jdt.core.formatter.tabulation.char=tab
347
org.eclipse.jdt.core.formatter.tabulation.size=4
348
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
349
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
350
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
351
org.eclipse.jdt.core.incompleteClasspath=error
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/.settings/org.eclipse.jdt.core.prefs.bak (+12 lines)
Added Link Here
1
#Mon May 16 09:37:06 CDT 2011
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6
org.eclipse.jdt.core.compiler.compliance=1.4
7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
11
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
12
org.eclipse.jdt.core.compiler.source=1.3
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/.settings/org.eclipse.jdt.launching.prefs (+3 lines)
Added Link Here
1
#Tue Feb 03 16:03:47 PST 2009
2
eclipse.preferences.version=1
3
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/.settings/org.eclipse.jdt.ui.prefs (+61 lines)
Added Link Here
1
#Thu Mar 12 11:02:43 PDT 2009
2
eclipse.preferences.version=1
3
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
4
formatter_profile=_core
5
formatter_settings_version=11
6
internal.default.compliance=user
7
org.eclipse.jdt.ui.ignorelowercasenames=true
8
org.eclipse.jdt.ui.importorder=
9
org.eclipse.jdt.ui.ondemandthreshold=100
10
org.eclipse.jdt.ui.staticondemandthreshold=99
11
sp_cleanup.add_default_serial_version_id=true
12
sp_cleanup.add_generated_serial_version_id=false
13
sp_cleanup.add_missing_annotations=true
14
sp_cleanup.add_missing_deprecated_annotations=true
15
sp_cleanup.add_missing_methods=false
16
sp_cleanup.add_missing_nls_tags=false
17
sp_cleanup.add_missing_override_annotations=true
18
sp_cleanup.add_serial_version_id=false
19
sp_cleanup.always_use_blocks=true
20
sp_cleanup.always_use_parentheses_in_expressions=false
21
sp_cleanup.always_use_this_for_non_static_field_access=false
22
sp_cleanup.always_use_this_for_non_static_method_access=false
23
sp_cleanup.convert_to_enhanced_for_loop=false
24
sp_cleanup.correct_indentation=false
25
sp_cleanup.format_source_code=true
26
sp_cleanup.format_source_code_changes_only=false
27
sp_cleanup.make_local_variable_final=false
28
sp_cleanup.make_parameters_final=false
29
sp_cleanup.make_private_fields_final=true
30
sp_cleanup.make_type_abstract_if_missing_method=false
31
sp_cleanup.make_variable_declarations_final=true
32
sp_cleanup.never_use_blocks=false
33
sp_cleanup.never_use_parentheses_in_expressions=true
34
sp_cleanup.on_save_use_additional_actions=false
35
sp_cleanup.organize_imports=true
36
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
37
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
38
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
39
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
40
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
41
sp_cleanup.remove_private_constructors=true
42
sp_cleanup.remove_trailing_whitespaces=false
43
sp_cleanup.remove_trailing_whitespaces_all=true
44
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
45
sp_cleanup.remove_unnecessary_casts=true
46
sp_cleanup.remove_unnecessary_nls_tags=false
47
sp_cleanup.remove_unused_imports=false
48
sp_cleanup.remove_unused_local_variables=false
49
sp_cleanup.remove_unused_private_fields=true
50
sp_cleanup.remove_unused_private_members=false
51
sp_cleanup.remove_unused_private_methods=true
52
sp_cleanup.remove_unused_private_types=true
53
sp_cleanup.sort_members=false
54
sp_cleanup.sort_members_all=false
55
sp_cleanup.use_blocks=false
56
sp_cleanup.use_blocks_only_for_return_and_throw=false
57
sp_cleanup.use_parentheses_in_expressions=false
58
sp_cleanup.use_this_for_non_static_field_access=false
59
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
60
sp_cleanup.use_this_for_non_static_method_access=false
61
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/.settings/org.eclipse.pde.api.tools.prefs (+94 lines)
Added Link Here
1
#Wed Sep 01 15:16:36 PDT 2010
2
ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
3
ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
4
ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
5
ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
6
ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
7
API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
8
API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
9
API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
10
API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
11
CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
12
CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
13
CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
14
CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
15
CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
16
CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
17
CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
18
CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
19
CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
20
CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
21
CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
22
CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
23
CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
24
CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
25
CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
26
CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
27
CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
28
CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
29
ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
30
ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
31
ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
32
ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
33
ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
34
ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
35
FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
36
FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
37
FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
38
FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
39
FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
40
FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
41
FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
42
FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
43
FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
44
FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
45
ILLEGAL_EXTEND=Warning
46
ILLEGAL_IMPLEMENT=Warning
47
ILLEGAL_INSTANTIATE=Warning
48
ILLEGAL_OVERRIDE=Warning
49
ILLEGAL_REFERENCE=Warning
50
INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
51
INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
52
INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
53
INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
54
INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
55
INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
56
INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
57
INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
58
INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
59
INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
60
INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
61
INVALID_JAVADOC_TAG=Ignore
62
INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Error
63
LEAK_EXTEND=Warning
64
LEAK_FIELD_DECL=Warning
65
LEAK_IMPLEMENT=Ignore
66
LEAK_METHOD_PARAM=Warning
67
LEAK_METHOD_RETURN_TYPE=Warning
68
METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
69
METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
70
METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
71
METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
72
METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
73
METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
74
METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
75
METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
76
METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
77
METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
78
TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
79
TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
80
TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
81
TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
82
TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
83
TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
84
UNUSED_PROBLEM_FILTERS=Warning
85
automatically_removed_unused_problem_filters=false
86
eclipse.preferences.version=1
87
incompatible_api_component_version=Error
88
incompatible_api_component_version_include_major_without_breaking_change=Disabled
89
incompatible_api_component_version_include_minor_without_api_change=Disabled
90
invalid_since_tag_version=Error
91
malformed_since_tag=Error
92
missing_since_tag=Error
93
report_api_breakage_when_major_version_incremented=Disabled
94
report_resolution_errors_api_component=Warning
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/.settings/org.eclipse.pde.prefs (+27 lines)
Added Link Here
1
#Fri Jan 29 14:33:19 PST 2010
2
compilers.f.unresolved-features=1
3
compilers.f.unresolved-plugins=1
4
compilers.incompatible-environment=1
5
compilers.p.build=2
6
compilers.p.build.missing.output=2
7
compilers.p.deprecated=1
8
compilers.p.discouraged-class=0
9
compilers.p.internal=1
10
compilers.p.missing-packages=2
11
compilers.p.missing-version-export-package=2
12
compilers.p.missing-version-import-package=2
13
compilers.p.missing-version-require-bundle=2
14
compilers.p.no-required-att=0
15
compilers.p.not-externalized-att=2
16
compilers.p.unknown-attribute=1
17
compilers.p.unknown-class=1
18
compilers.p.unknown-element=1
19
compilers.p.unknown-identifier=1
20
compilers.p.unknown-resource=1
21
compilers.p.unresolved-ex-points=0
22
compilers.p.unresolved-import=0
23
compilers.s.create-docs=false
24
compilers.s.doc-folder=doc
25
compilers.s.open-tags=1
26
compilers.use-project=true
27
eclipse.preferences.version=1
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/META-INF/MANIFEST.MF (+36 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %plugin.name
4
Bundle-SymbolicName: org.eclipse.ecf.provider.filetransfer.httpclient4;singleton:=true
5
Bundle-Version: 1.0.0.qualifier
6
Bundle-Localization: plugin
7
Bundle-Activator: org.eclipse.ecf.internal.provider.filetransfer.httpclient.Activator
8
Require-Bundle: org.eclipse.equinox.common,
9
 org.eclipse.ecf.provider.filetransfer,
10
 org.eclipse.ecf,
11
 org.eclipse.ecf.filetransfer,
12
 org.apache.httpcomponents.httpclient;bundle-version="4.1.0",
13
 org.eclipse.osgi
14
Eclipse-LazyStart: true
15
Import-Package: org.apache.http;version="4.1.0",
16
 org.apache.http.entity;version="4.1.0",
17
 org.apache.http.impl;version="4.1.0",
18
 org.apache.http.impl.entity;version="4.1.0",
19
 org.apache.http.impl.io;version="4.1.0",
20
 org.apache.http.io;version="4.1.0",
21
 org.apache.http.message;version="4.1.0",
22
 org.apache.http.params;version="4.1.0",
23
 org.apache.http.protocol;version="4.1.0",
24
 org.apache.http.util;version="4.1.0",
25
 org.eclipse.core.runtime.jobs,
26
 org.eclipse.osgi.util;version="1.0.0",
27
 org.osgi.framework;version="1.3.0",
28
 org.osgi.service.log;version="1.3.0",
29
 org.osgi.service.url;version="1.0.0",
30
 org.osgi.util.tracker;version="1.3.2"
31
Export-Package: org.eclipse.ecf.internal.provider.filetransfer.httpclient;x-internal:=true,
32
 org.eclipse.ecf.provider.filetransfer.httpclient
33
Bundle-Vendor: %plugin.provider
34
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
35
 J2SE-1.5
36
Bundle-ActivationPolicy: lazy
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/about.html (+274 lines)
Added Link Here
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
6
<title>About</title>
7
</head>
8
<body lang="EN-US">
9
	<h3>About This Content</h3>
10
11
		<p>May 14, 2009</p>	
12
		<h3>License</h3>
13
14
		<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;).  
15
		Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
16
		Eclipse Public License Version 1.0 (&quot;EPL&quot;).  A copy of the EPL is available 
17
		at <a href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/legal/epl-v10.html</a>.
18
		For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
19
20
		<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is 
21
		being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
22
		apply to your use of any object code in the Content.  Check the Redistributor's license 
23
		that was provided with the Content.  If no such license exists, contact the Redistributor.  Unless otherwise
24
		indicated below, the terms and conditions of the EPL still apply to any source code in the Content
25
		and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
26
		
27
		<h3>Third Party Content</h3>
28
		<p>The Content includes items that have been sourced from third parties as set out below. If you 
29
		did not receive this Content directly from the Eclipse Foundation, the following is provided 
30
		for informational purposes only, and you should look to the Redistributor's license for 
31
		terms and conditions of use.</p>
32
33
<h4>Apache HttpClient v4.1.0</h4>
34
35
<p>This plugin is based on software developed by the Apache Httpclient project at <a href="http://jakarta.apache.org/commons/httpclient/">http://jakarta.apache.org/commons/httpclient/</a>.
36
A copy of this library is distributed within this plugin and
37
therefore this plugin is subject to the Apache License version 2.0, a copy of the license is contained
38
in the file <a href="asl-v20.txt">asl-v20.txt</a> and 
39
at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>.
40
</p>
41
42
<h4>Apache Commons Codec v1.4</h4>
43
44
<p>This plugin is based on software developed by the Apache Commons Codec project at <a href="http://jakarta.apache.org/commons/codec/">http://jakarta.apache.org/commons/codec/</a>.
45
A copy of this library is distributed within this plugin and
46
therefore this plugin is subject to the Apache License version 2.0, a copy of the license is contained
47
in the file <a href="asl-v20.txt">asl-v20.txt</a> and 
48
at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>.
49
</p>
50
51
<h4>Apache Commons Logging v1.1.1</h4>
52
53
<p>This plugin is based on software developed by the Apache Commons Codec project at <a href="http://jakarta.apache.org/commons/logging/">http://jakarta.apache.org/commons/logging/</a>.
54
A copy of this library is distributed within this plugin and
55
therefore this plugin is subject to the Apache License version 2.0, a copy of the license is contained
56
in the file <a href="asl-v20.txt">asl-v20.txt</a> and 
57
at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>.
58
</p>
59
60
<p>Your use of the this plugin and the components listed above is subject to the terms and conditions of the Apache License v2.0
61
which is available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>.
62
</p>
63
<p>
64
More specifically:</p>
65
66
<p></p>
67
68
<pre>
69
70
                                 Apache License
71
                           Version 2.0, January 2004
72
                        http://www.apache.org/licenses/
73
74
   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
75
76
   1. Definitions.
77
78
      "License" shall mean the terms and conditions for use, reproduction,
79
      and distribution as defined by Sections 1 through 9 of this document.
80
81
      "Licensor" shall mean the copyright owner or entity authorized by
82
      the copyright owner that is granting the License.
83
84
      "Legal Entity" shall mean the union of the acting entity and all
85
      other entities that control, are controlled by, or are under common
86
      control with that entity. For the purposes of this definition,
87
      "control" means (i) the power, direct or indirect, to cause the
88
      direction or management of such entity, whether by contract or
89
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
90
      outstanding shares, or (iii) beneficial ownership of such entity.
91
92
      "You" (or "Your") shall mean an individual or Legal Entity
93
      exercising permissions granted by this License.
94
95
      "Source" form shall mean the preferred form for making modifications,
96
      including but not limited to software source code, documentation
97
      source, and configuration files.
98
99
      "Object" form shall mean any form resulting from mechanical
100
      transformation or translation of a Source form, including but
101
      not limited to compiled object code, generated documentation,
102
      and conversions to other media types.
103
104
      "Work" shall mean the work of authorship, whether in Source or
105
      Object form, made available under the License, as indicated by a
106
      copyright notice that is included in or attached to the work
107
      (an example is provided in the Appendix below).
108
109
      "Derivative Works" shall mean any work, whether in Source or Object
110
      form, that is based on (or derived from) the Work and for which the
111
      editorial revisions, annotations, elaborations, or other modifications
112
      represent, as a whole, an original work of authorship. For the purposes
113
      of this License, Derivative Works shall not include works that remain
114
      separable from, or merely link (or bind by name) to the interfaces of,
115
      the Work and Derivative Works thereof.
116
117
      "Contribution" shall mean any work of authorship, including
118
      the original version of the Work and any modifications or additions
119
      to that Work or Derivative Works thereof, that is intentionally
120
      submitted to Licensor for inclusion in the Work by the copyright owner
121
      or by an individual or Legal Entity authorized to submit on behalf of
122
      the copyright owner. For the purposes of this definition, "submitted"
123
      means any form of electronic, verbal, or written communication sent
124
      to the Licensor or its representatives, including but not limited to
125
      communication on electronic mailing lists, source code control systems,
126
      and issue tracking systems that are managed by, or on behalf of, the
127
      Licensor for the purpose of discussing and improving the Work, but
128
      excluding communication that is conspicuously marked or otherwise
129
      designated in writing by the copyright owner as "Not a Contribution."
130
131
      "Contributor" shall mean Licensor and any individual or Legal Entity
132
      on behalf of whom a Contribution has been received by Licensor and
133
      subsequently incorporated within the Work.
134
135
   2. Grant of Copyright License. Subject to the terms and conditions of
136
      this License, each Contributor hereby grants to You a perpetual,
137
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
138
      copyright license to reproduce, prepare Derivative Works of,
139
      publicly display, publicly perform, sublicense, and distribute the
140
      Work and such Derivative Works in Source or Object form.
141
142
   3. Grant of Patent License. Subject to the terms and conditions of
143
      this License, each Contributor hereby grants to You a perpetual,
144
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
145
      (except as stated in this section) patent license to make, have made,
146
      use, offer to sell, sell, import, and otherwise transfer the Work,
147
      where such license applies only to those patent claims licensable
148
      by such Contributor that are necessarily infringed by their
149
      Contribution(s) alone or by combination of their Contribution(s)
150
      with the Work to which such Contribution(s) was submitted. If You
151
      institute patent litigation against any entity (including a
152
      cross-claim or counterclaim in a lawsuit) alleging that the Work
153
      or a Contribution incorporated within the Work constitutes direct
154
      or contributory patent infringement, then any patent licenses
155
      granted to You under this License for that Work shall terminate
156
      as of the date such litigation is filed.
157
158
   4. Redistribution. You may reproduce and distribute copies of the
159
      Work or Derivative Works thereof in any medium, with or without
160
      modifications, and in Source or Object form, provided that You
161
      meet the following conditions:
162
163
      (a) You must give any other recipients of the Work or
164
          Derivative Works a copy of this License; and
165
166
      (b) You must cause any modified files to carry prominent notices
167
          stating that You changed the files; and
168
169
      (c) You must retain, in the Source form of any Derivative Works
170
          that You distribute, all copyright, patent, trademark, and
171
          attribution notices from the Source form of the Work,
172
          excluding those notices that do not pertain to any part of
173
          the Derivative Works; and
174
175
      (d) If the Work includes a "NOTICE" text file as part of its
176
          distribution, then any Derivative Works that You distribute must
177
          include a readable copy of the attribution notices contained
178
          within such NOTICE file, excluding those notices that do not
179
          pertain to any part of the Derivative Works, in at least one
180
          of the following places: within a NOTICE text file distributed
181
          as part of the Derivative Works; within the Source form or
182
          documentation, if provided along with the Derivative Works; or,
183
          within a display generated by the Derivative Works, if and
184
          wherever such third-party notices normally appear. The contents
185
          of the NOTICE file are for informational purposes only and
186
          do not modify the License. You may add Your own attribution
187
          notices within Derivative Works that You distribute, alongside
188
          or as an addendum to the NOTICE text from the Work, provided
189
          that such additional attribution notices cannot be construed
190
          as modifying the License.
191
192
      You may add Your own copyright statement to Your modifications and
193
      may provide additional or different license terms and conditions
194
      for use, reproduction, or distribution of Your modifications, or
195
      for any such Derivative Works as a whole, provided Your use,
196
      reproduction, and distribution of the Work otherwise complies with
197
      the conditions stated in this License.
198
199
   5. Submission of Contributions. Unless You explicitly state otherwise,
200
      any Contribution intentionally submitted for inclusion in the Work
201
      by You to the Licensor shall be under the terms and conditions of
202
      this License, without any additional terms or conditions.
203
      Notwithstanding the above, nothing herein shall supersede or modify
204
      the terms of any separate license agreement you may have executed
205
      with Licensor regarding such Contributions.
206
207
   6. Trademarks. This License does not grant permission to use the trade
208
      names, trademarks, service marks, or product names of the Licensor,
209
      except as required for reasonable and customary use in describing the
210
      origin of the Work and reproducing the content of the NOTICE file.
211
212
   7. Disclaimer of Warranty. Unless required by applicable law or
213
      agreed to in writing, Licensor provides the Work (and each
214
      Contributor provides its Contributions) on an "AS IS" BASIS,
215
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
216
      implied, including, without limitation, any warranties or conditions
217
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
218
      PARTICULAR PURPOSE. You are solely responsible for determining the
219
      appropriateness of using or redistributing the Work and assume any
220
      risks associated with Your exercise of permissions under this License.
221
222
   8. Limitation of Liability. In no event and under no legal theory,
223
      whether in tort (including negligence), contract, or otherwise,
224
      unless required by applicable law (such as deliberate and grossly
225
      negligent acts) or agreed to in writing, shall any Contributor be
226
      liable to You for damages, including any direct, indirect, special,
227
      incidental, or consequential damages of any character arising as a
228
      result of this License or out of the use or inability to use the
229
      Work (including but not limited to damages for loss of goodwill,
230
      work stoppage, computer failure or malfunction, or any and all
231
      other commercial damages or losses), even if such Contributor
232
      has been advised of the possibility of such damages.
233
234
   9. Accepting Warranty or Additional Liability. While redistributing
235
      the Work or Derivative Works thereof, You may choose to offer,
236
      and charge a fee for, acceptance of support, warranty, indemnity,
237
      or other liability obligations and/or rights consistent with this
238
      License. However, in accepting such obligations, You may act only
239
      on Your own behalf and on Your sole responsibility, not on behalf
240
      of any other Contributor, and only if You agree to indemnify,
241
      defend, and hold each Contributor harmless for any liability
242
      incurred by, or claims asserted against, such Contributor by reason
243
      of your accepting any such warranty or additional liability.
244
245
   END OF TERMS AND CONDITIONS
246
247
   APPENDIX: How to apply the Apache License to your work.
248
249
      To apply the Apache License to your work, attach the following
250
      boilerplate notice, with the fields enclosed by brackets "[]"
251
      replaced with your own identifying information. (Don't include
252
      the brackets!)  The text should be enclosed in the appropriate
253
      comment syntax for the file format. We also recommend that a
254
      file or class name and description of purpose be included on the
255
      same "printed page" as the copyright notice for easier
256
      identification within third-party archives.
257
258
   Copyright [yyyy] [name of copyright owner]
259
260
   Licensed under the Apache License, Version 2.0 (the "License");
261
   you may not use this file except in compliance with the License.
262
   You may obtain a copy of the License at
263
264
       http://www.apache.org/licenses/LICENSE-2.0
265
266
   Unless required by applicable law or agreed to in writing, software
267
   distributed under the License is distributed on an "AS IS" BASIS,
268
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
269
   See the License for the specific language governing permissions and
270
   limitations under the License.
271
</pre>
272
273
</body>
274
</html>
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/asl-v20.txt (+202 lines)
Added Link Here
1
2
                                 Apache License
3
                           Version 2.0, January 2004
4
                        http://www.apache.org/licenses/
5
6
   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
8
   1. Definitions.
9
10
      "License" shall mean the terms and conditions for use, reproduction,
11
      and distribution as defined by Sections 1 through 9 of this document.
12
13
      "Licensor" shall mean the copyright owner or entity authorized by
14
      the copyright owner that is granting the License.
15
16
      "Legal Entity" shall mean the union of the acting entity and all
17
      other entities that control, are controlled by, or are under common
18
      control with that entity. For the purposes of this definition,
19
      "control" means (i) the power, direct or indirect, to cause the
20
      direction or management of such entity, whether by contract or
21
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
      outstanding shares, or (iii) beneficial ownership of such entity.
23
24
      "You" (or "Your") shall mean an individual or Legal Entity
25
      exercising permissions granted by this License.
26
27
      "Source" form shall mean the preferred form for making modifications,
28
      including but not limited to software source code, documentation
29
      source, and configuration files.
30
31
      "Object" form shall mean any form resulting from mechanical
32
      transformation or translation of a Source form, including but
33
      not limited to compiled object code, generated documentation,
34
      and conversions to other media types.
35
36
      "Work" shall mean the work of authorship, whether in Source or
37
      Object form, made available under the License, as indicated by a
38
      copyright notice that is included in or attached to the work
39
      (an example is provided in the Appendix below).
40
41
      "Derivative Works" shall mean any work, whether in Source or Object
42
      form, that is based on (or derived from) the Work and for which the
43
      editorial revisions, annotations, elaborations, or other modifications
44
      represent, as a whole, an original work of authorship. For the purposes
45
      of this License, Derivative Works shall not include works that remain
46
      separable from, or merely link (or bind by name) to the interfaces of,
47
      the Work and Derivative Works thereof.
48
49
      "Contribution" shall mean any work of authorship, including
50
      the original version of the Work and any modifications or additions
51
      to that Work or Derivative Works thereof, that is intentionally
52
      submitted to Licensor for inclusion in the Work by the copyright owner
53
      or by an individual or Legal Entity authorized to submit on behalf of
54
      the copyright owner. For the purposes of this definition, "submitted"
55
      means any form of electronic, verbal, or written communication sent
56
      to the Licensor or its representatives, including but not limited to
57
      communication on electronic mailing lists, source code control systems,
58
      and issue tracking systems that are managed by, or on behalf of, the
59
      Licensor for the purpose of discussing and improving the Work, but
60
      excluding communication that is conspicuously marked or otherwise
61
      designated in writing by the copyright owner as "Not a Contribution."
62
63
      "Contributor" shall mean Licensor and any individual or Legal Entity
64
      on behalf of whom a Contribution has been received by Licensor and
65
      subsequently incorporated within the Work.
66
67
   2. Grant of Copyright License. Subject to the terms and conditions of
68
      this License, each Contributor hereby grants to You a perpetual,
69
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
      copyright license to reproduce, prepare Derivative Works of,
71
      publicly display, publicly perform, sublicense, and distribute the
72
      Work and such Derivative Works in Source or Object form.
73
74
   3. Grant of Patent License. Subject to the terms and conditions of
75
      this License, each Contributor hereby grants to You a perpetual,
76
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
      (except as stated in this section) patent license to make, have made,
78
      use, offer to sell, sell, import, and otherwise transfer the Work,
79
      where such license applies only to those patent claims licensable
80
      by such Contributor that are necessarily infringed by their
81
      Contribution(s) alone or by combination of their Contribution(s)
82
      with the Work to which such Contribution(s) was submitted. If You
83
      institute patent litigation against any entity (including a
84
      cross-claim or counterclaim in a lawsuit) alleging that the Work
85
      or a Contribution incorporated within the Work constitutes direct
86
      or contributory patent infringement, then any patent licenses
87
      granted to You under this License for that Work shall terminate
88
      as of the date such litigation is filed.
89
90
   4. Redistribution. You may reproduce and distribute copies of the
91
      Work or Derivative Works thereof in any medium, with or without
92
      modifications, and in Source or Object form, provided that You
93
      meet the following conditions:
94
95
      (a) You must give any other recipients of the Work or
96
          Derivative Works a copy of this License; and
97
98
      (b) You must cause any modified files to carry prominent notices
99
          stating that You changed the files; and
100
101
      (c) You must retain, in the Source form of any Derivative Works
102
          that You distribute, all copyright, patent, trademark, and
103
          attribution notices from the Source form of the Work,
104
          excluding those notices that do not pertain to any part of
105
          the Derivative Works; and
106
107
      (d) If the Work includes a "NOTICE" text file as part of its
108
          distribution, then any Derivative Works that You distribute must
109
          include a readable copy of the attribution notices contained
110
          within such NOTICE file, excluding those notices that do not
111
          pertain to any part of the Derivative Works, in at least one
112
          of the following places: within a NOTICE text file distributed
113
          as part of the Derivative Works; within the Source form or
114
          documentation, if provided along with the Derivative Works; or,
115
          within a display generated by the Derivative Works, if and
116
          wherever such third-party notices normally appear. The contents
117
          of the NOTICE file are for informational purposes only and
118
          do not modify the License. You may add Your own attribution
119
          notices within Derivative Works that You distribute, alongside
120
          or as an addendum to the NOTICE text from the Work, provided
121
          that such additional attribution notices cannot be construed
122
          as modifying the License.
123
124
      You may add Your own copyright statement to Your modifications and
125
      may provide additional or different license terms and conditions
126
      for use, reproduction, or distribution of Your modifications, or
127
      for any such Derivative Works as a whole, provided Your use,
128
      reproduction, and distribution of the Work otherwise complies with
129
      the conditions stated in this License.
130
131
   5. Submission of Contributions. Unless You explicitly state otherwise,
132
      any Contribution intentionally submitted for inclusion in the Work
133
      by You to the Licensor shall be under the terms and conditions of
134
      this License, without any additional terms or conditions.
135
      Notwithstanding the above, nothing herein shall supersede or modify
136
      the terms of any separate license agreement you may have executed
137
      with Licensor regarding such Contributions.
138
139
   6. Trademarks. This License does not grant permission to use the trade
140
      names, trademarks, service marks, or product names of the Licensor,
141
      except as required for reasonable and customary use in describing the
142
      origin of the Work and reproducing the content of the NOTICE file.
143
144
   7. Disclaimer of Warranty. Unless required by applicable law or
145
      agreed to in writing, Licensor provides the Work (and each
146
      Contributor provides its Contributions) on an "AS IS" BASIS,
147
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
      implied, including, without limitation, any warranties or conditions
149
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
      PARTICULAR PURPOSE. You are solely responsible for determining the
151
      appropriateness of using or redistributing the Work and assume any
152
      risks associated with Your exercise of permissions under this License.
153
154
   8. Limitation of Liability. In no event and under no legal theory,
155
      whether in tort (including negligence), contract, or otherwise,
156
      unless required by applicable law (such as deliberate and grossly
157
      negligent acts) or agreed to in writing, shall any Contributor be
158
      liable to You for damages, including any direct, indirect, special,
159
      incidental, or consequential damages of any character arising as a
160
      result of this License or out of the use or inability to use the
161
      Work (including but not limited to damages for loss of goodwill,
162
      work stoppage, computer failure or malfunction, or any and all
163
      other commercial damages or losses), even if such Contributor
164
      has been advised of the possibility of such damages.
165
166
   9. Accepting Warranty or Additional Liability. While redistributing
167
      the Work or Derivative Works thereof, You may choose to offer,
168
      and charge a fee for, acceptance of support, warranty, indemnity,
169
      or other liability obligations and/or rights consistent with this
170
      License. However, in accepting such obligations, You may act only
171
      on Your own behalf and on Your sole responsibility, not on behalf
172
      of any other Contributor, and only if You agree to indemnify,
173
      defend, and hold each Contributor harmless for any liability
174
      incurred by, or claims asserted against, such Contributor by reason
175
      of your accepting any such warranty or additional liability.
176
177
   END OF TERMS AND CONDITIONS
178
179
   APPENDIX: How to apply the Apache License to your work.
180
181
      To apply the Apache License to your work, attach the following
182
      boilerplate notice, with the fields enclosed by brackets "[]"
183
      replaced with your own identifying information. (Don't include
184
      the brackets!)  The text should be enclosed in the appropriate
185
      comment syntax for the file format. We also recommend that a
186
      file or class name and description of purpose be included on the
187
      same "printed page" as the copyright notice for easier
188
      identification within third-party archives.
189
190
   Copyright [yyyy] [name of copyright owner]
191
192
   Licensed under the Apache License, Version 2.0 (the "License");
193
   you may not use this file except in compliance with the License.
194
   You may obtain a copy of the License at
195
196
       http://www.apache.org/licenses/LICENSE-2.0
197
198
   Unless required by applicable law or agreed to in writing, software
199
   distributed under the License is distributed on an "AS IS" BASIS,
200
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
   See the License for the specific language governing permissions and
202
   limitations under the License.
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/build.properties (+11 lines)
Added Link Here
1
source.. = src/
2
output.. = bin/
3
bin.includes = META-INF/,\
4
               .,\
5
               plugin.xml,\
6
               about.html,\
7
               plugin.properties,\
8
               asl-v20.txt
9
src.includes = about.html,\
10
               asl-v20.txt
11
jre.compilation.profile = J2SE-1.4
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/plugin.properties (+11 lines)
Added Link Here
1
############################################################################
2
# Copyright (c) 2007 Composent Inc., IBM Corp. and others.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
############################################################################
9
plugin.name=ECF HttpClient Filetransfer Provider
10
plugin.provider=Eclipse.org - ECF
11
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/plugin.xml (+32 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.2"?>
3
<plugin>
4
   <extension
5
         point="org.eclipse.ecf.provider.filetransfer.retrieveFileTransferProtocolFactory">
6
      <retrieveFileTransferProtocolFactory
7
            class="org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientRetrieveFileTransferFactory"
8
            protocol="http"
9
            priority="50">
10
      </retrieveFileTransferProtocolFactory>
11
      <retrieveFileTransferProtocolFactory
12
            class="org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientRetrieveFileTransferFactory"
13
            protocol="https"
14
            priority="50">
15
      </retrieveFileTransferProtocolFactory>
16
   </extension>
17
18
   <extension
19
         point="org.eclipse.ecf.provider.filetransfer.browseFileTransferProtocolFactory">
20
      <browseFileTransferProtocolFactory
21
            class="org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientBrowseFileTransferFactory"
22
            protocol="http"
23
            priority="50">
24
      </browseFileTransferProtocolFactory>
25
      <browseFileTransferProtocolFactory
26
            class="org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientBrowseFileTransferFactory"
27
            protocol="https"
28
            priority="50">
29
      </browseFileTransferProtocolFactory>
30
   </extension>
31
32
</plugin>
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/Activator.java (+130 lines)
Added Link Here
1
/****************************************************************************
2
 * Copyright (c) 2007 IBM, Composent Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Chris Aniszczyk - initial API and implementation
10
 *****************************************************************************/
11
package org.eclipse.ecf.internal.provider.filetransfer.httpclient;
12
13
import javax.net.ssl.SSLSocketFactory;
14
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.Status;
16
import org.eclipse.ecf.core.util.LogHelper;
17
import org.osgi.framework.BundleActivator;
18
import org.osgi.framework.BundleContext;
19
import org.osgi.service.log.LogService;
20
import org.osgi.util.tracker.ServiceTracker;
21
22
/**
23
 * The activator class controls the plug-in life cycle
24
 */
25
public class Activator implements BundleActivator {
26
27
	// The plug-in ID
28
	public static final String PLUGIN_ID = "org.eclipse.ecf.provider.filetransfer.httpclient"; //$NON-NLS-1$
29
30
	// The shared instance
31
	private static Activator plugin;
32
	private BundleContext context = null;
33
34
	private ServiceTracker logServiceTracker = null;
35
36
	private ServiceTracker sslSocketFactoryTracker;
37
38
	private ISSLSocketFactoryModifier sslSocketFactoryModifier;
39
40
	/**
41
	 * The constructor
42
	 */
43
	public Activator() {
44
		//
45
	}
46
47
	public BundleContext getContext() {
48
		return context;
49
	}
50
51
	public void start(BundleContext ctxt) throws Exception {
52
		plugin = this;
53
		this.context = ctxt;
54
		// initialize the default sslSocketFactoryModifier.  This instance is then used within HttpClientRetrieveFileTransfer.setupHostAndPort
55
		// to set the socket factory for the specific proxy and httpclient instance
56
		try {
57
			Class socketFactoryModifierClass = Class.forName("org.eclipse.ecf.internal.provider.filetransfer.httpclient.ssl.SSLSocketFactoryModifier"); //$NON-NLS-1$
58
			sslSocketFactoryModifier = (ISSLSocketFactoryModifier) socketFactoryModifierClass.newInstance();
59
		} catch (ClassNotFoundException e) {
60
			// will occur if fragment is not installed or not on proper execution environment
61
		} catch (Throwable t) {
62
			log(new Status(IStatus.ERROR, PLUGIN_ID, "Unexpected Error in Activator.start", t)); //$NON-NLS-1$
63
		}
64
65
	}
66
67
	public ISSLSocketFactoryModifier getSSLSocketFactoryModifier() {
68
		return sslSocketFactoryModifier;
69
	}
70
71
	public void stop(BundleContext ctxt) throws Exception {
72
		if (sslSocketFactoryModifier != null) {
73
			sslSocketFactoryModifier.dispose();
74
			sslSocketFactoryModifier = null;
75
		}
76
77
		if (sslSocketFactoryTracker != null) {
78
			sslSocketFactoryTracker.close();
79
		}
80
81
		if (logServiceTracker != null) {
82
			logServiceTracker.close();
83
		}
84
		this.context = null;
85
		plugin = null;
86
	}
87
88
	/**
89
	 * Returns the shared instance
90
	 *
91
	 * @return the shared instance
92
	 */
93
	public synchronized static Activator getDefault() {
94
		if (plugin == null) {
95
			plugin = new Activator();
96
		}
97
		return plugin;
98
	}
99
100
	protected LogService getLogService() {
101
		if (logServiceTracker == null) {
102
			logServiceTracker = new ServiceTracker(this.context, LogService.class.getName(), null);
103
			logServiceTracker.open();
104
		}
105
		return (LogService) logServiceTracker.getService();
106
	}
107
108
	public void log(IStatus status) {
109
		LogService logService = getLogService();
110
		if (logService != null) {
111
			logService.log(LogHelper.getLogCode(status), LogHelper.getLogMessage(status), status.getException());
112
		}
113
	}
114
115
	public SSLSocketFactory getSSLSocketFactory() {
116
		if (sslSocketFactoryTracker == null) {
117
			sslSocketFactoryTracker = new ServiceTracker(this.context, SSLSocketFactory.class.getName(), null);
118
			sslSocketFactoryTracker.open();
119
		}
120
		return (SSLSocketFactory) sslSocketFactoryTracker.getService();
121
	}
122
123
	public static void logNoProxyWarning(Throwable e) {
124
		Activator a = getDefault();
125
		if (a != null) {
126
			a.log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, IStatus.ERROR, "Warning: Platform proxy API not available", e)); //$NON-NLS-1$
127
		}
128
	}
129
130
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/CloseMonitoringSocket.java (+69 lines)
Added Link Here
1
/*******************************************************************************
2
* Copyright (c) 2009 IBM, and others. 
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
7
*
8
* Contributors:
9
*   Thomas Joiner - extracted implementation from the Socket factories
10
******************************************************************************/
11
12
package org.eclipse.ecf.internal.provider.filetransfer.httpclient;
13
14
import java.io.IOException;
15
import java.net.Socket;
16
import javax.net.ssl.SSLSocket;
17
import org.eclipse.ecf.core.util.Trace;
18
import org.eclipse.ecf.filetransfer.events.socket.ISocketEvent;
19
import org.eclipse.ecf.filetransfer.events.socket.ISocketEventSource;
20
import org.eclipse.ecf.filetransfer.events.socket.ISocketListener;
21
import org.eclipse.ecf.provider.filetransfer.events.socket.AbstractSocketWrapper;
22
import org.eclipse.ecf.provider.filetransfer.events.socket.SocketClosedEvent;
23
24
class CloseMonitoringSocket extends AbstractSocketWrapper {
25
26
	private boolean closed = false;
27
	private final ISocketListener spyListener;
28
	private final ISocketEventSource source;
29
	private Socket wrappedSocket;
30
31
	public CloseMonitoringSocket(Socket toWrap, ISocketListener spyListener, ISocketEventSource source) {
32
		super(toWrap);
33
		this.spyListener = spyListener;
34
		this.source = source;
35
	}
36
37
	public synchronized void close() throws IOException {
38
		if (!closed) {
39
			closed = true;
40
41
			try {
42
				Trace.trace(Activator.PLUGIN_ID, "closing socket " + this.toString()); //$NON-NLS-1$
43
				super.close();
44
			} finally {
45
				fireEvent(new SocketClosedEvent(source, getSocket(), (wrappedSocket != null ? wrappedSocket : this)));
46
			}
47
		}
48
	}
49
50
	private void fireEvent(ISocketEvent event) {
51
		if (spyListener != null) {
52
			spyListener.handleSocketEvent(event);
53
		}
54
		event.getSource().fireEvent(event);
55
	}
56
57
	public boolean isSecure() {
58
		return getSocket() instanceof SSLSocket;
59
	}
60
61
	Socket getWrappedSocket() {
62
		return wrappedSocket;
63
	}
64
65
	void setWrappedSocket(Socket wrappedSocket) {
66
		this.wrappedSocket = wrappedSocket;
67
	}
68
69
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ConnectingSocketMonitor.java (+46 lines)
Added Link Here
1
/*******************************************************************************
2
* Copyright (c) 2009 IBM, and others. 
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
7
*
8
* Contributors:
9
*   IBM Corporation - initial API and implementation
10
******************************************************************************/
11
12
package org.eclipse.ecf.internal.provider.filetransfer.httpclient;
13
14
import java.util.*;
15
import org.eclipse.ecf.filetransfer.events.socket.*;
16
17
public class ConnectingSocketMonitor implements ISocketListener {
18
19
	private Map connectingSockets;
20
21
	public ConnectingSocketMonitor(int initialCapacity) {
22
		connectingSockets = Collections.synchronizedMap(new HashMap(initialCapacity));
23
	}
24
25
	public ConnectingSocketMonitor() {
26
		connectingSockets = Collections.synchronizedMap(new HashMap());
27
	}
28
29
	public Collection getConnectingSockets() {
30
		return Collections.unmodifiableCollection(connectingSockets.keySet());
31
	}
32
33
	public void clear() {
34
		connectingSockets.clear();
35
	}
36
37
	public void handleSocketEvent(ISocketEvent event) {
38
		if (event instanceof ISocketCreatedEvent) {
39
			connectingSockets.put(event.getFactorySocket(), event);
40
		} else if (event instanceof ISocketConnectedEvent) {
41
			connectingSockets.remove(event.getFactorySocket());
42
		} else if (event instanceof ISocketClosedEvent) {
43
			connectingSockets.remove(event.getFactorySocket());
44
		}
45
	}
46
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/DebugOptions.java (+23 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004 Composent, Inc. and others. All rights reserved. This
3
 * program and the accompanying materials are made available under the terms of
4
 * the Eclipse Public License v1.0 which accompanies this distribution, and is
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Contributors: Composent, Inc. - initial API and implementation
8
 ******************************************************************************/
9
package org.eclipse.ecf.internal.provider.filetransfer.httpclient;
10
11
public interface DebugOptions {
12
13
	public static final String DEBUG = Activator.PLUGIN_ID + "/debug"; //$NON-NLS-1$
14
15
	public static final String EXCEPTIONS_CATCHING = DEBUG + "/exceptions/catching"; //$NON-NLS-1$
16
17
	public static final String EXCEPTIONS_THROWING = DEBUG + "/exceptions/throwing"; //$NON-NLS-1$
18
19
	public static final String METHODS_ENTERING = DEBUG + "/methods/entering"; //$NON-NLS-1$
20
21
	public static final String METHODS_EXITING = DEBUG + "/methods/exiting"; //$NON-NLS-1$
22
23
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ECFHttpClientProtocolSocketFactory.java (+132 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Thomas Joiner - HttpClient 4 implementation
11
 *******************************************************************************/
12
package org.eclipse.ecf.internal.provider.filetransfer.httpclient;
13
14
import java.io.IOException;
15
import java.net.InetSocketAddress;
16
import java.net.Socket;
17
import java.net.UnknownHostException;
18
import javax.net.SocketFactory;
19
import javax.net.ssl.SSLSocket;
20
import org.apache.http.conn.ConnectTimeoutException;
21
import org.apache.http.conn.scheme.SchemeSocketFactory;
22
import org.apache.http.params.CoreConnectionPNames;
23
import org.apache.http.params.HttpParams;
24
import org.eclipse.core.runtime.Assert;
25
import org.eclipse.ecf.core.util.Trace;
26
import org.eclipse.ecf.filetransfer.events.socket.ISocketEvent;
27
import org.eclipse.ecf.filetransfer.events.socket.ISocketEventSource;
28
import org.eclipse.ecf.filetransfer.events.socket.ISocketListener;
29
import org.eclipse.ecf.filetransfer.events.socketfactory.INonconnectedSocketFactory;
30
import org.eclipse.ecf.provider.filetransfer.events.socket.SocketClosedEvent;
31
import org.eclipse.ecf.provider.filetransfer.events.socket.SocketConnectedEvent;
32
import org.eclipse.ecf.provider.filetransfer.events.socket.SocketCreatedEvent;
33
34
public class ECFHttpClientProtocolSocketFactory implements SchemeSocketFactory {
35
36
	protected ISocketEventSource source;
37
	private INonconnectedSocketFactory unconnectedFactory;
38
	private ISocketListener socketConnectListener;
39
40
	private static final ISocketListener NULL_SOCKET_EVENT_LISTENER = new ISocketListener() {
41
		public void handleSocketEvent(ISocketEvent event) {
42
			//empty
43
		}
44
	};
45
46
	public ECFHttpClientProtocolSocketFactory(INonconnectedSocketFactory unconnectedFactory, ISocketEventSource source, ISocketListener socketConnectListener) {
47
		super();
48
		Assert.isNotNull(unconnectedFactory);
49
		Assert.isNotNull(source);
50
		this.unconnectedFactory = unconnectedFactory;
51
		this.source = source;
52
		this.socketConnectListener = socketConnectListener != null ? socketConnectListener : NULL_SOCKET_EVENT_LISTENER;
53
	}
54
55
	public ECFHttpClientProtocolSocketFactory(final SocketFactory socketFactory, ISocketEventSource source, ISocketListener socketConnectListener) {
56
		this(new INonconnectedSocketFactory() {
57
			public Socket createSocket() throws IOException {
58
				return socketFactory.createSocket();
59
			}
60
		}, source, socketConnectListener);
61
	}
62
63
	public Socket createSocket(HttpParams params) throws IOException {
64
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, ECFHttpClientProtocolSocketFactory.class, "createSocket"); //$NON-NLS-1$
65
66
		final Socket factorySocket = unconnectedFactory.createSocket();
67
		fireEvent(socketConnectListener, new SocketCreatedEvent(source, factorySocket));
68
69
		Trace.exiting(Activator.PLUGIN_ID, DebugOptions.METHODS_EXITING, ECFHttpClientProtocolSocketFactory.class, "socketCreated " + factorySocket); //$NON-NLS-1$
70
71
		return factorySocket;
72
	}
73
74
	public Socket connectSocket(final Socket sock, InetSocketAddress remoteAddress, InetSocketAddress localAddress, HttpParams params) throws IOException, UnknownHostException, ConnectTimeoutException {
75
		int timeout = params.getIntParameter(CoreConnectionPNames.SO_TIMEOUT, 0);
76
77
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, ECFHttpClientProtocolSocketFactory.class, "connectSocket " + remoteAddress.toString() + " timeout=" + timeout); //$NON-NLS-1$ //$NON-NLS-2$
78
79
		try {
80
			// Use String.valueOf to protect against null
81
			Trace.trace(Activator.PLUGIN_ID, "bind(" + String.valueOf(localAddress) + ")"); //$NON-NLS-1$//$NON-NLS-2$
82
			sock.bind(localAddress);
83
			Trace.trace(Activator.PLUGIN_ID, "connect(" + remoteAddress.toString() + ", " + timeout + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
84
			sock.connect(remoteAddress, timeout);
85
			Trace.trace(Activator.PLUGIN_ID, "connected"); //$NON-NLS-1$
86
		} catch (IOException e) {
87
			Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, ECFHttpClientProtocolSocketFactory.class, "createSocket", e); //$NON-NLS-1$
88
			fireEvent(socketConnectListener, new SocketClosedEvent(source, sock, sock));
89
			Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, ECFHttpClientProtocolSocketFactory.class, "createSocket", e); //$NON-NLS-1$
90
			throw e;
91
		}
92
93
		Socket toReturn;
94
		Socket wrapped = new CloseMonitoringSocket(sock, socketConnectListener, source);
95
96
		SocketConnectedEvent connectedEvent = new SocketConnectedEvent(source, sock, wrapped);
97
		fireEvent(socketConnectListener, connectedEvent);
98
99
		// Change the wrapped socket if one of the receivers of the SocketConnectedEvent changed it
100
		if (connectedEvent.getSocket() != wrapped) {
101
			toReturn = connectedEvent.getSocket();
102
			((CloseMonitoringSocket) wrapped).setWrappedSocket(toReturn);
103
		} else {
104
			toReturn = wrapped;
105
		}
106
107
		return toReturn;
108
	}
109
110
	private static void fireEvent(final ISocketListener spyListener, ISocketEvent event) {
111
		if (spyListener != null) {
112
			spyListener.handleSocketEvent(event);
113
		}
114
		event.getSource().fireEvent(event);
115
	}
116
117
	public boolean isSecure(Socket sock) throws IllegalArgumentException {
118
		if (sock instanceof SSLSocket) {
119
			throw new IllegalArgumentException("Socket not created by this factory."); //$NON-NLS-1$
120
		}
121
122
		return false;
123
	}
124
125
	public boolean equals(Object obj) {
126
		return (obj instanceof ECFHttpClientProtocolSocketFactory);
127
	}
128
129
	public int hashCode() {
130
		return ECFHttpClientProtocolSocketFactory.class.hashCode();
131
	}
132
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ECFHttpClientSecureProtocolSocketFactory.java (+176 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Thomas Joiner - HttpClient 4 implementation
11
 *******************************************************************************/
12
package org.eclipse.ecf.internal.provider.filetransfer.httpclient;
13
14
import java.io.IOException;
15
import java.net.InetSocketAddress;
16
import java.net.Socket;
17
import java.net.SocketException;
18
import java.net.UnknownHostException;
19
import javax.net.ssl.SSLSocket;
20
import javax.net.ssl.SSLSocketFactory;
21
import org.apache.http.conn.ConnectTimeoutException;
22
import org.apache.http.conn.scheme.LayeredSchemeSocketFactory;
23
import org.apache.http.params.HttpConnectionParams;
24
import org.apache.http.params.HttpParams;
25
import org.eclipse.ecf.core.util.Trace;
26
import org.eclipse.ecf.filetransfer.events.socket.ISocketEvent;
27
import org.eclipse.ecf.filetransfer.events.socket.ISocketEventSource;
28
import org.eclipse.ecf.filetransfer.events.socket.ISocketListener;
29
import org.eclipse.ecf.provider.filetransfer.events.socket.SocketClosedEvent;
30
import org.eclipse.ecf.provider.filetransfer.events.socket.SocketConnectedEvent;
31
import org.eclipse.ecf.provider.filetransfer.events.socket.SocketCreatedEvent;
32
33
public final class ECFHttpClientSecureProtocolSocketFactory implements LayeredSchemeSocketFactory {
34
35
	private final SSLSocketFactory sslSocketFactory;
36
	private final ISocketEventSource source;
37
	private final ISocketListener socketConnectListener;
38
39
	public ECFHttpClientSecureProtocolSocketFactory(final SSLSocketFactory sslSocketFactory, ISocketEventSource source, ISocketListener socketConnectListener) {
40
		this.sslSocketFactory = sslSocketFactory;
41
		this.source = source;
42
		this.socketConnectListener = socketConnectListener;
43
	}
44
45
	public Socket createSocket(final HttpParams params) {
46
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, ECFHttpClientSecureProtocolSocketFactory.class, "createSocket"); //$NON-NLS-1$
47
48
		Socket socket = new Socket();
49
		fireEvent(socketConnectListener, new SocketCreatedEvent(source, socket));
50
51
		Trace.exiting(Activator.PLUGIN_ID, DebugOptions.METHODS_EXITING, ECFHttpClientSecureProtocolSocketFactory.class, "socketCreated " + socket); //$NON-NLS-1$
52
		return socket;
53
	}
54
55
	public Socket connectSocket(final Socket socket, final InetSocketAddress remoteAddress, final InetSocketAddress localAddress, final HttpParams params) throws IOException, UnknownHostException, ConnectTimeoutException {
56
		if (remoteAddress == null) {
57
			throw new IllegalArgumentException("Remote address must not be null"); //$NON-NLS-1$
58
		}
59
		if (params == null) {
60
			throw new IllegalArgumentException("HTTP parameters must not be null"); //$NON-NLS-1$
61
		}
62
63
		if (socket == null) {
64
			SSLSocket sslSocket = (SSLSocket) this.sslSocketFactory.createSocket();
65
66
			performConnection(sslSocket, remoteAddress, localAddress, params);
67
68
			return wrapSocket(sslSocket);
69
		} else if (socket instanceof SSLSocket) {
70
			performConnection(socket, remoteAddress, localAddress, params);
71
72
			return wrapSocket(socket);
73
		}
74
75
		// If we were given a unconnected socket, we need to connect it first
76
		if (!socket.isConnected()) {
77
			performConnection(socket, remoteAddress, localAddress, params);
78
		}
79
80
		Socket layeredSocket = this.sslSocketFactory.createSocket(socket, remoteAddress.getHostName(), remoteAddress.getPort(), true);
81
82
		return wrapSocket(layeredSocket);
83
	}
84
85
	private void performConnection(final Socket socket, final InetSocketAddress remoteAddress, final InetSocketAddress localAddress, final HttpParams params) throws SocketException, IOException {
86
		try {
87
			socket.setReuseAddress(HttpConnectionParams.getSoReuseaddr(params));
88
			socket.bind(localAddress);
89
90
			int connectionTimeout = HttpConnectionParams.getConnectionTimeout(params);
91
			int socketTimeout = HttpConnectionParams.getSoTimeout(params);
92
93
			socket.connect(remoteAddress, connectionTimeout);
94
			socket.setSoTimeout(socketTimeout);
95
		} catch (SocketException e) {
96
			Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, ECFHttpClientSecureProtocolSocketFactory.class, "performConnection", e); //$NON-NLS-1$
97
			fireEvent(this.socketConnectListener, new SocketClosedEvent(source, socket, socket));
98
			Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, ECFHttpClientSecureProtocolSocketFactory.class, "performConnection", e); //$NON-NLS-1$
99
			throw e;
100
		} catch (IOException e) {
101
			Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, ECFHttpClientSecureProtocolSocketFactory.class, "performConnection", e); //$NON-NLS-1$
102
			fireEvent(this.socketConnectListener, new SocketClosedEvent(source, socket, socket));
103
			Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, ECFHttpClientSecureProtocolSocketFactory.class, "performConnection", e); //$NON-NLS-1$
104
			throw e;
105
		}
106
	}
107
108
	public boolean isSecure(final Socket sock) throws IllegalArgumentException {
109
		if (sock == null) {
110
			throw new IllegalArgumentException("Socket must not be null"); //$NON-NLS-1$
111
		}
112
113
		if (sock instanceof CloseMonitoringSocket) {
114
			return ((CloseMonitoringSocket) sock).isSecure();
115
		}
116
117
		if (!(sock instanceof SSLSocket)) {
118
			throw new IllegalArgumentException("Socket not created by this factory"); //$NON-NLS-1$
119
		}
120
121
		if (sock.isClosed()) {
122
			throw new IllegalArgumentException("Socket is closed"); //$NON-NLS-1$
123
		}
124
125
		return true;
126
	}
127
128
	public Socket createLayeredSocket(final Socket socket, final String host, final int port, final boolean autoClose) throws IOException {
129
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, ECFHttpClientSecureProtocolSocketFactory.class, "createLayeredSocket " + host + ":" + port + ",socket=" + socket); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
130
		SSLSocket sslSocket = null;
131
		try {
132
			Trace.trace(Activator.PLUGIN_ID, "connectingLayeredSocket(original=" + socket + ",dest=" + host + ":" + port + ")"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
133
			sslSocket = (SSLSocket) this.sslSocketFactory.createSocket(socket, host, port, autoClose);
134
			Trace.trace(Activator.PLUGIN_ID, "connected"); //$NON-NLS-1$
135
		} catch (IOException e) {
136
			Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, ECFHttpClientSecureProtocolSocketFactory.class, "createLayeredSocket", e); //$NON-NLS-1$
137
			fireEvent(this.socketConnectListener, new SocketClosedEvent(source, sslSocket, sslSocket));
138
			Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, ECFHttpClientSecureProtocolSocketFactory.class, "createSocket", e); //$NON-NLS-1$
139
			throw e;
140
		}
141
142
		return wrapSocket(sslSocket);
143
	}
144
145
	private Socket wrapSocket(Socket toWrap) {
146
		CloseMonitoringSocket wrappedSocket = new CloseMonitoringSocket(toWrap, socketConnectListener, source);
147
148
		SocketConnectedEvent connectedEvent = new SocketConnectedEvent(source, toWrap, wrappedSocket);
149
		fireEvent(socketConnectListener, connectedEvent);
150
151
		// Change the wrapped socket if one of the receivers of the SocketConnectedEvent changed it
152
		Socket connectedEventSocket = connectedEvent.getSocket();
153
		if (connectedEventSocket != wrappedSocket) {
154
			wrappedSocket.setWrappedSocket(connectedEventSocket);
155
			return connectedEventSocket;
156
		}
157
158
		return wrappedSocket;
159
	}
160
161
	static void fireEvent(final ISocketListener spyListener, ISocketEvent event) {
162
		if (spyListener != null) {
163
			spyListener.handleSocketEvent(event);
164
		}
165
		event.getSource().fireEvent(event);
166
	}
167
168
	public boolean equals(Object obj) {
169
		return ((obj != null) && obj.getClass().equals(ECFHttpClientSecureProtocolSocketFactory.class));
170
	}
171
172
	public int hashCode() {
173
		return ECFHttpClientSecureProtocolSocketFactory.class.hashCode();
174
	}
175
176
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/HttpClientProxyCredentialProvider.java (+77 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Thomas Joiner - HttpClient 4 implementation
11
 *******************************************************************************/
12
package org.eclipse.ecf.internal.provider.filetransfer.httpclient;
13
14
import java.util.HashMap;
15
import java.util.Map;
16
import org.apache.http.auth.AuthScope;
17
import org.apache.http.auth.Credentials;
18
import org.apache.http.auth.UsernamePasswordCredentials;
19
import org.apache.http.client.CredentialsProvider;
20
import org.eclipse.ecf.core.util.Proxy;
21
import org.eclipse.ecf.core.util.Trace;
22
23
public abstract class HttpClientProxyCredentialProvider implements CredentialsProvider {
24
25
	abstract protected Proxy getECFProxy();
26
27
	abstract protected Credentials getNTLMCredentials(Proxy proxy);
28
29
	private Map cachedCredentials;
30
31
	public HttpClientProxyCredentialProvider() {
32
		cachedCredentials = new HashMap();
33
	}
34
35
	public void setCredentials(AuthScope authscope, Credentials credentials) {
36
		this.cachedCredentials.put(authscope, credentials);
37
	}
38
39
	public Credentials getCredentials(AuthScope authscope) {
40
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, HttpClientProxyCredentialProvider.class, "getCredentials " + authscope); //$NON-NLS-1$
41
42
		if (this.cachedCredentials.containsKey(authscope)) {
43
			return (Credentials) this.cachedCredentials.get(authscope);
44
		}
45
46
		Proxy proxy = getECFProxy();
47
		if (proxy == null) {
48
			return null;
49
		}
50
51
		Credentials credentials = null;
52
		if ("ntlm".equalsIgnoreCase(authscope.getScheme())) { //$NON-NLS-1$
53
			credentials = getNTLMCredentials(proxy);
54
		} else if ("basic".equalsIgnoreCase(authscope.getScheme()) || //$NON-NLS-1$
55
				"digest".equalsIgnoreCase(authscope.getScheme())) { //$NON-NLS-1$
56
			final String proxyUsername = proxy.getUsername();
57
			final String proxyPassword = proxy.getPassword();
58
			if (proxyUsername != null) {
59
				credentials = new UsernamePasswordCredentials(proxyUsername, proxyPassword);
60
			}
61
		} else if ("negotiate".equalsIgnoreCase(authscope.getScheme())) { //$NON-NLS-1$
62
			Trace.trace(Activator.PLUGIN_ID, "SPNEGO is not supported, if you can contribute support, please do so."); //$NON-NLS-1$
63
		} else {
64
			Trace.trace(Activator.PLUGIN_ID, "Unrecognized authentication scheme."); //$NON-NLS-1$
65
		}
66
67
		if (credentials != null) {
68
			cachedCredentials.put(authscope, credentials);
69
		}
70
71
		return credentials;
72
	}
73
74
	public void clear() {
75
		this.cachedCredentials.clear();
76
	}
77
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ISSLSocketFactoryModifier.java (+30 lines)
Added Link Here
1
/****************************************************************************
2
 * Copyright (c) 2008, 2009 Composent, Inc., IBM and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Composent, Inc. - initial API and implementation
10
 *    Henrich Kraemer - bug 263869, testHttpsReceiveFile fails using HTTP proxy
11
 *****************************************************************************/
12
13
package org.eclipse.ecf.internal.provider.filetransfer.httpclient;
14
15
import java.io.IOException;
16
import javax.net.ssl.SSLSocketFactory;
17
import org.eclipse.ecf.filetransfer.events.socketfactory.INonconnectedSocketFactory;
18
19
/**
20
 * Internal interface to allow for use of httpclient.ssl provided socket factory
21
 */
22
public interface ISSLSocketFactoryModifier {
23
24
	public SSLSocketFactory getSSLSocketFactory() throws IOException;
25
26
	public INonconnectedSocketFactory getNonconnnectedSocketFactory();
27
28
	public void dispose();
29
30
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ISocketConnectionCallback.java (+24 lines)
Added Link Here
1
/*******************************************************************************
2
* Copyright (c) 2009 IBM, and others. 
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
7
*
8
* Contributors:
9
*   IBM Corporation - initial API and implementation
10
******************************************************************************/
11
12
package org.eclipse.ecf.internal.provider.filetransfer.httpclient;
13
14
import java.io.IOException;
15
import java.net.Socket;
16
17
public interface ISocketConnectionCallback {
18
	void onSocketCreated(Socket socket);
19
20
	void onSocketConnected(Socket socket);
21
22
	void onSocketConnectionFailed(Socket socket, IOException e);
23
24
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/Messages.java (+46 lines)
Added Link Here
1
/****************************************************************************
2
 * Copyright (c) 2007 IBM, Composent Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Composent, Inc. - initial API and implementation
10
 *****************************************************************************/
11
12
package org.eclipse.ecf.internal.provider.filetransfer.httpclient;
13
14
import org.eclipse.osgi.util.NLS;
15
16
/**
17
 * 
18
 */
19
public class Messages extends NLS {
20
	private static final String BUNDLE_NAME = "org.eclipse.ecf.internal.provider.filetransfer.httpclient.messages"; //$NON-NLS-1$
21
	public static String FileTransferNamespace_Http_Protocol;
22
	public static String FileTransferNamespace_Https_Protocol;
23
	public static String HttpClientRetrieveFileTransfer_CONNECTING_JOB_NAME;
24
	public static String HttpClientRetrieveFileTransfer_CONNECTING_TASK_NAME;
25
	public static String HttpClientRetrieveFileTransfer_Proxy_Auth_Required;
26
	public static String HttpClientRetrieveFileTransfer_Unauthorized;
27
	public static String HttpClientRetrieveFileTransfer_Username_Prefix;
28
	public static String HttpClientRetrieveFileTransfer_RESUME_START_POSITION_LESS_THAN_ZERO;
29
	public static String HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE;
30
	public static String HttpClientRetrieveFileTransfer_EXCEPITION_INVALID_LAST_MODIFIED_FROM_SERVER;
31
	public static String HttpClientRetrieveFileTransfer_EXCEPTION_FILE_MODIFIED_SINCE_LAST_ACCESS;
32
	public static String HttpClientRetrieveFileTransfer_RESUME_ERROR_END_POSITION_LESS_THAN_START;
33
	public static String HttpClientRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT;
34
	public static String HttpClientRetrieveFileTransfer_INVALID_LAST_MODIFIED_TIME;
35
	public static String HttpClientRetrieveFileTransfer_INVALID_SERVER_RESPONSE_TO_PARTIAL_RANGE_REQUEST;
36
	public static String HttpClientRetrieveFileTransfer_RESUME_START_ERROR;
37
38
	static {
39
		// initialize resource bundle
40
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
41
	}
42
43
	private Messages() {
44
		// Generated
45
	}
46
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/messages.properties (+16 lines)
Added Link Here
1
HttpClientRetrieveFileTransfer_CONNECTING_JOB_NAME=: connecting.
2
HttpClientRetrieveFileTransfer_CONNECTING_TASK_NAME=\ Connecting
3
HttpClientRetrieveFileTransfer_Username_Prefix=Username:
4
HttpClientRetrieveFileTransfer_Unauthorized=Unauthorized
5
HttpClientRetrieveFileTransfer_Proxy_Auth_Required=Proxy Authentication Required
6
FileTransferNamespace_Http_Protocol=http
7
FileTransferNamespace_Https_Protocol=https
8
HttpClientRetrieveFileTransfer_RESUME_START_POSITION_LESS_THAN_ZERO=start position cannot be less then 0
9
HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE=HttpClient connection error response code {0}.
10
HttpClientRetrieveFileTransfer_EXCEPITION_INVALID_LAST_MODIFIED_FROM_SERVER=Invalid last modified value
11
HttpClientRetrieveFileTransfer_EXCEPTION_FILE_MODIFIED_SINCE_LAST_ACCESS=file modified since last access
12
HttpClientRetrieveFileTransfer_RESUME_ERROR_END_POSITION_LESS_THAN_START=end position cannot be less than or equal to start position
13
HttpClientRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT=Could not connect to {0}
14
HttpClientRetrieveFileTransfer_INVALID_LAST_MODIFIED_TIME=Invalid last modified time from response header
15
HttpClientRetrieveFileTransfer_INVALID_SERVER_RESPONSE_TO_PARTIAL_RANGE_REQUEST=invalid server response to partial range request
16
HttpClientRetrieveFileTransfer_RESUME_START_ERROR=resume start error
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientBrowseFileTransferFactory.java (+72 lines)
Added Link Here
1
/****************************************************************************
2
 * Copyright (c) 2007 IBM, Composent Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Composent, Inc. - initial API and implementation
10
 *    Thomas Joiner - HttpClient 4 implementation
11
 *****************************************************************************/
12
package org.eclipse.ecf.provider.filetransfer.httpclient;
13
14
import java.net.MalformedURLException;
15
import java.net.URL;
16
import org.apache.http.impl.client.DefaultHttpClient;
17
import org.eclipse.core.runtime.Assert;
18
import org.eclipse.ecf.core.identity.IDFactory;
19
import org.eclipse.ecf.core.identity.Namespace;
20
import org.eclipse.ecf.core.security.IConnectContext;
21
import org.eclipse.ecf.core.util.Proxy;
22
import org.eclipse.ecf.filetransfer.IRemoteFileSystemListener;
23
import org.eclipse.ecf.filetransfer.IRemoteFileSystemRequest;
24
import org.eclipse.ecf.filetransfer.RemoteFileSystemException;
25
import org.eclipse.ecf.filetransfer.identity.IFileID;
26
import org.eclipse.ecf.filetransfer.service.IRemoteFileSystemBrowser;
27
import org.eclipse.ecf.filetransfer.service.IRemoteFileSystemBrowserFactory;
28
import org.eclipse.ecf.provider.filetransfer.identity.FileTransferNamespace;
29
import org.eclipse.osgi.util.NLS;
30
31
public class HttpClientBrowseFileTransferFactory implements IRemoteFileSystemBrowserFactory {
32
33
	public IRemoteFileSystemBrowser newInstance() {
34
		return new IRemoteFileSystemBrowser() {
35
36
			private Proxy proxy;
37
			private IConnectContext connectContext;
38
39
			public Namespace getBrowseNamespace() {
40
				return IDFactory.getDefault().getNamespaceByName(FileTransferNamespace.PROTOCOL);
41
			}
42
43
			public IRemoteFileSystemRequest sendBrowseRequest(IFileID directoryOrFileId, IRemoteFileSystemListener listener) throws RemoteFileSystemException {
44
				Assert.isNotNull(directoryOrFileId);
45
				Assert.isNotNull(listener);
46
				URL url;
47
				try {
48
					url = directoryOrFileId.getURL();
49
				} catch (final MalformedURLException e) {
50
					throw new RemoteFileSystemException(NLS.bind("Exception creating URL for {0}", directoryOrFileId)); //$NON-NLS-1$
51
				}
52
53
				HttpClientFileSystemBrowser browser = new HttpClientFileSystemBrowser(new DefaultHttpClient(), directoryOrFileId, listener, url, connectContext, proxy);
54
				return browser.sendBrowseRequest();
55
			}
56
57
			public void setConnectContextForAuthentication(IConnectContext connectContext) {
58
				this.connectContext = connectContext;
59
			}
60
61
			public void setProxy(Proxy proxy) {
62
				this.proxy = proxy;
63
			}
64
65
			public Object getAdapter(Class adapter) {
66
				return null;
67
			}
68
69
		};
70
71
	}
72
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientDefaultSSLSocketFactoryModifier.java (+78 lines)
Added Link Here
1
/****************************************************************************
2
 * Copyright (c) 2004, 2009 Composent, Inc., IBM and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *  Composent, Inc. - initial API and implementation
10
 *  Henrich Kraemer - bug 263869, testHttpsReceiveFile fails using HTTP proxy
11
 *****************************************************************************/
12
13
package org.eclipse.ecf.provider.filetransfer.httpclient;
14
15
import java.io.IOException;
16
import java.net.Socket;
17
import javax.net.ssl.SSLContext;
18
import javax.net.ssl.SSLSocketFactory;
19
import javax.net.ssl.TrustManager;
20
import org.eclipse.ecf.core.util.StringUtils;
21
import org.eclipse.ecf.filetransfer.events.socketfactory.INonconnectedSocketFactory;
22
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.ISSLSocketFactoryModifier;
23
24
public class HttpClientDefaultSSLSocketFactoryModifier implements ISSLSocketFactoryModifier, INonconnectedSocketFactory {
25
	public static final String DEFAULT_SSL_PROTOCOL = "https.protocols"; //$NON-NLS-1$
26
27
	private SSLContext sslContext = null;
28
29
	private String defaultProtocolNames = System.getProperty(DEFAULT_SSL_PROTOCOL);
30
31
	public HttpClientDefaultSSLSocketFactoryModifier() {
32
		// empty
33
	}
34
35
	public SSLSocketFactory getSSLSocketFactory() throws IOException {
36
		if (null == sslContext) {
37
			try {
38
				sslContext = getSSLContext(defaultProtocolNames);
39
			} catch (Exception e) {
40
				IOException ioe = new IOException();
41
				ioe.initCause(e);
42
				throw ioe;
43
			}
44
		}
45
		return (sslContext == null) ? (SSLSocketFactory) SSLSocketFactory.getDefault() : sslContext.getSocketFactory();
46
	}
47
48
	public SSLContext getSSLContext(String protocols) {
49
		SSLContext rtvContext = null;
50
51
		if (protocols != null) {
52
			String protocolNames[] = StringUtils.split(protocols, ","); //$NON-NLS-1$
53
			for (int i = 0; i < protocolNames.length; i++) {
54
				try {
55
					rtvContext = SSLContext.getInstance(protocolNames[i]);
56
					sslContext.init(null, new TrustManager[] {new HttpClientSslTrustManager()}, null);
57
					break;
58
				} catch (Exception e) {
59
					// just continue
60
				}
61
			}
62
		}
63
		return rtvContext;
64
	}
65
66
	public Socket createSocket() throws IOException {
67
		return getSSLSocketFactory().createSocket();
68
	}
69
70
	public void dispose() {
71
		// empty
72
	}
73
74
	public INonconnectedSocketFactory getNonconnnectedSocketFactory() {
75
		return this;
76
	}
77
78
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientFileSystemBrowser.java (+376 lines)
Added Link Here
1
/****************************************************************************
2
 * Copyright (c) 2008, 2010 Composent, Inc., IBM and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Composent, Inc. - initial API and implementation
10
 *    Henrich Kraemer - bug 263869, testHttpsReceiveFile fails using HTTP proxy
11
 *    Thomas Joiner - HttpClient 4 implementation
12
 *****************************************************************************/
13
14
package org.eclipse.ecf.provider.filetransfer.httpclient;
15
16
import java.io.IOException;
17
import java.net.HttpURLConnection;
18
import java.net.Socket;
19
import java.net.URL;
20
import java.util.ArrayList;
21
import java.util.Iterator;
22
import java.util.List;
23
import org.apache.http.Header;
24
import org.apache.http.HttpHost;
25
import org.apache.http.HttpResponse;
26
import org.apache.http.auth.AuthScope;
27
import org.apache.http.auth.Credentials;
28
import org.apache.http.auth.UsernamePasswordCredentials;
29
import org.apache.http.auth.params.AuthPNames;
30
import org.apache.http.client.HttpClient;
31
import org.apache.http.client.methods.HttpHead;
32
import org.apache.http.client.params.AuthPolicy;
33
import org.apache.http.conn.params.ConnRouteParams;
34
import org.apache.http.impl.client.DefaultHttpClient;
35
import org.apache.http.impl.cookie.DateUtils;
36
import org.apache.http.params.CoreConnectionPNames;
37
import org.apache.http.protocol.BasicHttpContext;
38
import org.apache.http.protocol.HttpContext;
39
import org.eclipse.core.runtime.Assert;
40
import org.eclipse.ecf.core.security.Callback;
41
import org.eclipse.ecf.core.security.CallbackHandler;
42
import org.eclipse.ecf.core.security.IConnectContext;
43
import org.eclipse.ecf.core.security.NameCallback;
44
import org.eclipse.ecf.core.security.ObjectCallback;
45
import org.eclipse.ecf.core.security.UnsupportedCallbackException;
46
import org.eclipse.ecf.core.util.Proxy;
47
import org.eclipse.ecf.core.util.ProxyAddress;
48
import org.eclipse.ecf.core.util.Trace;
49
import org.eclipse.ecf.filetransfer.BrowseFileTransferException;
50
import org.eclipse.ecf.filetransfer.IRemoteFile;
51
import org.eclipse.ecf.filetransfer.IRemoteFileSystemListener;
52
import org.eclipse.ecf.filetransfer.IRemoteFileSystemRequest;
53
import org.eclipse.ecf.filetransfer.identity.IFileID;
54
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.Activator;
55
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.ConnectingSocketMonitor;
56
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.DebugOptions;
57
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.HttpClientProxyCredentialProvider;
58
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.Messages;
59
import org.eclipse.ecf.provider.filetransfer.browse.AbstractFileSystemBrowser;
60
import org.eclipse.ecf.provider.filetransfer.browse.URLRemoteFile;
61
import org.eclipse.ecf.provider.filetransfer.events.socket.SocketEventSource;
62
import org.eclipse.ecf.provider.filetransfer.util.JREProxyHelper;
63
import org.eclipse.ecf.provider.filetransfer.util.ProxySetupHelper;
64
import org.eclipse.osgi.util.NLS;
65
66
/**
67
 *
68
 */
69
public class HttpClientFileSystemBrowser extends AbstractFileSystemBrowser {
70
71
	private static final String CONTENT_LENGTH_HEADER = "Content-Length"; //$NON-NLS-1$
72
73
	// changing to 2 minutes (120000) as per bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=266246
74
	// 10/26/2009:  Added being able to set with system property with name org.eclipse.ecf.provider.filetransfer.httpclient.browse.connectTimeout
75
	// for https://bugs.eclipse.org/bugs/show_bug.cgi?id=292995
76
	protected static final int DEFAULT_CONNECTION_TIMEOUT = HttpClientOptions.BROWSE_DEFAULT_CONNECTION_TIMEOUT;
77
78
	private static final String USERNAME_PREFIX = "Username:"; //$NON-NLS-1$
79
80
	private JREProxyHelper proxyHelper = null;
81
82
	private ConnectingSocketMonitor connectingSockets;
83
84
	protected String username = null;
85
86
	protected String password = null;
87
88
	protected DefaultHttpClient httpClient = null;
89
90
	protected volatile HttpHead headMethod;
91
92
	/**
93
	 * This is the response returned by {@link HttpClient} when it executes
94
	 * {@link #headMethod}.
95
	 * @since 5.0
96
	 */
97
	protected volatile HttpResponse httpResponse;
98
99
	/**
100
	 * This is the context used to retain information about the request that
101
	 * the {@link HttpClient} gathers during the request.
102
	 * @since 5.0
103
	 */
104
	protected volatile HttpContext httpContext;
105
106
	/**
107
	 * @param directoryOrFileID
108
	 * @param listener
109
	 * @since 5.0
110
	 */
111
	public HttpClientFileSystemBrowser(DefaultHttpClient httpClient, IFileID directoryOrFileID, IRemoteFileSystemListener listener, URL directoryOrFileURL, IConnectContext connectContext, Proxy proxy) {
112
		super(directoryOrFileID, listener, directoryOrFileURL, connectContext, proxy);
113
		Assert.isNotNull(httpClient);
114
		this.httpClient = httpClient;
115
		this.httpClient.setCredentialsProvider(new HttpClientProxyCredentialProvider() {
116
117
			protected Proxy getECFProxy() {
118
				return getProxy();
119
			}
120
121
			protected Credentials getNTLMCredentials(Proxy lp) {
122
				if (hasForceNTLMProxyOption())
123
					return HttpClientRetrieveFileTransfer.createNTLMCredentials(lp);
124
				return null;
125
			}
126
127
		});
128
		this.proxyHelper = new JREProxyHelper();
129
		this.connectingSockets = new ConnectingSocketMonitor(1);
130
131
		prepareAuth();
132
	}
133
134
	private void prepareAuth() {
135
		// SPNEGO is not supported, so remove it from the list
136
		List authpref = new ArrayList(3);
137
		authpref.add(AuthPolicy.NTLM);
138
		authpref.add(AuthPolicy.DIGEST);
139
		authpref.add(AuthPolicy.BASIC);
140
141
		httpClient.getParams().setParameter(AuthPNames.PROXY_AUTH_PREF, authpref);
142
		httpClient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, authpref);
143
	}
144
145
	class HttpClientRemoteFileSystemRequest extends RemoteFileSystemRequest {
146
		protected SocketEventSource socketEventSource;
147
148
		HttpClientRemoteFileSystemRequest() {
149
			this.socketEventSource = new SocketEventSource() {
150
				public Object getAdapter(Class adapter) {
151
					if (adapter == null) {
152
						return null;
153
					}
154
					if (adapter.isInstance(this)) {
155
						return this;
156
					}
157
					if (adapter.isInstance(HttpClientRemoteFileSystemRequest.this)) {
158
						return HttpClientRemoteFileSystemRequest.this;
159
					}
160
					return null;
161
				}
162
			};
163
		}
164
165
		public Object getAdapter(Class adapter) {
166
			if (adapter == null) {
167
				return null;
168
			}
169
			return socketEventSource.getAdapter(adapter);
170
		}
171
172
		public void cancel() {
173
			HttpClientFileSystemBrowser.this.cancel();
174
		}
175
	}
176
177
	protected IRemoteFileSystemRequest createRemoteFileSystemRequest() {
178
		return new HttpClientRemoteFileSystemRequest();
179
	}
180
181
	protected void cancel() {
182
		if (isCanceled()) {
183
			return; // break job cancel recursion
184
		}
185
		setCanceled(getException());
186
		super.cancel();
187
		if (headMethod != null) {
188
			if (!headMethod.isAborted()) {
189
				headMethod.abort();
190
			}
191
		}
192
		if (connectingSockets != null) {
193
			// this should unblock socket connect calls, if any
194
			for (Iterator iterator = connectingSockets.getConnectingSockets().iterator(); iterator.hasNext();) {
195
				Socket socket = (Socket) iterator.next();
196
				try {
197
					socket.close();
198
				} catch (IOException e) {
199
					Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "cancel", e); //$NON-NLS-1$
200
				}
201
			}
202
		}
203
204
	}
205
206
	protected boolean hasForceNTLMProxyOption() {
207
		return (System.getProperties().getProperty(HttpClientOptions.FORCE_NTLM_PROP) != null);
208
	}
209
210
	protected void setupProxies() {
211
		// If it's been set directly (via ECF API) then this overrides platform settings
212
		if (proxy == null) {
213
			try {
214
				// give SOCKS priority see https://bugs.eclipse.org/bugs/show_bug.cgi?id=295030#c61
215
				proxy = ProxySetupHelper.getSocksProxy(directoryOrFile);
216
				if (proxy == null) {
217
					proxy = ProxySetupHelper.getProxy(directoryOrFile.toExternalForm());
218
				}
219
			} catch (NoClassDefFoundError e) {
220
				// If the proxy API is not available a NoClassDefFoundError will be thrown here.
221
				// If that happens then we just want to continue on.
222
				Activator.logNoProxyWarning(e);
223
224
			}
225
		}
226
		if (proxy != null)
227
			setupProxy(proxy);
228
	}
229
230
	protected void cleanUp() {
231
		clearProxy();
232
233
		super.cleanUp();
234
	}
235
236
	/* (non-Javadoc)
237
	 * @see org.eclipse.ecf.provider.filetransfer.browse.AbstractFileSystemBrowser#runRequest()
238
	 */
239
	protected void runRequest() throws Exception {
240
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, this.getClass(), "runRequest"); //$NON-NLS-1$
241
		setupProxies();
242
		// set timeout
243
		httpClient.getParams().setIntParameter(CoreConnectionPNames.SO_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT);
244
		httpClient.getParams().setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT);
245
246
		String urlString = directoryOrFile.toString();
247
		// setup authentication
248
		setupAuthentication(urlString);
249
250
		headMethod = new HttpHead(urlString);
251
		// set max-age for cache control to 0 for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
252
		headMethod.addHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
253
254
		long lastModified = 0;
255
		long fileLength = -1;
256
		connectingSockets.clear();
257
		int code = -1;
258
		try {
259
			Trace.trace(Activator.PLUGIN_ID, "browse=" + urlString); //$NON-NLS-1$
260
261
			httpContext = new BasicHttpContext();
262
			httpResponse = httpClient.execute(headMethod, httpContext);
263
			code = httpResponse.getStatusLine().getStatusCode();
264
265
			Trace.trace(Activator.PLUGIN_ID, "browse resp=" + code); //$NON-NLS-1$
266
267
			// Check for NTLM proxy in response headers 
268
			// This check is to deal with bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=252002
269
			boolean ntlmProxyFound = NTLMProxyDetector.detectNTLMProxy(httpContext);
270
			if (ntlmProxyFound && !hasForceNTLMProxyOption())
271
				throw new BrowseFileTransferException("HttpClient Provider is not configured to support NTLM proxy authentication.", HttpClientOptions.NTLM_PROXY_RESPONSE_CODE); //$NON-NLS-1$
272
273
			if (NTLMProxyDetector.detectSPNEGOProxy(httpContext))
274
				throw new BrowseFileTransferException("HttpClient Provider does not support the use of SPNEGO proxy authentication."); //$NON-NLS-1$
275
276
			if (code == HttpURLConnection.HTTP_OK) {
277
				Header contentLength = httpResponse.getLastHeader(CONTENT_LENGTH_HEADER);
278
				if (contentLength != null) {
279
					fileLength = Integer.parseInt(contentLength.getValue());
280
				}
281
282
				lastModified = getLastModifiedTimeFromHeader();
283
			} else if (code == HttpURLConnection.HTTP_NOT_FOUND) {
284
				throw new BrowseFileTransferException(NLS.bind("File not found: {0}", urlString), code); //$NON-NLS-1$
285
			} else if (code == HttpURLConnection.HTTP_UNAUTHORIZED) {
286
				throw new BrowseFileTransferException(Messages.HttpClientRetrieveFileTransfer_Unauthorized, code);
287
			} else if (code == HttpURLConnection.HTTP_FORBIDDEN) {
288
				throw new BrowseFileTransferException("Forbidden", code); //$NON-NLS-1$
289
			} else if (code == HttpURLConnection.HTTP_PROXY_AUTH) {
290
				throw new BrowseFileTransferException(Messages.HttpClientRetrieveFileTransfer_Proxy_Auth_Required, code);
291
			} else {
292
				throw new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE, new Integer(code)), code);
293
			}
294
			remoteFiles = new IRemoteFile[1];
295
			remoteFiles[0] = new URLRemoteFile(lastModified, fileLength, fileID);
296
		} catch (Exception e) {
297
			Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, this.getClass(), "runRequest", e); //$NON-NLS-1$
298
			BrowseFileTransferException ex = (BrowseFileTransferException) ((e instanceof BrowseFileTransferException) ? e : new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT, urlString), e, code));
299
			throw ex;
300
		}
301
	}
302
303
	private long getLastModifiedTimeFromHeader() throws IOException {
304
		Header lastModifiedHeader = httpResponse.getLastHeader("Last-Modified"); //$NON-NLS-1$
305
		if (lastModifiedHeader == null)
306
			return 0L;
307
		String lastModifiedString = lastModifiedHeader.getValue();
308
		long lastModified = 0;
309
		if (lastModifiedString != null) {
310
			try {
311
				lastModified = DateUtils.parseDate(lastModifiedString).getTime();
312
			} catch (Exception e) {
313
				throw new IOException(Messages.HttpClientRetrieveFileTransfer_EXCEPITION_INVALID_LAST_MODIFIED_FROM_SERVER);
314
			}
315
		}
316
		return lastModified;
317
	}
318
319
	Proxy getProxy() {
320
		return proxy;
321
	}
322
323
	/**
324
	 * Retrieves the credentials for requesting the file.
325
	 * @return the {@link Credentials} necessary to retrieve the file
326
	 * @throws UnsupportedCallbackException if the callback fails
327
	 * @throws IOException if IO fails
328
	 * @since 5.0
329
	 */
330
	protected Credentials getFileRequestCredentials() throws UnsupportedCallbackException, IOException {
331
		if (connectContext == null)
332
			return null;
333
		final CallbackHandler callbackHandler = connectContext.getCallbackHandler();
334
		if (callbackHandler == null)
335
			return null;
336
		final NameCallback usernameCallback = new NameCallback(USERNAME_PREFIX);
337
		final ObjectCallback passwordCallback = new ObjectCallback();
338
		callbackHandler.handle(new Callback[] {usernameCallback, passwordCallback});
339
		username = usernameCallback.getName();
340
		password = (String) passwordCallback.getObject();
341
		return new UsernamePasswordCredentials(username, password);
342
	}
343
344
	protected void setupAuthentication(String urlString) throws UnsupportedCallbackException, IOException {
345
		Credentials credentials = null;
346
		if (username == null) {
347
			credentials = getFileRequestCredentials();
348
		}
349
350
		if (credentials != null && username != null) {
351
			final AuthScope authScope = new AuthScope(HttpClientRetrieveFileTransfer.getHostFromURL(urlString), HttpClientRetrieveFileTransfer.getPortFromURL(urlString), AuthScope.ANY_REALM);
352
			Trace.trace(Activator.PLUGIN_ID, "browse credentials=" + credentials); //$NON-NLS-1$
353
			httpClient.getCredentialsProvider().setCredentials(authScope, credentials);
354
		}
355
	}
356
357
	protected void setupProxy(Proxy proxy) {
358
		if (proxy.getType().equals(Proxy.Type.HTTP)) {
359
			final ProxyAddress address = proxy.getAddress();
360
			ConnRouteParams.setDefaultProxy(httpClient.getParams(), new HttpHost(address.getHostName(), address.getPort()));
361
		} else if (proxy.getType().equals(Proxy.Type.SOCKS)) {
362
			Trace.trace(Activator.PLUGIN_ID, "brows socksproxy=" + proxy.getAddress()); //$NON-NLS-1$
363
			proxyHelper.setupProxy(proxy);
364
		}
365
	}
366
367
	/**
368
	 * This method will clear out the proxy information (so that if this is
369
	 * reused for a request without a proxy, it will work correctly).
370
	 * @since 5.0
371
	 */
372
	protected void clearProxy() {
373
		ConnRouteParams.setDefaultProxy(httpClient.getParams(), null);
374
	}
375
376
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientOptions.java (+47 lines)
Added Link Here
1
/*******************************************************************************
2
* Copyright (c) 2009 EclipseSource and others. All rights reserved. This
3
* program and the accompanying materials are made available under the terms of
4
* the Eclipse Public License v1.0 which accompanies this distribution, and is
5
* available at http://www.eclipse.org/legal/epl-v10.html
6
*
7
* Contributors:
8
*   EclipseSource - initial API and implementation
9
******************************************************************************/
10
package org.eclipse.ecf.provider.filetransfer.httpclient;
11
12
/**
13
 * @since 4.0
14
 */
15
public interface HttpClientOptions {
16
	// HttpClient response code that indicates that NTLM proxy is asking for authentication
17
	// and httpclient cannot handle NTLMv2 proxies
18
	public int NTLM_PROXY_RESPONSE_CODE = 477;
19
	// System property that indicates that NTLM proxy usage should be forced (i.e. not rejected)
20
	// The property key is:  org.eclipse.ecf.provider.filetransfer.httpclient.options.ForceNTLMProxy
21
	// The value of the property must be non-null, but is not otherwise used.
22
	public String FORCE_NTLM_PROP = "org.eclipse.ecf.provider.filetransfer.httpclient.options.ForceNTLMProxy"; //$NON-NLS-1$
23
24
	// changing to 2 minutes (120000) as per bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=266246
25
	// 10/26/2009:  Added being able to set with system property with name org.eclipse.ecf.provider.filetransfer.httpclient.retrieve.connectTimeout
26
	// for https://bugs.eclipse.org/bugs/show_bug.cgi?id=292995
27
	/**
28
	 * @since 4.0
29
	 */
30
	public static final int RETRIEVE_DEFAULT_CONNECTION_TIMEOUT = new Integer(System.getProperty("org.eclipse.ecf.provider.filetransfer.httpclient.retrieve.connectTimeout", "120000")).intValue(); //$NON-NLS-1$ //$NON-NLS-2$
31
	// changing to 2 minutes (120000) as per bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=266246
32
	// 10/26/2009:  Added being able to set with system property with name org.eclipse.ecf.provider.filetransfer.httpclient.retrieve.readTimeout
33
	// for https://bugs.eclipse.org/bugs/show_bug.cgi?id=292995
34
	/**
35
	 * @since 4.0
36
	 */
37
	public static final int RETRIEVE_DEFAULT_READ_TIMEOUT = new Integer(System.getProperty("org.eclipse.ecf.provider.filetransfer.httpclient.retrieve.readTimeout", "120000")).intValue(); //$NON-NLS-1$ //$NON-NLS-2$
38
39
	// changing to 2 minutes (120000) as per bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=266246
40
	// 10/26/2009:  Added being able to set with system property with name org.eclipse.ecf.provider.filetransfer.httpclient.browse.connectTimeout
41
	// for https://bugs.eclipse.org/bugs/show_bug.cgi?id=292995
42
	/**
43
	 * @since 4.0
44
	 */
45
	public static final int BROWSE_DEFAULT_CONNECTION_TIMEOUT = new Integer(System.getProperty("org.eclipse.ecf.provider.filetransfer.httpclient.browse.connectTimeout", "120000")).intValue(); //$NON-NLS-1$ //$NON-NLS-2$;
46
47
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientRetrieveFileTransfer.java (+1083 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2010 Composent, Inc., IBM All rights reserved. This
3
 * program and the accompanying materials are made available under the terms of
4
 * the Eclipse Public License v1.0 which accompanies this distribution, and is
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 *
7
 * Contributors: 
8
 *  Composent, Inc. - initial API and implementation
9
 *  Maarten Meijer - bug 237936, added gzip encoded transfer default
10
 *  Henrich Kraemer - bug 263869, testHttpsReceiveFile fails using HTTP proxy
11
 *  Henrich Kraemer - bug 263613, [transport] Update site contacting / downloading is not cancelable
12
 *  Thomas Joiner - HttpClient 4 implementation
13
 ******************************************************************************/
14
package org.eclipse.ecf.provider.filetransfer.httpclient;
15
16
import java.io.IOException;
17
import java.io.InputStream;
18
import java.net.HttpURLConnection;
19
import java.net.InetAddress;
20
import java.net.Socket;
21
import java.net.UnknownHostException;
22
import java.util.ArrayList;
23
import java.util.Collections;
24
import java.util.HashMap;
25
import java.util.Iterator;
26
import java.util.List;
27
import java.util.Map;
28
import javax.net.SocketFactory;
29
import javax.net.ssl.SSLSocketFactory;
30
import org.apache.http.Header;
31
import org.apache.http.HttpHost;
32
import org.apache.http.HttpResponse;
33
import org.apache.http.ProtocolVersion;
34
import org.apache.http.auth.AuthScope;
35
import org.apache.http.auth.Credentials;
36
import org.apache.http.auth.NTCredentials;
37
import org.apache.http.auth.UsernamePasswordCredentials;
38
import org.apache.http.auth.params.AuthPNames;
39
import org.apache.http.client.methods.HttpGet;
40
import org.apache.http.client.params.AuthPolicy;
41
import org.apache.http.client.protocol.RequestAcceptEncoding;
42
import org.apache.http.client.protocol.ResponseContentEncoding;
43
import org.apache.http.conn.params.ConnRouteParams;
44
import org.apache.http.conn.scheme.Scheme;
45
import org.apache.http.conn.scheme.SchemeRegistry;
46
import org.apache.http.impl.client.DefaultHttpClient;
47
import org.apache.http.impl.cookie.DateUtils;
48
import org.apache.http.params.CoreConnectionPNames;
49
import org.apache.http.protocol.BasicHttpContext;
50
import org.apache.http.protocol.HttpContext;
51
import org.apache.http.util.EntityUtils;
52
import org.eclipse.core.runtime.Assert;
53
import org.eclipse.core.runtime.IPath;
54
import org.eclipse.core.runtime.IProgressMonitor;
55
import org.eclipse.core.runtime.IStatus;
56
import org.eclipse.core.runtime.NullProgressMonitor;
57
import org.eclipse.core.runtime.Path;
58
import org.eclipse.core.runtime.Status;
59
import org.eclipse.ecf.core.identity.ID;
60
import org.eclipse.ecf.core.security.Callback;
61
import org.eclipse.ecf.core.security.CallbackHandler;
62
import org.eclipse.ecf.core.security.IConnectContext;
63
import org.eclipse.ecf.core.security.NameCallback;
64
import org.eclipse.ecf.core.security.ObjectCallback;
65
import org.eclipse.ecf.core.security.UnsupportedCallbackException;
66
import org.eclipse.ecf.core.util.ECFRuntimeException;
67
import org.eclipse.ecf.core.util.Proxy;
68
import org.eclipse.ecf.core.util.ProxyAddress;
69
import org.eclipse.ecf.core.util.Trace;
70
import org.eclipse.ecf.filetransfer.BrowseFileTransferException;
71
import org.eclipse.ecf.filetransfer.FileTransferJob;
72
import org.eclipse.ecf.filetransfer.IFileRangeSpecification;
73
import org.eclipse.ecf.filetransfer.IFileTransferPausable;
74
import org.eclipse.ecf.filetransfer.IFileTransferRunnable;
75
import org.eclipse.ecf.filetransfer.IRetrieveFileTransferOptions;
76
import org.eclipse.ecf.filetransfer.IncomingFileTransferException;
77
import org.eclipse.ecf.filetransfer.InvalidFileRangeSpecificationException;
78
import org.eclipse.ecf.filetransfer.events.IFileTransferConnectStartEvent;
79
import org.eclipse.ecf.filetransfer.events.socket.ISocketEventSource;
80
import org.eclipse.ecf.filetransfer.events.socket.ISocketListener;
81
import org.eclipse.ecf.filetransfer.identity.IFileID;
82
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.Activator;
83
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.ConnectingSocketMonitor;
84
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.DebugOptions;
85
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientProtocolSocketFactory;
86
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientSecureProtocolSocketFactory;
87
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.HttpClientProxyCredentialProvider;
88
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.ISSLSocketFactoryModifier;
89
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.Messages;
90
import org.eclipse.ecf.provider.filetransfer.events.socket.SocketEventSource;
91
import org.eclipse.ecf.provider.filetransfer.identity.FileTransferID;
92
import org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer;
93
import org.eclipse.ecf.provider.filetransfer.retrieve.HttpHelper;
94
import org.eclipse.ecf.provider.filetransfer.util.JREProxyHelper;
95
import org.eclipse.ecf.provider.filetransfer.util.ProxySetupHelper;
96
import org.eclipse.osgi.util.NLS;
97
98
public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer {
99
100
	private static final String USERNAME_PREFIX = Messages.HttpClientRetrieveFileTransfer_Username_Prefix;
101
102
	// changing to 2 minutes (120000) as per bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=266246
103
	// 10/26/2009:  Added being able to set with system property with name org.eclipse.ecf.provider.filetransfer.httpclient.retrieve.connectTimeout
104
	// for https://bugs.eclipse.org/bugs/show_bug.cgi?id=292995
105
	protected static final int DEFAULT_CONNECTION_TIMEOUT = HttpClientOptions.RETRIEVE_DEFAULT_CONNECTION_TIMEOUT;
106
	// changing to 2 minutes (120000) as per bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=266246
107
	// 10/26/2009:  Added being able to set with system property with name org.eclipse.ecf.provider.filetransfer.httpclient.retrieve.readTimeout
108
	// for https://bugs.eclipse.org/bugs/show_bug.cgi?id=292995
109
	protected static final int DEFAULT_READ_TIMEOUT = HttpClientOptions.RETRIEVE_DEFAULT_READ_TIMEOUT;
110
111
	protected static final int HTTP_PORT = 80;
112
113
	protected static final int HTTPS_PORT = 443;
114
115
	protected static final int MAX_RETRY = 2;
116
117
	protected static final String HTTPS = Messages.FileTransferNamespace_Https_Protocol;
118
119
	protected static final String HTTP = Messages.FileTransferNamespace_Http_Protocol;
120
121
	protected static final String[] supportedProtocols = {HTTP, HTTPS};
122
123
	private static final String LAST_MODIFIED_HEADER = "Last-Modified"; //$NON-NLS-1$
124
125
	private HttpGet getMethod = null;
126
127
	private HttpResponse httpResponse = null;
128
129
	private HttpContext httpContext = null;
130
131
	private DefaultHttpClient httpClient = null;
132
133
	private String username;
134
135
	private String password;
136
137
	private int responseCode = -1;
138
	private volatile boolean doneFired = false;
139
140
	private String remoteFileName;
141
142
	protected int httpVersion = 1;
143
144
	protected IFileID fileid = null;
145
146
	protected JREProxyHelper proxyHelper = null;
147
148
	private SocketEventSource socketEventSource;
149
150
	private ConnectingSocketMonitor connectingSockets;
151
	private FileTransferJob connectJob;
152
153
	/**
154
	 * @since 5.0
155
	 */
156
	public HttpClientRetrieveFileTransfer(DefaultHttpClient httpClient) {
157
		this.httpClient = httpClient;
158
		Assert.isNotNull(this.httpClient);
159
		this.httpClient.setCredentialsProvider(new ECFCredentialsProvider());
160
		proxyHelper = new JREProxyHelper();
161
		connectingSockets = new ConnectingSocketMonitor(1);
162
		socketEventSource = new SocketEventSource() {
163
			public Object getAdapter(Class adapter) {
164
				if (adapter == null) {
165
					return null;
166
				}
167
				if (adapter.isInstance(this)) {
168
					return this;
169
				}
170
				return HttpClientRetrieveFileTransfer.this.getAdapter(adapter);
171
			}
172
173
		};
174
175
		registerSchemes(socketEventSource, connectingSockets);
176
	}
177
178
	private void registerSchemes(ISocketEventSource source, ISocketListener socketListener) {
179
		SchemeRegistry schemeRegistry = this.httpClient.getConnectionManager().getSchemeRegistry();
180
181
		Scheme http = new Scheme(HttpClientRetrieveFileTransfer.HTTP, HTTP_PORT, new ECFHttpClientProtocolSocketFactory(SocketFactory.getDefault(), source, socketListener));
182
183
		Trace.trace(Activator.PLUGIN_ID, "registering http scheme"); //$NON-NLS-1$
184
		schemeRegistry.register(http);
185
186
		ISSLSocketFactoryModifier sslSocketFactoryModifier = Activator.getDefault().getSSLSocketFactoryModifier();
187
188
		if (sslSocketFactoryModifier == null) {
189
			sslSocketFactoryModifier = new HttpClientDefaultSSLSocketFactoryModifier();
190
		}
191
192
		SSLSocketFactory sslSocketFactory = null;
193
		try {
194
			sslSocketFactory = sslSocketFactoryModifier.getSSLSocketFactory();
195
		} catch (IOException e) {
196
			Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, ISSLSocketFactoryModifier.class, "getSSLSocketFactory()", e); //$NON-NLS-1$
197
			Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, HttpClientRetrieveFileTransfer.class, "registerSchemes()", e); //$NON-NLS-1$
198
			throw new ECFRuntimeException("Unable to instantiate schemes for HttpClient.", e); //$NON-NLS-1$
199
		}
200
201
		Scheme https = new Scheme(HttpClientRetrieveFileTransfer.HTTPS, HTTPS_PORT, new ECFHttpClientSecureProtocolSocketFactory(sslSocketFactory, source, socketListener));
202
		Trace.trace(Activator.PLUGIN_ID, "registering https scheme; modifier=" + sslSocketFactoryModifier); //$NON-NLS-1$
203
		schemeRegistry.register(https);
204
205
		// SPNEGO is not supported, so remove it from the list
206
		List authpref = new ArrayList(3);
207
		authpref.add(AuthPolicy.NTLM);
208
		authpref.add(AuthPolicy.DIGEST);
209
		authpref.add(AuthPolicy.BASIC);
210
211
		httpClient.getParams().setParameter(AuthPNames.PROXY_AUTH_PREF, authpref);
212
		httpClient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, authpref);
213
	}
214
215
	/* (non-Javadoc)
216
	 * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#getRemoteFileName()
217
	 */
218
	public String getRemoteFileName() {
219
		return remoteFileName;
220
	}
221
222
	public synchronized void cancel() {
223
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, this.getClass(), "cancel"); //$NON-NLS-1$
224
		if (isCanceled()) {
225
			return; // break job cancel recursion
226
		}
227
		setDoneCanceled(exception);
228
		boolean fireDoneEvent = true;
229
		if (connectJob != null) {
230
			Trace.trace(Activator.PLUGIN_ID, "calling connectJob.cancel()"); //$NON-NLS-1$
231
			connectJob.cancel();
232
		}
233
		synchronized (jobLock) {
234
			if (job != null) {
235
				// Its the transfer jobs responsibility to throw the event.
236
				fireDoneEvent = false;
237
				Trace.trace(Activator.PLUGIN_ID, "calling transfer job.cancel()"); //$NON-NLS-1$
238
				job.cancel();
239
			}
240
		}
241
		if (getMethod != null) {
242
			if (!getMethod.isAborted()) {
243
				Trace.trace(Activator.PLUGIN_ID, "calling getMethod.abort()"); //$NON-NLS-1$
244
				getMethod.abort();
245
			}
246
		}
247
		if (connectingSockets != null) {
248
			// this should unblock socket connect calls, if any
249
			for (Iterator iterator = connectingSockets.getConnectingSockets().iterator(); iterator.hasNext();) {
250
				Socket socket = (Socket) iterator.next();
251
				try {
252
					Trace.trace(Activator.PLUGIN_ID, "Call socket.close() for socket=" + socket.toString()); //$NON-NLS-1$
253
					socket.close();
254
				} catch (IOException e) {
255
					Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "cancel", e); //$NON-NLS-1$
256
				}
257
			}
258
		}
259
		hardClose();
260
		if (fireDoneEvent) {
261
			fireTransferReceiveDoneEvent();
262
		}
263
		Trace.exiting(Activator.PLUGIN_ID, DebugOptions.METHODS_EXITING, this.getClass(), "cancel");//$NON-NLS-1$
264
265
	}
266
267
	/*
268
	 * (non-Javadoc)
269
	 *
270
	 * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#hardClose()
271
	 */
272
	protected void hardClose() {
273
		super.hardClose();
274
		if (getMethod != null) {
275
			getMethod.abort();
276
			getMethod = null;
277
		}
278
		responseCode = -1;
279
		if (proxyHelper != null) {
280
			proxyHelper.dispose();
281
			proxyHelper = null;
282
		}
283
	}
284
285
	/**
286
	 * @since 5.0
287
	 */
288
	protected Credentials getFileRequestCredentials() throws UnsupportedCallbackException, IOException {
289
		if (connectContext == null)
290
			return null;
291
		final CallbackHandler callbackHandler = connectContext.getCallbackHandler();
292
		if (callbackHandler == null)
293
			return null;
294
		final NameCallback usernameCallback = new NameCallback(USERNAME_PREFIX);
295
		final ObjectCallback passwordCallback = new ObjectCallback();
296
		callbackHandler.handle(new Callback[] {usernameCallback, passwordCallback});
297
		username = usernameCallback.getName();
298
		password = (String) passwordCallback.getObject();
299
		return new UsernamePasswordCredentials(username, password);
300
	}
301
302
	protected void setupProxies() {
303
		// If it's been set directly (via ECF API) then this overrides platform settings
304
		if (proxy == null) {
305
			try {
306
				// give SOCKS priority see https://bugs.eclipse.org/bugs/show_bug.cgi?id=295030#c61
307
				proxy = ProxySetupHelper.getSocksProxy(getRemoteFileURL());
308
				if (proxy == null) {
309
					proxy = ProxySetupHelper.getProxy(getRemoteFileURL().toExternalForm());
310
				}
311
			} catch (NoClassDefFoundError e) {
312
				// If the proxy API is not available a NoClassDefFoundError will be thrown here.
313
				// If that happens then we just want to continue on.
314
				Activator.logNoProxyWarning(e);
315
			}
316
		}
317
		if (proxy != null)
318
			setupProxy(proxy);
319
	}
320
321
	protected synchronized void resetDoneAndException() {
322
		// Doesn't match the description, but since it should be cleared before it is
323
		// reused, this is the best place.
324
		clearProxy();
325
326
		super.resetDoneAndException();
327
	}
328
329
	protected void setupAuthentication(String urlString) throws UnsupportedCallbackException, IOException {
330
		Credentials credentials = null;
331
		if (username == null) {
332
			credentials = getFileRequestCredentials();
333
		}
334
335
		if (credentials != null && username != null) {
336
			final AuthScope authScope = new AuthScope(getHostFromURL(urlString), getPortFromURL(urlString), AuthScope.ANY_REALM);
337
			Trace.trace(Activator.PLUGIN_ID, "retrieve credentials=" + credentials); //$NON-NLS-1$
338
			httpClient.getCredentialsProvider().setCredentials(authScope, credentials);
339
		}
340
	}
341
342
	protected void setRequestHeaderValues() throws InvalidFileRangeSpecificationException {
343
		final IFileRangeSpecification rangeSpec = getFileRangeSpecification();
344
		if (rangeSpec != null) {
345
			final long startPosition = rangeSpec.getStartPosition();
346
			final long endPosition = rangeSpec.getEndPosition();
347
			if (startPosition < 0)
348
				throw new InvalidFileRangeSpecificationException(Messages.HttpClientRetrieveFileTransfer_RESUME_START_POSITION_LESS_THAN_ZERO, rangeSpec);
349
			if (endPosition != -1L && endPosition <= startPosition)
350
				throw new InvalidFileRangeSpecificationException(Messages.HttpClientRetrieveFileTransfer_RESUME_ERROR_END_POSITION_LESS_THAN_START, rangeSpec);
351
			String rangeHeader = "bytes=" + startPosition + "-" + ((endPosition == -1L) ? "" : ("" + endPosition)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
352
			Trace.trace(Activator.PLUGIN_ID, "retrieve range header=" + rangeHeader); //$NON-NLS-1$
353
			setRangeHeader(rangeHeader);
354
		}
355
		// set max-age for cache control to 0 for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
356
		getMethod.addHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
357
		setRequestHeaderValuesFromOptions();
358
	}
359
360
	private void setRequestHeaderValuesFromOptions() {
361
		Map localOptions = getOptions();
362
		if (localOptions != null) {
363
			Object o = localOptions.get(IRetrieveFileTransferOptions.REQUEST_HEADERS);
364
			if (o != null && o instanceof Map) {
365
				Map requestHeaders = (Map) o;
366
				for (Iterator i = requestHeaders.keySet().iterator(); i.hasNext();) {
367
					Object n = i.next();
368
					Object v = requestHeaders.get(n);
369
					if (n != null && n instanceof String && v != null && v instanceof String)
370
						getMethod.addHeader((String) n, (String) v);
371
				}
372
			}
373
		}
374
	}
375
376
	private void setRangeHeader(String value) {
377
		getMethod.addHeader("Range", value); //$NON-NLS-1$
378
	}
379
380
	private boolean isHTTP11() {
381
		return (httpVersion >= 1);
382
	}
383
384
	public int getResponseCode() {
385
		if (responseCode != -1)
386
			return responseCode;
387
		ProtocolVersion version = getMethod.getProtocolVersion();
388
		if (version == null) {
389
			responseCode = -1;
390
			httpVersion = 1;
391
			return responseCode;
392
		}
393
		httpVersion = version.getMinor();
394
		responseCode = httpResponse.getStatusLine().getStatusCode();
395
		return responseCode;
396
	}
397
398
	/*
399
	 * (non-Javadoc)
400
	 *
401
	 * @see org.eclipse.ecf.core.identity.IIdentifiable#getID()
402
	 */
403
	public ID getID() {
404
		return fileid;
405
	}
406
407
	private long getLastModifiedTimeFromHeader() throws IOException {
408
		Header lastModifiedHeader = httpResponse.getLastHeader(LAST_MODIFIED_HEADER);
409
		if (lastModifiedHeader == null)
410
			throw new IOException(Messages.HttpClientRetrieveFileTransfer_INVALID_LAST_MODIFIED_TIME);
411
412
		String lastModifiedString = lastModifiedHeader.getValue();
413
		long lastModified = 0;
414
		if (lastModifiedString != null) {
415
			try {
416
				lastModified = DateUtils.parseDate(lastModifiedString).getTime();
417
			} catch (Exception e) {
418
				throw new IOException(Messages.HttpClientRetrieveFileTransfer_EXCEPITION_INVALID_LAST_MODIFIED_FROM_SERVER);
419
			}
420
		}
421
		return lastModified;
422
	}
423
424
	protected void getResponseHeaderValues() throws IOException {
425
		if (getResponseCode() == -1)
426
			throw new IOException(Messages.HttpClientRetrieveFileTransfer_INVALID_SERVER_RESPONSE_TO_PARTIAL_RANGE_REQUEST);
427
		Header lastModifiedHeader = httpResponse.getLastHeader(LAST_MODIFIED_HEADER);
428
		if (lastModifiedHeader != null) {
429
			setLastModifiedTime(getLastModifiedTimeFromHeader());
430
		}
431
		setFileLength(httpResponse.getEntity().getContentLength());
432
		fileid = new FileTransferID(getRetrieveNamespace(), getRemoteFileURL());
433
434
		// Get content disposition header and get remote file name from it if possible.
435
		Header contentDispositionHeader = httpResponse.getLastHeader(HttpHelper.CONTENT_DISPOSITION_HEADER);
436
		if (contentDispositionHeader != null) {
437
			remoteFileName = HttpHelper.getRemoteFileNameFromContentDispositionHeader(contentDispositionHeader.getValue());
438
		}
439
		// If still null, get the path from httpclient.getMethod()
440
		if (remoteFileName == null) {
441
			// No name could be extracted using Content-Disposition. Let's try the
442
			// path from the getMethod.
443
			String pathStr = getMethod.getRequestLine().getUri();
444
			if (pathStr != null && pathStr.length() > 0) {
445
				IPath path = Path.fromPortableString(pathStr);
446
				if (path.segmentCount() > 0)
447
					remoteFileName = path.lastSegment();
448
			}
449
			// If still null, use the input file name
450
			if (remoteFileName == null)
451
				// Last resort. Use the path of the initial URL request
452
				remoteFileName = super.getRemoteFileName();
453
		}
454
	}
455
456
	final class ECFCredentialsProvider extends HttpClientProxyCredentialProvider {
457
458
		protected Proxy getECFProxy() {
459
			return getProxy();
460
		}
461
462
		protected Credentials getNTLMCredentials(Proxy lp) {
463
			if (hasForceNTLMProxyOption())
464
				return HttpClientRetrieveFileTransfer.createNTLMCredentials(lp);
465
			return null;
466
		}
467
468
	}
469
470
	Proxy getProxy() {
471
		return proxy;
472
	}
473
474
	protected void setInputStream(InputStream ins) {
475
		remoteFileContents = ins;
476
	}
477
478
	protected InputStream wrapTransferReadInputStream(InputStream inputStream, IProgressMonitor monitor) {
479
		return inputStream;
480
	}
481
482
	protected boolean hasForceNTLMProxyOption() {
483
		Map localOptions = getOptions();
484
		if (localOptions != null && localOptions.get(HttpClientOptions.FORCE_NTLM_PROP) != null)
485
			return true;
486
		return (System.getProperties().getProperty(HttpClientOptions.FORCE_NTLM_PROP) != null);
487
	}
488
489
	protected int getSocketReadTimeout() {
490
		int result = DEFAULT_READ_TIMEOUT;
491
		Map localOptions = getOptions();
492
		if (localOptions != null) {
493
			// See if the connect timeout option is present, if so set
494
			Object o = localOptions.get(IRetrieveFileTransferOptions.READ_TIMEOUT);
495
			if (o != null) {
496
				if (o instanceof Integer) {
497
					result = ((Integer) o).intValue();
498
				} else if (o instanceof String) {
499
					result = new Integer(((String) o)).intValue();
500
				}
501
				return result;
502
			}
503
			o = localOptions.get("org.eclipse.ecf.provider.filetransfer.httpclient.retrieve.readTimeout"); //$NON-NLS-1$
504
			if (o != null) {
505
				if (o instanceof Integer) {
506
					result = ((Integer) o).intValue();
507
				} else if (o instanceof String) {
508
					result = new Integer(((String) o)).intValue();
509
				}
510
			}
511
		}
512
		return result;
513
	}
514
515
	/**
516
	 * @since 4.0
517
	 */
518
	protected int getConnectTimeout() {
519
		int result = DEFAULT_CONNECTION_TIMEOUT;
520
		Map localOptions = getOptions();
521
		if (localOptions != null) {
522
			// See if the connect timeout option is present, if so set
523
			Object o = localOptions.get(IRetrieveFileTransferOptions.CONNECT_TIMEOUT);
524
			if (o != null) {
525
				if (o instanceof Integer) {
526
					result = ((Integer) o).intValue();
527
				} else if (o instanceof String) {
528
					result = new Integer(((String) o)).intValue();
529
				}
530
				return result;
531
			}
532
			o = localOptions.get("org.eclipse.ecf.provider.filetransfer.httpclient.retrieve.connectTimeout"); //$NON-NLS-1$
533
			if (o != null) {
534
				if (o instanceof Integer) {
535
					result = ((Integer) o).intValue();
536
				} else if (o instanceof String) {
537
					result = new Integer(((String) o)).intValue();
538
				}
539
			}
540
		}
541
		return result;
542
	}
543
544
	/* (non-Javadoc)
545
	 * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#openStreams()
546
	 */
547
	protected void openStreams() throws IncomingFileTransferException {
548
549
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, this.getClass(), "openStreams"); //$NON-NLS-1$
550
		final String urlString = getRemoteFileURL().toString();
551
		this.doneFired = false;
552
553
		int code = -1;
554
555
		try {
556
			httpClient.getParams().setIntParameter(CoreConnectionPNames.SO_TIMEOUT, getSocketReadTimeout());
557
			int connectTimeout = getConnectTimeout();
558
			httpClient.getParams().setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, connectTimeout);
559
560
			setupAuthentication(urlString);
561
562
			getMethod = new HttpGet(urlString);
563
			// Define a CredentialsProvider - found that possibility while debugging in org.apache.commons.httpclient.HttpMethodDirector.processProxyAuthChallenge(HttpMethod)
564
			// Seems to be another way to select the credentials.
565
			setRequestHeaderValues();
566
567
			Trace.trace(Activator.PLUGIN_ID, "retrieve=" + urlString); //$NON-NLS-1$
568
			// Set request header for possible gzip encoding, but only if
569
			// 1) The file range specification is null (we want the whole file)
570
			// 2) The target remote file does *not* end in .gz (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=280205)
571
			if (getFileRangeSpecification() == null && !targetHasGzSuffix(super.getRemoteFileName())) {
572
				Trace.trace(Activator.PLUGIN_ID, "Accept-Encoding: gzip,deflate added to request header"); //$NON-NLS-1$
573
574
				// Add the interceptors to provide the gzip 
575
				httpClient.addRequestInterceptor(new RequestAcceptEncoding());
576
				httpClient.addResponseInterceptor(new ResponseContentEncoding());
577
			} else {
578
				Trace.trace(Activator.PLUGIN_ID, "Accept-Encoding NOT added to header"); //$NON-NLS-1$
579
			}
580
581
			fireConnectStartEvent();
582
			if (checkAndHandleDone()) {
583
				return;
584
			}
585
586
			connectingSockets.clear();
587
			// Actually execute get and get response code (since redirect is set to true, then
588
			// redirect response code handled internally
589
			if (connectJob == null) {
590
				performConnect(new NullProgressMonitor());
591
			} else {
592
				connectJob.schedule();
593
				connectJob.join();
594
				connectJob = null;
595
			}
596
			if (checkAndHandleDone()) {
597
				return;
598
			}
599
600
			code = responseCode;
601
602
			responseHeaders = getResponseHeaders();
603
604
			Trace.trace(Activator.PLUGIN_ID, "retrieve resp=" + code); //$NON-NLS-1$
605
606
			// Check for NTLM proxy in response headers 
607
			// This check is to deal with bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=252002
608
			boolean ntlmProxyFound = NTLMProxyDetector.detectNTLMProxy(httpContext);
609
			if (ntlmProxyFound && !hasForceNTLMProxyOption())
610
				throw new IncomingFileTransferException("HttpClient Provider is not configured to support NTLM proxy authentication.", HttpClientOptions.NTLM_PROXY_RESPONSE_CODE); //$NON-NLS-1$
611
612
			if (NTLMProxyDetector.detectSPNEGOProxy(httpContext))
613
				throw new BrowseFileTransferException("HttpClient Provider does not support the use of SPNEGO proxy authentication."); //$NON-NLS-1$
614
615
			if (code == HttpURLConnection.HTTP_PARTIAL || code == HttpURLConnection.HTTP_OK) {
616
				getResponseHeaderValues();
617
				setInputStream(httpResponse.getEntity().getContent());
618
				fireReceiveStartEvent();
619
			} else if (code == HttpURLConnection.HTTP_NOT_FOUND) {
620
				EntityUtils.consume(httpResponse.getEntity());
621
				throw new IncomingFileTransferException(NLS.bind("File not found: {0}", urlString), code); //$NON-NLS-1$
622
			} else if (code == HttpURLConnection.HTTP_UNAUTHORIZED) {
623
				EntityUtils.consume(httpResponse.getEntity());
624
				throw new IncomingFileTransferException(Messages.HttpClientRetrieveFileTransfer_Unauthorized, code);
625
			} else if (code == HttpURLConnection.HTTP_FORBIDDEN) {
626
				EntityUtils.consume(httpResponse.getEntity());
627
				throw new IncomingFileTransferException("Forbidden", code); //$NON-NLS-1$
628
			} else if (code == HttpURLConnection.HTTP_PROXY_AUTH) {
629
				EntityUtils.consume(httpResponse.getEntity());
630
				throw new IncomingFileTransferException(Messages.HttpClientRetrieveFileTransfer_Proxy_Auth_Required, code);
631
			} else {
632
				Trace.trace(Activator.PLUGIN_ID, EntityUtils.toString(httpResponse.getEntity()));
633
				//				EntityUtils.consume(httpResponse.getEntity());
634
				throw new IncomingFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE, new Integer(code)), code);
635
			}
636
		} catch (final Exception e) {
637
			Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, this.getClass(), "openStreams", e); //$NON-NLS-1$
638
			if (code == -1) {
639
				if (!isDone()) {
640
					setDoneException(e);
641
				}
642
				fireTransferReceiveDoneEvent();
643
			} else {
644
				IncomingFileTransferException ex = (IncomingFileTransferException) ((e instanceof IncomingFileTransferException) ? e : new IncomingFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT, urlString), e, code));
645
				throw ex;
646
			}
647
		}
648
		Trace.exiting(Activator.PLUGIN_ID, DebugOptions.METHODS_EXITING, this.getClass(), "openStreams"); //$NON-NLS-1$
649
	}
650
651
	private Map getResponseHeaders() {
652
		if (getMethod == null)
653
			return null;
654
		Header[] headers = httpResponse.getAllHeaders();
655
		Map result = null;
656
		if (headers != null && headers.length > 0) {
657
			result = new HashMap();
658
			for (int i = 0; i < headers.length; i++) {
659
				String name = headers[i].getName();
660
				String val = headers[i].getValue();
661
				if (name != null && val != null)
662
					result.put(name, val);
663
			}
664
		}
665
		return Collections.unmodifiableMap(result);
666
	}
667
668
	private boolean checkAndHandleDone() {
669
		if (isDone()) {
670
			// for cancel the done event should have been fired always.
671
			if (!doneFired) {
672
				fireTransferReceiveDoneEvent();
673
			}
674
			return true;
675
		}
676
		return false;
677
	}
678
679
	/*
680
	 * (non-Javadoc)
681
	 *
682
	 * @see org.eclipse.ecf.filetransfer.IRetrieveFileTransferContainerAdapter#setConnectContextForAuthentication(org.eclipse.ecf.core.security.IConnectContext)
683
	 */
684
	public void setConnectContextForAuthentication(IConnectContext connectContext) {
685
		super.setConnectContextForAuthentication(connectContext);
686
		this.username = null;
687
		this.password = null;
688
	}
689
690
	protected static String getHostFromURL(String url) {
691
		String result = url;
692
		final int colonSlashSlash = url.indexOf("://"); //$NON-NLS-1$
693
		if (colonSlashSlash < 0)
694
			return ""; //$NON-NLS-1$
695
		if (colonSlashSlash >= 0) {
696
			result = url.substring(colonSlashSlash + 3);
697
		}
698
699
		final int colonPort = result.indexOf(':');
700
		final int requestPath = result.indexOf('/');
701
702
		int substringEnd;
703
704
		if (colonPort > 0 && requestPath > 0)
705
			substringEnd = Math.min(colonPort, requestPath);
706
		else if (colonPort > 0)
707
			substringEnd = colonPort;
708
		else if (requestPath > 0)
709
			substringEnd = requestPath;
710
		else
711
			substringEnd = result.length();
712
713
		return result.substring(0, substringEnd);
714
715
	}
716
717
	protected static int getPortFromURL(String url) {
718
		final int colonSlashSlash = url.indexOf("://"); //$NON-NLS-1$
719
		if (colonSlashSlash < 0)
720
			return urlUsesHttps(url) ? HTTPS_PORT : HTTP_PORT;
721
		// This is wrong as if the url has no colonPort before '?' then it should return the default
722
723
		final int colonPort = url.indexOf(':', colonSlashSlash + 1);
724
		if (colonPort < 0)
725
			return urlUsesHttps(url) ? HTTPS_PORT : HTTP_PORT;
726
		// Make sure that the colonPort is not from some part of the rest of the URL
727
		int nextSlash = url.indexOf('/', colonSlashSlash + 3);
728
		if (nextSlash != -1 && colonPort > nextSlash)
729
			return urlUsesHttps(url) ? HTTPS_PORT : HTTP_PORT;
730
731
		final int requestPath = url.indexOf('/', colonPort + 1);
732
733
		int end;
734
		if (requestPath < 0)
735
			end = url.length();
736
		else
737
			end = requestPath;
738
739
		return Integer.parseInt(url.substring(colonPort + 1, end));
740
	}
741
742
	protected static boolean urlUsesHttps(String url) {
743
		url = url.trim();
744
		return url.startsWith(HTTPS);
745
	}
746
747
	/*
748
	 * (non-Javadoc)
749
	 *
750
	 * @see org.eclipse.ecf.internal.provider.filetransfer.AbstractRetrieveFileTransfer#supportsProtocol(java.lang.String)
751
	 */
752
	public static boolean supportsProtocol(String protocolString) {
753
		for (int i = 0; i < supportedProtocols.length; i++)
754
			if (supportedProtocols[i].equalsIgnoreCase(protocolString))
755
				return true;
756
		return false;
757
	}
758
759
	protected boolean isConnected() {
760
		return (getMethod != null);
761
	}
762
763
	/*
764
	 * (non-Javadoc)
765
	 *
766
	 * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#doPause()
767
	 */
768
	protected boolean doPause() {
769
		if (isPaused() || !isConnected() || isDone())
770
			return false;
771
		this.paused = true;
772
		return this.paused;
773
	}
774
775
	/*
776
	 * (non-Javadoc)
777
	 *
778
	 * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#doResume()
779
	 */
780
	protected boolean doResume() {
781
		if (!isPaused() || isConnected())
782
			return false;
783
		return openStreamsForResume();
784
	}
785
786
	protected void setResumeRequestHeaderValues() throws IOException {
787
		if (this.bytesReceived <= 0 || this.fileLength <= this.bytesReceived)
788
			throw new IOException(Messages.HttpClientRetrieveFileTransfer_RESUME_START_ERROR);
789
		setRangeHeader("bytes=" + this.bytesReceived + "-"); //$NON-NLS-1$ //$NON-NLS-2$
790
		// set max-age for cache control to 0 for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
791
		getMethod.addHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
792
		setRequestHeaderValuesFromOptions();
793
	}
794
795
	private boolean openStreamsForResume() {
796
797
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, this.getClass(), "openStreamsForResume"); //$NON-NLS-1$
798
		final String urlString = getRemoteFileURL().toString();
799
		this.doneFired = false;
800
801
		int code = -1;
802
803
		try {
804
			httpClient.getParams().setIntParameter(CoreConnectionPNames.SO_TIMEOUT, getSocketReadTimeout());
805
			int connectTimeout = getConnectTimeout();
806
			httpClient.getParams().setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, connectTimeout);
807
808
			setupAuthentication(urlString);
809
810
			getMethod = new HttpGet(urlString);
811
			// Define a CredentialsProvider - found that possibility while debugging in org.apache.commons.httpclient.HttpMethodDirector.processProxyAuthChallenge(HttpMethod)
812
			// Seems to be another way to select the credentials.
813
			setResumeRequestHeaderValues();
814
815
			Trace.trace(Activator.PLUGIN_ID, "resume=" + urlString); //$NON-NLS-1$
816
817
			// Gzip encoding is not an option for resume
818
			fireConnectStartEvent();
819
			if (checkAndHandleDone()) {
820
				return false;
821
			}
822
823
			connectingSockets.clear();
824
			// Actually execute get and get response code (since redirect is set to true, then
825
			// redirect response code handled internally
826
			if (connectJob == null) {
827
				performConnect(new NullProgressMonitor());
828
			} else {
829
				connectJob.schedule();
830
				connectJob.join();
831
				connectJob = null;
832
			}
833
			if (checkAndHandleDone()) {
834
				return false;
835
			}
836
837
			code = responseCode;
838
839
			responseHeaders = getResponseHeaders();
840
841
			Trace.trace(Activator.PLUGIN_ID, "retrieve resp=" + code); //$NON-NLS-1$
842
843
			if (code == HttpURLConnection.HTTP_PARTIAL || code == HttpURLConnection.HTTP_OK) {
844
				getResumeResponseHeaderValues();
845
				setInputStream(httpResponse.getEntity().getContent());
846
				this.paused = false;
847
				fireReceiveResumedEvent();
848
			} else if (code == HttpURLConnection.HTTP_NOT_FOUND) {
849
				EntityUtils.consume(httpResponse.getEntity());
850
				throw new IncomingFileTransferException(NLS.bind("File not found: {0}", urlString), code, responseHeaders); //$NON-NLS-1$
851
			} else if (code == HttpURLConnection.HTTP_UNAUTHORIZED) {
852
				EntityUtils.consume(httpResponse.getEntity());
853
				throw new IncomingFileTransferException(Messages.HttpClientRetrieveFileTransfer_Unauthorized, code, responseHeaders);
854
			} else if (code == HttpURLConnection.HTTP_FORBIDDEN) {
855
				EntityUtils.consume(httpResponse.getEntity());
856
				throw new IncomingFileTransferException("Forbidden", code, responseHeaders); //$NON-NLS-1$
857
			} else if (code == HttpURLConnection.HTTP_PROXY_AUTH) {
858
				EntityUtils.consume(httpResponse.getEntity());
859
				throw new IncomingFileTransferException(Messages.HttpClientRetrieveFileTransfer_Proxy_Auth_Required, code, responseHeaders);
860
			} else {
861
				EntityUtils.consume(httpResponse.getEntity());
862
				throw new IncomingFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE, new Integer(code)), code, responseHeaders);
863
			}
864
			Trace.exiting(Activator.PLUGIN_ID, DebugOptions.METHODS_EXITING, this.getClass(), "openStreamsForResume", Boolean.TRUE); //$NON-NLS-1$
865
			return true;
866
		} catch (final Exception e) {
867
			Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "openStreamsForResume", e); //$NON-NLS-1$
868
			if (code == -1) {
869
				if (!isDone()) {
870
					setDoneException(e);
871
				}
872
			} else {
873
				setDoneException((e instanceof IncomingFileTransferException) ? e : new IncomingFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT, urlString), e, code, responseHeaders));
874
			}
875
			fireTransferReceiveDoneEvent();
876
			Trace.exiting(Activator.PLUGIN_ID, DebugOptions.METHODS_EXITING, this.getClass(), "openStreamsForResume", Boolean.FALSE); //$NON-NLS-1$
877
			return false;
878
		}
879
	}
880
881
	protected void getResumeResponseHeaderValues() throws IOException {
882
		if (getResponseCode() != HttpURLConnection.HTTP_PARTIAL)
883
			throw new IOException();
884
		if (lastModifiedTime != getLastModifiedTimeFromHeader())
885
			throw new IOException(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_FILE_MODIFIED_SINCE_LAST_ACCESS);
886
	}
887
888
	/*
889
	 * (non-Javadoc)
890
	 *
891
	 * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#getAdapter(java.lang.Class)
892
	 */
893
	public Object getAdapter(Class adapter) {
894
		if (adapter == null)
895
			return null;
896
		if (adapter.equals(IFileTransferPausable.class) && isHTTP11())
897
			return this;
898
		if (adapter.equals(ISocketEventSource.class))
899
			return this.socketEventSource;
900
		return super.getAdapter(adapter);
901
	}
902
903
	/* (non-Javadoc)
904
	 * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#setupProxy(org.eclipse.ecf.core.util.Proxy)
905
	 */
906
	protected void setupProxy(Proxy proxy) {
907
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, HttpClientRetrieveFileTransfer.class, "setupProxy " + proxy); //$NON-NLS-1$
908
		if (proxy.getType().equals(Proxy.Type.HTTP)) {
909
			final ProxyAddress address = proxy.getAddress();
910
			ConnRouteParams.setDefaultProxy(httpClient.getParams(), new HttpHost(address.getHostName(), address.getPort()));
911
			//			getHostConfiguration().setProxy(address.getHostName(), address.getPort());
912
		} else if (proxy.getType().equals(Proxy.Type.SOCKS)) {
913
			Trace.trace(Activator.PLUGIN_ID, "retrieve socksproxy=" + proxy.getAddress()); //$NON-NLS-1$
914
			proxyHelper.setupProxy(proxy);
915
		}
916
	}
917
918
	/**
919
	 * This method will clear out the proxy information (so that if this is
920
	 * reused for a request without a proxy, it will work correctly).
921
	 * @since 5.0
922
	 */
923
	protected void clearProxy() {
924
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, HttpClientRetrieveFileTransfer.class, "clearProxy()"); //$NON-NLS-1$
925
		ConnRouteParams.setDefaultProxy(httpClient.getParams(), null);
926
	}
927
928
	/**
929
	 * @since 5.0
930
	 */
931
	public static NTCredentials createNTLMCredentials(Proxy p) {
932
		if (p == null) {
933
			return null;
934
		}
935
		String un = getNTLMUserName(p);
936
		String domain = getNTLMDomainName(p);
937
		if (un == null || domain == null)
938
			return null;
939
940
		String workstation = null;
941
		try {
942
			workstation = InetAddress.getLocalHost().getHostName();
943
		} catch (UnknownHostException e) {
944
			Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, HttpClientRetrieveFileTransfer.class, "createNTLMCredentials", e); //$NON-NLS-1$
945
		}
946
947
		return new NTCredentials(un, p.getPassword(), workstation, domain);
948
	}
949
950
	protected static String getNTLMDomainName(Proxy p) {
951
		String domainUsername = p.getUsername();
952
		if (domainUsername == null)
953
			return null;
954
		int slashloc = domainUsername.indexOf('\\');
955
		if (slashloc == -1)
956
			return null;
957
		return domainUsername.substring(0, slashloc);
958
	}
959
960
	protected static String getNTLMUserName(Proxy p) {
961
		String domainUsername = p.getUsername();
962
		if (domainUsername == null)
963
			return null;
964
		int slashloc = domainUsername.indexOf('\\');
965
		if (slashloc == -1)
966
			return null;
967
		return domainUsername.substring(slashloc + 1);
968
	}
969
970
	protected void fireConnectStartEvent() {
971
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, this.getClass(), "fireConnectStartEvent"); //$NON-NLS-1$ 
972
		// TODO: should the following be in super.fireReceiveStartEvent();
973
		listener.handleTransferEvent(new IFileTransferConnectStartEvent() {
974
			public IFileID getFileID() {
975
				return remoteFileID;
976
			}
977
978
			public void cancel() {
979
				HttpClientRetrieveFileTransfer.this.cancel();
980
			}
981
982
			public FileTransferJob prepareConnectJob(FileTransferJob j) {
983
				return HttpClientRetrieveFileTransfer.this.prepareConnectJob(j);
984
			}
985
986
			public void connectUsingJob(FileTransferJob j) {
987
				HttpClientRetrieveFileTransfer.this.connectUsingJob(j);
988
			}
989
990
			public String toString() {
991
				final StringBuffer sb = new StringBuffer("IFileTransferConnectStartEvent["); //$NON-NLS-1$
992
				sb.append(getFileID());
993
				sb.append("]"); //$NON-NLS-1$
994
				return sb.toString();
995
			}
996
997
			public Object getAdapter(Class adapter) {
998
				return HttpClientRetrieveFileTransfer.this.getAdapter(adapter);
999
			}
1000
		});
1001
	}
1002
1003
	protected String createConnectJobName() {
1004
		return getRemoteFileURL().toString() + createRangeName() + Messages.HttpClientRetrieveFileTransfer_CONNECTING_JOB_NAME;
1005
	}
1006
1007
	protected FileTransferJob prepareConnectJob(FileTransferJob cjob) {
1008
		if (cjob == null) {
1009
			// Create our own
1010
			cjob = new FileTransferJob(createJobName());
1011
		}
1012
		cjob.setFileTransfer(this);
1013
		cjob.setFileTransferRunnable(fileConnectRunnable);
1014
		return cjob;
1015
	}
1016
1017
	protected void connectUsingJob(FileTransferJob cjob) {
1018
		Assert.isNotNull(cjob);
1019
		this.connectJob = cjob;
1020
	}
1021
1022
	private IFileTransferRunnable fileConnectRunnable = new IFileTransferRunnable() {
1023
		public IStatus performFileTransfer(IProgressMonitor monitor) {
1024
			return performConnect(monitor);
1025
		}
1026
	};
1027
1028
	private IStatus performConnect(IProgressMonitor monitor) {
1029
		// there might be more ticks in the future perhaps for 
1030
		// connect socket, certificate validation, send request, authenticate,
1031
		int ticks = 1;
1032
		monitor.beginTask(getRemoteFileURL().toString() + Messages.HttpClientRetrieveFileTransfer_CONNECTING_TASK_NAME, ticks);
1033
		try {
1034
			if (monitor.isCanceled())
1035
				throw newUserCancelledException();
1036
			httpContext = new BasicHttpContext();
1037
			httpResponse = httpClient.execute(getMethod, httpContext);
1038
			responseCode = httpResponse.getStatusLine().getStatusCode();
1039
			Trace.trace(Activator.PLUGIN_ID, "retrieve resp=" + responseCode); //$NON-NLS-1$
1040
		} catch (final Exception e) {
1041
			Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "performConnect", e); //$NON-NLS-1$
1042
			if (!isDone()) {
1043
				setDoneException(e);
1044
			}
1045
		} finally {
1046
			monitor.done();
1047
		}
1048
		return Status.OK_STATUS;
1049
1050
	}
1051
1052
	protected void finalize() throws Throwable {
1053
		try {
1054
			if (this.httpClient != null) {
1055
				this.httpClient.getConnectionManager().shutdown();
1056
			}
1057
		} finally {
1058
			super.finalize();
1059
		}
1060
	}
1061
1062
	protected void fireReceiveResumedEvent() {
1063
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, this.getClass(), "fireReceiveResumedEvent len=" + fileLength + ";rcvd=" + bytesReceived); //$NON-NLS-1$ //$NON-NLS-2$
1064
		super.fireReceiveResumedEvent();
1065
	}
1066
1067
	protected void fireTransferReceiveDataEvent() {
1068
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, this.getClass(), "fireTransferReceiveDataEvent len=" + fileLength + ";rcvd=" + bytesReceived); //$NON-NLS-1$ //$NON-NLS-2$
1069
		super.fireTransferReceiveDataEvent();
1070
	}
1071
1072
	protected void fireTransferReceiveDoneEvent() {
1073
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, this.getClass(), "fireTransferReceiveDoneEvent len=" + fileLength + ";rcvd=" + bytesReceived); //$NON-NLS-1$ //$NON-NLS-2$
1074
		this.doneFired = true;
1075
		super.fireTransferReceiveDoneEvent();
1076
	}
1077
1078
	protected void fireTransferReceivePausedEvent() {
1079
		Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, this.getClass(), "fireTransferReceivePausedEvent len=" + fileLength + ";rcvd=" + bytesReceived); //$NON-NLS-1$ //$NON-NLS-2$
1080
		super.fireTransferReceivePausedEvent();
1081
	}
1082
1083
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientRetrieveFileTransferFactory.java (+24 lines)
Added Link Here
1
/****************************************************************************
2
 * Copyright (c) 2007 IBM, Composent Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Composent, Inc. - initial API and implementation
10
 *    Thomas Joiner - HttpClient 4 implementation
11
 *****************************************************************************/
12
package org.eclipse.ecf.provider.filetransfer.httpclient;
13
14
import org.apache.http.impl.client.DefaultHttpClient;
15
import org.apache.http.impl.conn.SingleClientConnManager;
16
import org.eclipse.ecf.filetransfer.service.IRetrieveFileTransfer;
17
import org.eclipse.ecf.filetransfer.service.IRetrieveFileTransferFactory;
18
19
public class HttpClientRetrieveFileTransferFactory implements IRetrieveFileTransferFactory {
20
21
	public IRetrieveFileTransfer newInstance() {
22
		return new HttpClientRetrieveFileTransfer(new DefaultHttpClient(new SingleClientConnManager()));
23
	}
24
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientSslTrustManager.java (+57 lines)
Added Link Here
1
/****************************************************************************
2
 * Copyright (c) 2004 Composent, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Composent, Inc. - initial API and implementation
10
 *****************************************************************************/
11
12
package org.eclipse.ecf.provider.filetransfer.httpclient;
13
14
import javax.net.ssl.X509TrustManager;
15
16
public class HttpClientSslTrustManager implements X509TrustManager {
17
	// seems to be no purpose
18
	public boolean checkClientTrusted(java.security.cert.X509Certificate[] chain) {
19
		return true;
20
	}
21
22
	// seems to be no purpose
23
	public boolean isServerTrusted(java.security.cert.X509Certificate[] chain) {
24
		return true;
25
	}
26
27
	// seems to be no purpose
28
	public boolean isClientTrusted(java.security.cert.X509Certificate[] chain) {
29
		return true;
30
	}
31
32
	/**
33
	 * @see javax.net.ssl.X509TrustManager#getAcceptedIssuers()
34
	 */
35
	public java.security.cert.X509Certificate[] getAcceptedIssuers() {
36
		return null;
37
	}
38
39
	/**
40
	 * @see javax.net.ssl.X509TrustManager#checkClientTrusted(java.security.cert.X509Certificate[],
41
	 *      java.lang.String)
42
	 */
43
	public void checkClientTrusted(java.security.cert.X509Certificate[] chain,
44
			String authType) {
45
		// don't need to do any checks
46
	}
47
48
	/**
49
	 * @see javax.net.ssl.X509TrustManager#checkServerTrusted(java.security.cert.X509Certificate[],
50
	 *      java.lang.String)
51
	 */
52
	public void checkServerTrusted(java.security.cert.X509Certificate[] chain,
53
			String authType) {
54
		// don't need to do any checks
55
	}
56
57
}
(-)a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient/NTLMProxyDetector.java (+64 lines)
Added Link Here
1
/*******************************************************************************
2
* Copyright (c) 2009 EclipseSource and others. All rights reserved. This
3
* program and the accompanying materials are made available under the terms of
4
* the Eclipse Public License v1.0 which accompanies this distribution, and is
5
* available at http://www.eclipse.org/legal/epl-v10.html
6
*
7
* Contributors:
8
*   EclipseSource - initial API and implementation
9
*   Thomas Joiner - changed to work with HttpClient 4.1 and added SPNEGO detection
10
******************************************************************************/
11
package org.eclipse.ecf.provider.filetransfer.httpclient;
12
13
import org.apache.http.auth.AuthScheme;
14
import org.apache.http.auth.AuthState;
15
import org.apache.http.client.HttpClient;
16
import org.apache.http.client.protocol.ClientContext;
17
import org.apache.http.protocol.HttpContext;
18
19
public class NTLMProxyDetector {
20
21
	private static final String PROXY_SPNEGO_VALUE = "NEGOTIATE"; //$NON-NLS-1$
22
	private static final String PROXY_NTLM_VALUE = "NTLM"; //$NON-NLS-1$
23
24
	/**
25
	 * This method will detect if the request connected to a NTLM proxy
26
	 * given the {@link HttpContext} provided to one of the {@link HttpClient#execute()}
27
	 * methods.
28
	 * 
29
	 * @param context the {@link HttpContext} given to the {@link HttpClient} at execution time
30
	 * @return true if it connected to an NTLM proxy
31
	 * @since 5.0
32
	 */
33
	public static boolean detectNTLMProxy(HttpContext context) {
34
		return isProxyType(context, PROXY_NTLM_VALUE);
35
	}
36
37
	private static boolean isProxyType(HttpContext context, String scheme) {
38
		if (context == null)
39
			return false;
40
		AuthState authState = (AuthState) context.getAttribute(ClientContext.PROXY_AUTH_STATE);
41
		if (authState == null)
42
			return false;
43
		AuthScheme authScheme = authState.getAuthScheme();
44
		if (authScheme == null)
45
			return false;
46
		String schemeName = authScheme.getSchemeName();
47
		if (schemeName == null)
48
			return false;
49
		return schemeName.equalsIgnoreCase(scheme);
50
	}
51
52
	/**
53
	 * This method will detect if the request connected to a SPNEGO proxy
54
	 * given the {@link HttpContext} provided to one of the {@link HttpClient#execute()}
55
	 * methods.
56
	 * 
57
	 * @param context the {@link HttpContext} given to the {@link HttpClient} at execution time
58
	 * @return true if it connected to an SPNEGO proxy
59
	 * @since 5.0
60
	 */
61
	public static boolean detectSPNEGOProxy(HttpContext context) {
62
		return isProxyType(context, PROXY_SPNEGO_VALUE);
63
	}
64
}

Return to bug 251740