From d7608ee886eea11149067c5ece255e2d7302c0f4 Mon Sep 17 00:00:00 2001 From: Henrik Lindberg Date: Mon, 27 Apr 2009 23:39:36 +0000 Subject: Bug 273094 A test server is needed to test error handling. Initial checkin of the Missbehaving testserver - see /webfiles/index.html for more information. --- .../org.eclipse.equinox.p2.testserver/.classpath | 7 + bundles/org.eclipse.equinox.p2.testserver/.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 353 ++++++++++ .../.settings/org.eclipse.jdt.ui.prefs | 56 ++ .../.settings/org.eclipse.pde.core.prefs | 4 + .../META-INF/MANIFEST.MF | 17 + .../build.properties | 5 + .../p2 test server.launch | 23 + .../org.eclipse.equinox.p2.testserver/plugin.xml | 26 + .../eclipse/equinox/p2/testserver/Activator.java | 103 +++ .../equinox/p2/testserver/AlwaysFailContext.java | 46 ++ .../equinox/p2/testserver/FlipFlopFailContext.java | 53 ++ .../equinox/p2/testserver/HttpConstants.java | 5 + .../equinox/p2/testserver/LinearChange.java | 70 ++ .../eclipse/equinox/p2/testserver/MimeLookup.java | 738 +++++++++++++++++++++ .../equinox/p2/testserver/SecureAction.java | 92 +++ .../equinox/p2/testserver/SecureContext.java | 51 ++ .../testserver/servlets/BasicResourceDelivery.java | 317 +++++++++ .../p2/testserver/servlets/ChopAndDelay.java | 129 ++++ .../p2/testserver/servlets/ContentLengthLier.java | 44 ++ .../p2/testserver/servlets/FileMolester.java | 118 ++++ .../equinox/p2/testserver/servlets/HelloWorld.java | 38 ++ .../p2/testserver/servlets/LastModifiedLier.java | 70 ++ .../p2/testserver/servlets/StatusCodeResponse.java | 80 +++ .../equinox/p2/testserver/servlets/TimeOut.java | 44 ++ .../equinox/p2/testserver/servlets/Truncator.java | 105 +++ .../webfiles/ar/simple/artifacts.xml | 29 + .../ar/simple/features/aaFeature_1.0.0.jar | Bin 0 -> 670 bytes .../webfiles/ar/simple/plugins/aaPlugin_1.0.0.jar | Bin 0 -> 469 bytes .../webfiles/ar/simple/readme.txt | 2 + .../webfiles/index.html | 41 ++ .../webfiles/index.xml | 10 + .../webfiles/mdr/composite/compositeContent.xml | 12 + .../webfiles/mdr/composite/one/content.xml | 128 ++++ .../webfiles/mdr/composite/two/content.xml | 128 ++++ .../updatesite/features/test.feature_1.0.0.jar | Bin 0 -> 847 bytes .../updatesite/plugins/test.bundle_1.0.0.jar | Bin 0 -> 1058 bytes .../updatesite/plugins/test.fragment_1.0.0.jar | Bin 0 -> 386 bytes .../webfiles/updatesite/site.xml | 4 + 39 files changed, 2976 insertions(+) create mode 100644 bundles/org.eclipse.equinox.p2.testserver/.classpath create mode 100644 bundles/org.eclipse.equinox.p2.testserver/.project create mode 100644 bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.jdt.core.prefs create mode 100644 bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.jdt.ui.prefs create mode 100644 bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.pde.core.prefs create mode 100644 bundles/org.eclipse.equinox.p2.testserver/META-INF/MANIFEST.MF create mode 100644 bundles/org.eclipse.equinox.p2.testserver/build.properties create mode 100644 bundles/org.eclipse.equinox.p2.testserver/p2 test server.launch create mode 100644 bundles/org.eclipse.equinox.p2.testserver/plugin.xml create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/Activator.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/AlwaysFailContext.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/FlipFlopFailContext.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/HttpConstants.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/LinearChange.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/MimeLookup.java create mode 100755 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/SecureAction.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/SecureContext.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/BasicResourceDelivery.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/ChopAndDelay.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/ContentLengthLier.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/FileMolester.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/HelloWorld.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/LastModifiedLier.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/StatusCodeResponse.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/TimeOut.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/Truncator.java create mode 100644 bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/artifacts.xml create mode 100644 bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/features/aaFeature_1.0.0.jar create mode 100644 bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/plugins/aaPlugin_1.0.0.jar create mode 100644 bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/readme.txt create mode 100644 bundles/org.eclipse.equinox.p2.testserver/webfiles/index.html create mode 100644 bundles/org.eclipse.equinox.p2.testserver/webfiles/index.xml create mode 100644 bundles/org.eclipse.equinox.p2.testserver/webfiles/mdr/composite/compositeContent.xml create mode 100644 bundles/org.eclipse.equinox.p2.testserver/webfiles/mdr/composite/one/content.xml create mode 100644 bundles/org.eclipse.equinox.p2.testserver/webfiles/mdr/composite/two/content.xml create mode 100644 bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/features/test.feature_1.0.0.jar create mode 100644 bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/plugins/test.bundle_1.0.0.jar create mode 100644 bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/plugins/test.fragment_1.0.0.jar create mode 100644 bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/site.xml (limited to 'bundles') diff --git a/bundles/org.eclipse.equinox.p2.testserver/.classpath b/bundles/org.eclipse.equinox.p2.testserver/.classpath new file mode 100644 index 000000000..64c5e31b7 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.eclipse.equinox.p2.testserver/.project b/bundles/org.eclipse.equinox.p2.testserver/.project new file mode 100644 index 000000000..b31ab4533 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/.project @@ -0,0 +1,28 @@ + + + org.eclipse.equinox.p2.testserver + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..6b947078c --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,353 @@ +#Thu Apr 23 14:57:34 CEST 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=false +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=800 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..9cdad0ea3 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,56 @@ +#Thu Apr 23 14:20:17 CEST 2009 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_core +formatter_settings_version=11 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=; +org.eclipse.jdt.ui.ondemandthreshold=20 +org.eclipse.jdt.ui.staticondemandthreshold=20 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..7913d20db --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ + +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/bundles/org.eclipse.equinox.p2.testserver/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.testserver/META-INF/MANIFEST.MF new file mode 100644 index 000000000..415da60d8 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Testserver +Bundle-SymbolicName: org.eclipse.equinox.p2.testserver;singleton:=true +Bundle-Version: 1.0.0 +Bundle-Activator: org.eclipse.equinox.p2.testserver.Activator +Bundle-Vendor: Eclipse +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.equinox.http, + org.osgi.framework;version="1.3.0" +Bundle-ActivationPolicy: lazy +Require-Bundle: javax.servlet;bundle-version="2.4.0", + org.eclipse.equinox.http.registry, + org.eclipse.equinox.http.servlet;bundle-version="1.0.200", + org.eclipse.osgi.services;bundle-version="3.2.0", + org.eclipse.osgi.util;bundle-version="3.2.0", + org.eclipse.osgi;bundle-version="3.5.0" diff --git a/bundles/org.eclipse.equinox.p2.testserver/build.properties b/bundles/org.eclipse.equinox.p2.testserver/build.properties new file mode 100644 index 000000000..e9863e281 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/bundles/org.eclipse.equinox.p2.testserver/p2 test server.launch b/bundles/org.eclipse.equinox.p2.testserver/p2 test server.launch new file mode 100644 index 000000000..050aa425a --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/p2 test server.launch @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.equinox.p2.testserver/plugin.xml b/bundles/org.eclipse.equinox.p2.testserver/plugin.xml new file mode 100644 index 000000000..bb4ece093 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/plugin.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/Activator.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/Activator.java new file mode 100644 index 000000000..03e935b69 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/Activator.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.p2.testserver; + +import java.net.URI; +import javax.servlet.ServletException; +import org.eclipse.equinox.p2.testserver.servlets.BasicResourceDelivery; +import org.eclipse.equinox.p2.testserver.servlets.ChopAndDelay; +import org.eclipse.equinox.p2.testserver.servlets.FileMolester; +import org.eclipse.equinox.p2.testserver.servlets.Truncator; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.http.HttpService; +import org.osgi.service.http.NamespaceException; +import org.osgi.util.tracker.ServiceTracker; +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +public class Activator implements BundleActivator, ServiceTrackerCustomizer { + private static BundleContext context; + private ServiceTracker httpTracker; + private SecureContext secureHttpContext; + private static Activator instance; + private HttpService httpService; + private AlwaysFailContext alwaysFail; + private FlipFlopFailContext flipFlop; + + private static final String SITE = "http://download.eclipse.org/eclipse/updates/3.4"; //$NON-NLS-1$ + + public void start(BundleContext aContext) throws Exception { + context = aContext; + + httpTracker = new ServiceTracker(context, HttpService.class.getName(), this); + httpTracker.open(); + instance = this; + } + + public void stop(BundleContext aContext) throws Exception { + httpTracker.close(); + context = null; + } + + public Object addingService(ServiceReference reference) { + httpService = (HttpService) context.getService(reference); + secureHttpContext = new SecureContext(httpService.createDefaultHttpContext()); + alwaysFail = new AlwaysFailContext(httpService.createDefaultHttpContext()); + flipFlop = new FlipFlopFailContext(httpService.createDefaultHttpContext()); + + try { + httpService.registerResources("/public", "/webfiles", null); //$NON-NLS-1$ //$NON-NLS-2$ + httpService.registerResources("/private", "/webfiles", secureHttpContext); //$NON-NLS-1$ //$NON-NLS-2$ + httpService.registerResources("/never", "/webfiles", alwaysFail); //$NON-NLS-1$ //$NON-NLS-2$ + httpService.registerResources("/flipflop", "/webfiles", flipFlop); //$NON-NLS-1$ //$NON-NLS-2$ + httpService.registerServlet("/truncated", new Truncator("/truncated", URI.create("/webfiles"), 50), null, null); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + httpService.registerServlet("/molested", new FileMolester("/molested", URI.create("/webfiles"), 40), null, null); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + // 8 bytes at a time, delay from 0 to 100 ms, in steps of 5 + httpService.registerServlet("/decelerate", new ChopAndDelay("/decelerate", URI.create("/webfiles"), 3, new LinearChange(0, 5, 100, 0)), null, null); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + + httpService.registerServlet("/proxy/truncated", new Truncator("/proxy/truncated", URI.create(SITE), 50), null, null); //$NON-NLS-1$//$NON-NLS-2$ + httpService.registerServlet("/proxy/private", new BasicResourceDelivery("/proxy/private", URI.create(SITE)), null, secureHttpContext); //$NON-NLS-1$//$NON-NLS-2$ + httpService.registerServlet("/proxy/never", new BasicResourceDelivery("/proxy/private", URI.create(SITE)), null, alwaysFail); //$NON-NLS-1$//$NON-NLS-2$ + httpService.registerServlet("/proxy/flipFlop", new BasicResourceDelivery("/proxy/private", URI.create(SITE)), null, flipFlop); //$NON-NLS-1$//$NON-NLS-2$ + httpService.registerServlet("/proxy/molested", new FileMolester("/proxy/molested", URI.create(SITE), 40), null, null); //$NON-NLS-1$//$NON-NLS-2$ + httpService.registerServlet("/proxy/decelerate", new ChopAndDelay("/proxy/decelerate", URI.create(SITE), 3, new LinearChange(0, 5, 100, 0)), null, null); //$NON-NLS-1$//$NON-NLS-2$ + + } catch (NamespaceException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ServletException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return httpService; + } + + public static Activator getInstance() { + return instance; + } + + public HttpService getHttp() { + return httpService; + } + + public void modifiedService(ServiceReference reference, Object service) { + // do nothing + } + + public void removedService(ServiceReference reference, Object service) { + httpService = (HttpService) service; + httpService.unregister("/public"); //$NON-NLS-1$ + httpService.unregister("/private"); //$NON-NLS-1$ + } + +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/AlwaysFailContext.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/AlwaysFailContext.java new file mode 100644 index 000000000..6d4711897 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/AlwaysFailContext.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.p2.testserver; + +import java.net.URL; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.osgi.service.http.HttpContext; + +/** + * The AlwaysFailContext can be used to add basic authentication to a path. + * This implementation will always fail (easier to test failure logic) this way. + */ +public class AlwaysFailContext implements HttpContext { + private HttpContext theDefaultContext; + + public AlwaysFailContext(HttpContext defaultContext) { + theDefaultContext = defaultContext; + } + + public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) { + // always fail + response.setHeader("WWW-Authenticate", "BASIC realm=\"p2 Http Testing Server (Aladdin, open sesame)\""); //$NON-NLS-1$//$NON-NLS-2$ + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + return false; + + } + + public String getMimeType(String name) { + return theDefaultContext.getMimeType(name); + } + + public URL getResource(String name) { + return theDefaultContext.getResource(name); + } + +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/FlipFlopFailContext.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/FlipFlopFailContext.java new file mode 100644 index 000000000..2ac9e7d04 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/FlipFlopFailContext.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.p2.testserver; + +import java.net.URL; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.osgi.service.http.HttpContext; + +/** + * The SecureContext can be used to add basic authentication to a path. + * It will fail on every other request to enable flaky server, or authentication testing. + * This implementation requires the user "Aladdin" to log in with the password "open sesame". + */ +public class FlipFlopFailContext implements HttpContext { + private HttpContext theDefaultContext; + public static int flipFlop = 0; + + public FlipFlopFailContext(HttpContext defaultContext) { + theDefaultContext = defaultContext; + } + + public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) { + String auth = request.getHeader("Authorization"); //$NON-NLS-1$ + // Response is Aladdin:open sesame in Base64 encoding (from RFC example) + if (auth != null && "QWxhZGRpbjpvcGVuIHNlc2FtZQ==".equals(auth.substring(6))) //$NON-NLS-1$ + return (flipFlop ^= 1) == 1 ? true : false; + + // if not authorized or wrong user/password + response.setHeader("WWW-Authenticate", "BASIC realm=\"p2 Http Testing Server (Aladdin, open sesame)\""); //$NON-NLS-1$//$NON-NLS-2$ + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + return false; + + } + + public String getMimeType(String name) { + return theDefaultContext.getMimeType(name); + } + + public URL getResource(String name) { + return theDefaultContext.getResource(name); + } + +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/HttpConstants.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/HttpConstants.java new file mode 100644 index 000000000..58ab7d066 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/HttpConstants.java @@ -0,0 +1,5 @@ +package org.eclipse.equinox.p2.testserver; + +public interface HttpConstants { + public static final String LAST_MODIFIED = "Last-Modified"; //$NON-NLS-1$ +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/LinearChange.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/LinearChange.java new file mode 100644 index 000000000..a3b8c98dc --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/LinearChange.java @@ -0,0 +1,70 @@ +package org.eclipse.equinox.p2.testserver; + +import java.util.NoSuchElementException; + +public class LinearChange { + boolean started; + long startValue; + long current; + long step; + long max; + long min; + public static final LinearChange NoChange = new LinearChange(0, 0); + + public LinearChange() { + started = false; + startValue = 0; + current = 0; + step = 1; + max = Long.MAX_VALUE; + min = Long.MIN_VALUE; + } + + public void reset() { + started = false; + current = startValue; + } + + public LinearChange fork() { + LinearChange forked = new LinearChange(); + forked.started = started; + forked.startValue = startValue; + forked.current = current; + forked.step = step; + forked.max = max; + forked.min = min; + return forked; + } + + public LinearChange(long firstValue, long step) { + this(); + current = startValue = firstValue; + this.step = step; + } + + public LinearChange(long firstValue, long step, long max, long min) { + this(firstValue, step); + this.max = max; + this.min = min; + } + + public long next() { + if (!hasNext()) + throw new NoSuchElementException(); + if (started) + current += step; + started = true; + + return current; + } + + public boolean hasNext() { + if (step == 0) + return false; + if (step > 0 && current + step >= max) + return false; + if (step < 0 && current + step <= min) + return false; + return true; + } +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/MimeLookup.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/MimeLookup.java new file mode 100644 index 000000000..71c09f80d --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/MimeLookup.java @@ -0,0 +1,738 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.p2.testserver; + +import java.util.HashMap; +import java.util.Map; + +public class MimeLookup { + + public static final String JAR_PACK_GZ = "jar.pack.gz"; //$NON-NLS-1$ + + public static String getMimeType(String name) { + if (extMap == null) + initNameToMime(); + + // treat names with multiple "." in a special way (currently only one) + if (name.endsWith(JAR_PACK_GZ)) + return (String) extMap.get(JAR_PACK_GZ); + int dot = name.lastIndexOf("."); //$NON-NLS-1$ + // get the suffix, use "a" for empty as this gives the default "application/octet-stream" + String tmp = dot == -1 ? "a" : name.substring(dot + 1); //$NON-NLS-1$ + tmp = (String) extMap.get(tmp); + return tmp == null ? "application/octet-stream" : tmp; //$NON-NLS-1$ + } + + private static Map extMap; + private static Map mimeMap; + + public static void initNameToMime() { + extMap = new HashMap(data.length); + for (int i = 0; i < data.length; i += 2) { + Object key = data[i]; + Object val = extMap.get(key); + if (val == null) + extMap.put(key, data[i]); + } + + } + + public static void initMimeToExt() { + mimeMap = new HashMap(data.length); + for (int i = 0; i < data.length; i += 2) { + Object key = data[i + 1]; + Object val = mimeMap.get(key); + if (val == null) + mimeMap.put(key, data[i]); + } + + } + + public final static String[] data = { // + //--- typical java related mime types - higher priority + "bat", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "batfrag", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "class", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "css", "text/css", //$NON-NLS-1$ //$NON-NLS-2$ + "cssfrag", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "exe", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "gif", "image/gif", //$NON-NLS-1$ //$NON-NLS-2$ + "html", "text/html", //$NON-NLS-1$ //$NON-NLS-2$ + "htmlfrag", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "jad", "text/vnd.sun.j2me.app-descriptor", //$NON-NLS-1$ //$NON-NLS-2$ + "jar", "application/java-archive", //$NON-NLS-1$ //$NON-NLS-2$ + "jar.pack.gz", "application/x-java-pack200", //$NON-NLS-1$ //$NON-NLS-2$ + "jardiff", "application/x-java-archive-diff", //$NON-NLS-1$ //$NON-NLS-2$ + "java", "text/x-java-source", //$NON-NLS-1$ //$NON-NLS-2$ + "javafrag", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "jnlp", "application/x-java-jnlp-file", //$NON-NLS-1$ //$NON-NLS-2$ + "jpg", "image/jpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "js", "application/x-javascript", //$NON-NLS-1$ //$NON-NLS-2$ + "mp3", "audio/mp3", //$NON-NLS-1$ //$NON-NLS-2$ + "png", "image/png", //$NON-NLS-1$ //$NON-NLS-2$ + "rss", "application/rss+xml", //$NON-NLS-1$ //$NON-NLS-2$ + "ser", "application/x-java-serialized-object", //$NON-NLS-1$ //$NON-NLS-2$ + "sql", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "sqlfrag", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "swf", "application/x-shockwave-flash", //$NON-NLS-1$ //$NON-NLS-2$ + "txt", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "wav", "audio/wav", //$NON-NLS-1$ //$NON-NLS-2$ + "xml", "application/xml", //$NON-NLS-1$ //$NON-NLS-2$ + "xmlfrag", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "zip", "application/zip", //$NON-NLS-1$ //$NON-NLS-2$ + + //--- misc definitions + "3dm", "x-world/x-3dmf", //$NON-NLS-1$ //$NON-NLS-2$ + "3dmf", "x-world/x-3dmf", //$NON-NLS-1$ //$NON-NLS-2$ + + "a", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "aab", "application/x-authorware-bin", //$NON-NLS-1$ //$NON-NLS-2$ + "aam", "application/x-authorware-map", //$NON-NLS-1$ //$NON-NLS-2$ + "aas", "application/x-authorware-seg", //$NON-NLS-1$ //$NON-NLS-2$ + "abc", "text/vnd.abc", //$NON-NLS-1$ //$NON-NLS-2$ + "acgi", "text/html", //$NON-NLS-1$ //$NON-NLS-2$ + "afl", "video/animaflex", //$NON-NLS-1$ //$NON-NLS-2$ + "ai", "application/postscript", //$NON-NLS-1$ //$NON-NLS-2$ + "aif", "audio/aiff", //$NON-NLS-1$ //$NON-NLS-2$ + "aif", "audio/x-aiff", //$NON-NLS-1$ //$NON-NLS-2$ + "aifc", "audio/aiff", //$NON-NLS-1$ //$NON-NLS-2$ + "aifc", "audio/x-aiff", //$NON-NLS-1$ //$NON-NLS-2$ + "aiff", "audio/aiff", //$NON-NLS-1$ //$NON-NLS-2$ + "aiff", "audio/x-aiff", //$NON-NLS-1$ //$NON-NLS-2$ + "aim", "application/x-aim", //$NON-NLS-1$ //$NON-NLS-2$ + "aip", "text/x-audiosoft-intra", //$NON-NLS-1$ //$NON-NLS-2$ + "ani", "application/x-navi-animation", //$NON-NLS-1$ //$NON-NLS-2$ + "aps", "application/mime", //$NON-NLS-1$ //$NON-NLS-2$ + "arc", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "arj", "application/arj", //$NON-NLS-1$ //$NON-NLS-2$ + "arj", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "art", "image/x-jg", //$NON-NLS-1$ //$NON-NLS-2$ + "asf", "video/x-ms-asf", //$NON-NLS-1$ //$NON-NLS-2$ + "asm", "text/x-asm", //$NON-NLS-1$ //$NON-NLS-2$ + "asp", "text/asp", //$NON-NLS-1$ //$NON-NLS-2$ + "asx", "application/x-mplayer2", //$NON-NLS-1$ //$NON-NLS-2$ + "asx", "video/x-ms-asf", //$NON-NLS-1$ //$NON-NLS-2$ + "asx", "video/x-ms-asf-plugin", //$NON-NLS-1$ //$NON-NLS-2$ + "au", "audio/basic", //$NON-NLS-1$ //$NON-NLS-2$ + "au", "audio/x-au", //$NON-NLS-1$ //$NON-NLS-2$ + "avi", "video/avi", //$NON-NLS-1$ //$NON-NLS-2$ + "avi", "application/x-troff-msvideo", //$NON-NLS-1$ //$NON-NLS-2$ + "avi", "video/msvideo", //$NON-NLS-1$ //$NON-NLS-2$ + "avi", "video/x-msvideo", //$NON-NLS-1$ //$NON-NLS-2$ + "avs", "video/avs-video", //$NON-NLS-1$ //$NON-NLS-2$ + + "bcpio", "application/x-bcpio", //$NON-NLS-1$ //$NON-NLS-2$ + "bin", "application/mac-binary", //$NON-NLS-1$ //$NON-NLS-2$ + "bin", "application/macbinary", //$NON-NLS-1$ //$NON-NLS-2$ + "bin", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "bin", "application/x-binary", //$NON-NLS-1$ //$NON-NLS-2$ + "bin", "application/x-macbinary", //$NON-NLS-1$ //$NON-NLS-2$ + "bm", "image/bmp", //$NON-NLS-1$ //$NON-NLS-2$ + "bmp", "image/bmp", //$NON-NLS-1$ //$NON-NLS-2$ + "bmp", "image/x-windows-bmp", //$NON-NLS-1$ //$NON-NLS-2$ + "boo", "application/book", //$NON-NLS-1$ //$NON-NLS-2$ + "book", "application/book", //$NON-NLS-1$ //$NON-NLS-2$ + "boz", "application/x-bzip2", //$NON-NLS-1$ //$NON-NLS-2$ + "bsh", "application/x-bsh", //$NON-NLS-1$ //$NON-NLS-2$ + "bz", "application/x-bzip", //$NON-NLS-1$ //$NON-NLS-2$ + "bz2", "application/x-bzip2", //$NON-NLS-1$ //$NON-NLS-2$ + "c", "text/x-c", //$NON-NLS-1$ //$NON-NLS-2$ + "c", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "c++", "text/x-c", //$NON-NLS-1$ //$NON-NLS-2$ + "c++", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "cat", "application/vnd.ms-pki.seccat", //$NON-NLS-1$ //$NON-NLS-2$ + "cc", "text/x-c", //$NON-NLS-1$ //$NON-NLS-2$ + "cc", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "ccad", "application/clariscad", //$NON-NLS-1$ //$NON-NLS-2$ + "cco", "application/x-cocoa", //$NON-NLS-1$ //$NON-NLS-2$ + "cdf", "application/cdf", //$NON-NLS-1$ //$NON-NLS-2$ + "cdf", "application/x-cdf", //$NON-NLS-1$ //$NON-NLS-2$ + "cdf", "application/x-netcdf", //$NON-NLS-1$ //$NON-NLS-2$ + "cer", "application/pkix-cert", //$NON-NLS-1$ //$NON-NLS-2$ + "cer", "application/x-x509-ca-cert", //$NON-NLS-1$ //$NON-NLS-2$ + "cha", "application/x-chat", //$NON-NLS-1$ //$NON-NLS-2$ + "chat", "application/x-chat", //$NON-NLS-1$ //$NON-NLS-2$ + "class", "application/java", //$NON-NLS-1$ //$NON-NLS-2$ + "class", "application/java-byte-code", //$NON-NLS-1$ //$NON-NLS-2$ + "class", "application/x-java-class", //$NON-NLS-1$ //$NON-NLS-2$ + "com", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "com", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "conf", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "cpio", "application/x-cpio", //$NON-NLS-1$ //$NON-NLS-2$ + "cpp", "text/x-c", //$NON-NLS-1$ //$NON-NLS-2$ + "cpt", "application/mac-compactpro", //$NON-NLS-1$ //$NON-NLS-2$ + "cpt", "application/x-compactpro", //$NON-NLS-1$ //$NON-NLS-2$ + "cpt", "application/x-cpt", //$NON-NLS-1$ //$NON-NLS-2$ + "crl", "application/pkcs-crl", //$NON-NLS-1$ //$NON-NLS-2$ + "crl", "application/pkix-crl", //$NON-NLS-1$ //$NON-NLS-2$ + "crt", "application/pkix-cert", //$NON-NLS-1$ //$NON-NLS-2$ + "crt", "application/x-x509-ca-cert", //$NON-NLS-1$ //$NON-NLS-2$ + "crt", "application/x-x509-user-cert", //$NON-NLS-1$ //$NON-NLS-2$ + "csh", "application/x-csh", //$NON-NLS-1$ //$NON-NLS-2$ + "csh", "text/x-script.csh", //$NON-NLS-1$ //$NON-NLS-2$ + "css", "text/css", //$NON-NLS-1$ //$NON-NLS-2$ + "cxx", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "css", "application/x-pointplus", //$NON-NLS-1$ //$NON-NLS-2$ + + "dcr", "application/x-director", //$NON-NLS-1$ //$NON-NLS-2$ + "deepv", "application/x-deepv", //$NON-NLS-1$ //$NON-NLS-2$ + "der", "application/x-x509-ca-cert", //$NON-NLS-1$ //$NON-NLS-2$ + "def", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "dif", "video/x-dv", //$NON-NLS-1$ //$NON-NLS-2$ + "dir", "application/x-director", //$NON-NLS-1$ //$NON-NLS-2$ + "dl", "video/dl", //$NON-NLS-1$ //$NON-NLS-2$ + "dl", "video/x-dl", //$NON-NLS-1$ //$NON-NLS-2$ + "doc", "application/msword", //$NON-NLS-1$ //$NON-NLS-2$ + "dot", "application/msword", //$NON-NLS-1$ //$NON-NLS-2$ + "dp", "application/commonground", //$NON-NLS-1$ //$NON-NLS-2$ + "drw", "application/drafting", //$NON-NLS-1$ //$NON-NLS-2$ + "dump", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "dv", "video/x-dv", //$NON-NLS-1$ //$NON-NLS-2$ + "dvi", "application/x-dvi", //$NON-NLS-1$ //$NON-NLS-2$ + "dwf", "model/vnd.dwf", //$NON-NLS-1$ //$NON-NLS-2$ + "dwg", "application/acad", //$NON-NLS-1$ //$NON-NLS-2$ + "dwg", "image/vnd.dwg", //$NON-NLS-1$ //$NON-NLS-2$ + "dwg", "image/x-dwg", //$NON-NLS-1$ //$NON-NLS-2$ + "dxf", "application/dxf", //$NON-NLS-1$ //$NON-NLS-2$ + "dxf", "image/vnd.dwg", //$NON-NLS-1$ //$NON-NLS-2$ + "dxf", "image/x-dwg", //$NON-NLS-1$ //$NON-NLS-2$ + "dxr", "application/x-director", //$NON-NLS-1$ //$NON-NLS-2$ + + "elc", "application/x-elc", //$NON-NLS-1$ //$NON-NLS-2$ + "env", "application/x-envoy", //$NON-NLS-1$ //$NON-NLS-2$ + "eps", "application/postscript", //$NON-NLS-1$ //$NON-NLS-2$ + "es", "application/x-esrehber", //$NON-NLS-1$ //$NON-NLS-2$ + "etx", "text/x-setext", //$NON-NLS-1$ //$NON-NLS-2$ + "exe", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "f", "text/x-fortran", //$NON-NLS-1$ //$NON-NLS-2$ + "f", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "f77", "text/x-fortran", //$NON-NLS-1$ //$NON-NLS-2$ + "f90", "text/x-fortran", //$NON-NLS-1$ //$NON-NLS-2$ + "f90", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "fdf", "application/vnd.fdf", //$NON-NLS-1$ //$NON-NLS-2$ + "fli", "video/fli", //$NON-NLS-1$ //$NON-NLS-2$ + "fli", "video/x-fli", //$NON-NLS-1$ //$NON-NLS-2$ + "for", "text/x-fortran", //$NON-NLS-1$ //$NON-NLS-2$ + "for", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "fpx", "image/vnd.fpx", //$NON-NLS-1$ //$NON-NLS-2$ + "fpx", "image/vnd.net-fpx", //$NON-NLS-1$ //$NON-NLS-2$ + "frl", "application/freeloader", //$NON-NLS-1$ //$NON-NLS-2$ + "funk", "audio/make", //$NON-NLS-1$ //$NON-NLS-2$ + + "g", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "g3", "image/g3fax", //$NON-NLS-1$ //$NON-NLS-2$ + "gif", "image/gif", //$NON-NLS-1$ //$NON-NLS-2$ + "gl", "video/gl", //$NON-NLS-1$ //$NON-NLS-2$ + "gl", "video/x-gl", //$NON-NLS-1$ //$NON-NLS-2$ + "gsd", "audio/x-gsm", //$NON-NLS-1$ //$NON-NLS-2$ + "gsm", "audio/x-gsm", //$NON-NLS-1$ //$NON-NLS-2$ + "gsp", "application/x-gsp", //$NON-NLS-1$ //$NON-NLS-2$ + "gss", "application/x-gss", //$NON-NLS-1$ //$NON-NLS-2$ + "gtar", "application/x-gtar", //$NON-NLS-1$ //$NON-NLS-2$ + "gz", "application/x-compressed", //$NON-NLS-1$ //$NON-NLS-2$ + "gz", "application/x-gzip", //$NON-NLS-1$ //$NON-NLS-2$ + "gzip", "application/x-gzip", //$NON-NLS-1$ //$NON-NLS-2$ + "gzip", "multipart/x-gzip", //$NON-NLS-1$ //$NON-NLS-2$ + + "h", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "h", "text/x-h", //$NON-NLS-1$ //$NON-NLS-2$ + "hdf", "application/x-hdf", //$NON-NLS-1$ //$NON-NLS-2$ + "help", "application/x-helpfile", //$NON-NLS-1$ //$NON-NLS-2$ + "hgl", "application/vnd.hp-hpgl", //$NON-NLS-1$ //$NON-NLS-2$ + "hh", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "hh", "text/x-h", //$NON-NLS-1$ //$NON-NLS-2$ + "hlb", "text/x-script", //$NON-NLS-1$ //$NON-NLS-2$ + "hlp", "application/hlp", //$NON-NLS-1$ //$NON-NLS-2$ + "hlp", "application/x-helpfile", //$NON-NLS-1$ //$NON-NLS-2$ + "hlp", "application/x-winhelp", //$NON-NLS-1$ //$NON-NLS-2$ + "hpg", "application/vnd.hp-hpgl", //$NON-NLS-1$ //$NON-NLS-2$ + "hpgl", "application/vnd.hp-hpgl", //$NON-NLS-1$ //$NON-NLS-2$ + "hqx", "application/binhex", //$NON-NLS-1$ //$NON-NLS-2$ + "hqx", "application/binhex4", //$NON-NLS-1$ //$NON-NLS-2$ + "hqx", "application/mac-binhex", //$NON-NLS-1$ //$NON-NLS-2$ + "hqx", "application/mac-binhex40", //$NON-NLS-1$ //$NON-NLS-2$ + "hqx", "application/x-binhex40", //$NON-NLS-1$ //$NON-NLS-2$ + "hqx", "application/x-mac-binhex40", //$NON-NLS-1$ //$NON-NLS-2$ + "hta", "application/hta", //$NON-NLS-1$ //$NON-NLS-2$ + "htc", "text/x-component", //$NON-NLS-1$ //$NON-NLS-2$ + "htm", "text/html", //$NON-NLS-1$ //$NON-NLS-2$ + "html", "text/html", //$NON-NLS-1$ //$NON-NLS-2$ + "htmls", "text/html", //$NON-NLS-1$ //$NON-NLS-2$ + "htt", "text/webviewhtml", //$NON-NLS-1$ //$NON-NLS-2$ + "htx", "text/html", //$NON-NLS-1$ //$NON-NLS-2$ + + "ice", "x-conference/x-cooltalk", //$NON-NLS-1$ //$NON-NLS-2$ + "ico", "image/x-icon", //$NON-NLS-1$ //$NON-NLS-2$ + "idc", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "ief", "image/ief", //$NON-NLS-1$ //$NON-NLS-2$ + "iefs", "image/ief", //$NON-NLS-1$ //$NON-NLS-2$ + "iges", "application/iges", //$NON-NLS-1$ //$NON-NLS-2$ + "iges", "model/iges", //$NON-NLS-1$ //$NON-NLS-2$ + "igs", "application/iges", //$NON-NLS-1$ //$NON-NLS-2$ + "igs", "model/iges", //$NON-NLS-1$ //$NON-NLS-2$ + "ima", "application/x-ima", //$NON-NLS-1$ //$NON-NLS-2$ + "imap", "application/x-httpd-imap", //$NON-NLS-1$ //$NON-NLS-2$ + "inf", "application/inf", //$NON-NLS-1$ //$NON-NLS-2$ + "ins", "application/x-internett-signup", //$NON-NLS-1$ //$NON-NLS-2$ + "ip", "application/x-ip2", //$NON-NLS-1$ //$NON-NLS-2$ + "isu", "video/x-isvideo", //$NON-NLS-1$ //$NON-NLS-2$ + "it", "audio/it", //$NON-NLS-1$ //$NON-NLS-2$ + "iv", "application/x-inventor", //$NON-NLS-1$ //$NON-NLS-2$ + "ivr", "i-world/i-vrml", //$NON-NLS-1$ //$NON-NLS-2$ + "ivy", "application/x-livescreen", //$NON-NLS-1$ //$NON-NLS-2$ + + "jam", "audio/x-jam", //$NON-NLS-1$ //$NON-NLS-2$ + "jav", "text/x-java-source", //$NON-NLS-1$ //$NON-NLS-2$ + "jav", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "java", "text/x-java-source", //$NON-NLS-1$ //$NON-NLS-2$ + "java", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "jcm", "application/x-java-commerce", //$NON-NLS-1$ //$NON-NLS-2$ + "jfif", "image/jpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "jfif", "image/pjpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "jfif-tbnl", "image/jpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "jpe", "image/jpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "jpe", "image/pjpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "jpeg", "image/jpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "jpeg", "image/pjpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "jpg", "image/jpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "jpg", "image/pjpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "jps", "image/x-jps", //$NON-NLS-1$ //$NON-NLS-2$ + "js", "application/x-javascript", //$NON-NLS-1$ //$NON-NLS-2$ + "jut", "image/jutvision", //$NON-NLS-1$ //$NON-NLS-2$ + + "kar", "audio/midi", //$NON-NLS-1$ //$NON-NLS-2$ + "kar", "music/x-karaoke", //$NON-NLS-1$ //$NON-NLS-2$ + "ksh", "application/x-ksh", //$NON-NLS-1$ //$NON-NLS-2$ + "ksh", "text/x-script.ksh", //$NON-NLS-1$ //$NON-NLS-2$ + + "la", "audio/nspaudio", //$NON-NLS-1$ //$NON-NLS-2$ + "la", "audio/x-nspaudio", //$NON-NLS-1$ //$NON-NLS-2$ + "lam", "audio/x-liveaudio", //$NON-NLS-1$ //$NON-NLS-2$ + "latex", "application/x-latex", //$NON-NLS-1$ //$NON-NLS-2$ + "lha", "application/lha", //$NON-NLS-1$ //$NON-NLS-2$ + "lha", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "lha", "application/x-lha", //$NON-NLS-1$ //$NON-NLS-2$ + "lhx", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "list", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "lma", "audio/nspaudio", //$NON-NLS-1$ //$NON-NLS-2$ + "lma", "audio/x-nspaudio", //$NON-NLS-1$ //$NON-NLS-2$ + "log", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "lsp", "application/x-lisp", //$NON-NLS-1$ //$NON-NLS-2$ + "lsp", "text/x-script.lisp", //$NON-NLS-1$ //$NON-NLS-2$ + "lst", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "lsx", "text/x-la-asf", //$NON-NLS-1$ //$NON-NLS-2$ + "ltx", "application/x-latex", //$NON-NLS-1$ //$NON-NLS-2$ + "lzh", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "lzh", "application/x-lzh", //$NON-NLS-1$ //$NON-NLS-2$ + "lzx", "application/lzx", //$NON-NLS-1$ //$NON-NLS-2$ + "lzx", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "lzx", "application/x-lzx", //$NON-NLS-1$ //$NON-NLS-2$ + + "m", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "m", "text/x-m", //$NON-NLS-1$ //$NON-NLS-2$ + "m1v", "video/mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "m2a", "audio/mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "m2v", "video/mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "m3u", "audio/x-mpequrl", //$NON-NLS-1$ //$NON-NLS-2$ + "man", "application/x-troff-man", //$NON-NLS-1$ //$NON-NLS-2$ + "map", "application/x-navimap", //$NON-NLS-1$ //$NON-NLS-2$ + "mar", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "mbd", "application/mbedlet", //$NON-NLS-1$ //$NON-NLS-2$ + "mcd", "application/mcad", //$NON-NLS-1$ //$NON-NLS-2$ + "mcd", "application/x-mathcad", //$NON-NLS-1$ //$NON-NLS-2$ + "mcf", "image/vasa", //$NON-NLS-1$ //$NON-NLS-2$ + "mcf", "text/mcf", //$NON-NLS-1$ //$NON-NLS-2$ + "mcp", "application/netmc", //$NON-NLS-1$ //$NON-NLS-2$ + "me", "application/x-troff-me", //$NON-NLS-1$ //$NON-NLS-2$ + "mht", "message/rfc822", //$NON-NLS-1$ //$NON-NLS-2$ + "mhtml", "message/rfc822", //$NON-NLS-1$ //$NON-NLS-2$ + "mid", "audio/midi", //$NON-NLS-1$ //$NON-NLS-2$ + "mid", "application/x-midi", //$NON-NLS-1$ //$NON-NLS-2$ + "mid", "audio/x-mid", //$NON-NLS-1$ //$NON-NLS-2$ + "mid", "audio/x-midi", //$NON-NLS-1$ //$NON-NLS-2$ + "mid", "music/crescendo", //$NON-NLS-1$ //$NON-NLS-2$ + "mid", "x-music/x-midi", //$NON-NLS-1$ //$NON-NLS-2$ + "midi", "audio/midi", //$NON-NLS-1$ //$NON-NLS-2$ + "midi", "application/x-midi", //$NON-NLS-1$ //$NON-NLS-2$ + "midi", "audio/x-mid", //$NON-NLS-1$ //$NON-NLS-2$ + "midi", "audio/x-midi", //$NON-NLS-1$ //$NON-NLS-2$ + "midi", "music/crescendo", //$NON-NLS-1$ //$NON-NLS-2$ + "midi", "x-music/x-midi", //$NON-NLS-1$ //$NON-NLS-2$ + "mif", "application/x-frame", //$NON-NLS-1$ //$NON-NLS-2$ + "mif", "application/x-mif", //$NON-NLS-1$ //$NON-NLS-2$ + "mime", "www/mime", //$NON-NLS-1$ //$NON-NLS-2$ + "mime", "message/rfc822", //$NON-NLS-1$ //$NON-NLS-2$ + "mjpg", "video/x-motion-jpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mm", "application/base64", //$NON-NLS-1$ //$NON-NLS-2$ + "mm", "application/x-meme", //$NON-NLS-1$ //$NON-NLS-2$ + "mme", "application/base64", //$NON-NLS-1$ //$NON-NLS-2$ + "mod", "audio/mod", //$NON-NLS-1$ //$NON-NLS-2$ + "mod", "audio/x-mod", //$NON-NLS-1$ //$NON-NLS-2$ + "moov", "video/quicktime", //$NON-NLS-1$ //$NON-NLS-2$ + "mov", "video/quicktime", //$NON-NLS-1$ //$NON-NLS-2$ + "movie", "video/x-sgi-movie", //$NON-NLS-1$ //$NON-NLS-2$ + "mp2", "audio/mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mp2", "audio/x-mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mp2", "video/mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mp2", "video/x-mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mp2", "video/x-mpeq2a", //$NON-NLS-1$ //$NON-NLS-2$ + "mp3", "audio/mpeg3", //$NON-NLS-1$ //$NON-NLS-2$ + "mp3", "audio/x-mpeg-3", //$NON-NLS-1$ //$NON-NLS-2$ + "mp3", "video/mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mp3", "video/x-mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mpa", "audio/mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mpa", "video/mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mpc", "application/x-project", //$NON-NLS-1$ //$NON-NLS-2$ + "mpe", "video/mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mpeg", "video/mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mpg", "audio/mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mpg", "video/mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mpga", "audio/mpeg", //$NON-NLS-1$ //$NON-NLS-2$ + "mpp", "application/vnd.ms-project", //$NON-NLS-1$ //$NON-NLS-2$ + "mpt", "application/x-project", //$NON-NLS-1$ //$NON-NLS-2$ + "mpv", "application/x-project", //$NON-NLS-1$ //$NON-NLS-2$ + "mpx", "application/x-project", //$NON-NLS-1$ //$NON-NLS-2$ + "mrc", "application/marc", //$NON-NLS-1$ //$NON-NLS-2$ + "ms", "application/x-troff-ms", //$NON-NLS-1$ //$NON-NLS-2$ + "mv", "video/x-sgi-movie", //$NON-NLS-1$ //$NON-NLS-2$ + "my", "audio/make", //$NON-NLS-1$ //$NON-NLS-2$ + "mzz", "application/x-vnd.audioexplosion.mzz", //$NON-NLS-1$ //$NON-NLS-2$ + + "nap", "image/naplps", //$NON-NLS-1$ //$NON-NLS-2$ + "naplps", "image/naplps", //$NON-NLS-1$ //$NON-NLS-2$ + "nc", "application/x-netcdf", //$NON-NLS-1$ //$NON-NLS-2$ + "ncm", "application/vnd.nokia.configuration-message", //$NON-NLS-1$ //$NON-NLS-2$ + "nif", "image/x-niff", //$NON-NLS-1$ //$NON-NLS-2$ + "niff", "image/x-niff", //$NON-NLS-1$ //$NON-NLS-2$ + "nix", "application/x-mix-transfer", //$NON-NLS-1$ //$NON-NLS-2$ + "nsc", "application/x-conference", //$NON-NLS-1$ //$NON-NLS-2$ + "nvd", "application/x-navidoc", //$NON-NLS-1$ //$NON-NLS-2$ + "o", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "oda", "application/oda", //$NON-NLS-1$ //$NON-NLS-2$ + "omc", "application/x-omc", //$NON-NLS-1$ //$NON-NLS-2$ + "omcd", "application/x-omcdatamaker", //$NON-NLS-1$ //$NON-NLS-2$ + "omcr", "application/x-omcregerator", //$NON-NLS-1$ //$NON-NLS-2$ + + "p", "text/x-pascal", //$NON-NLS-1$ //$NON-NLS-2$ + "p10", "application/pkcs10", //$NON-NLS-1$ //$NON-NLS-2$ + "p10", "application/x-pkcs10", //$NON-NLS-1$ //$NON-NLS-2$ + "p12", "application/pkcs-12", //$NON-NLS-1$ //$NON-NLS-2$ + "p12", "application/x-pkcs12", //$NON-NLS-1$ //$NON-NLS-2$ + "p7a", "application/x-pkcs7-signature", //$NON-NLS-1$ //$NON-NLS-2$ + "p7c", "application/pkcs7-mime", //$NON-NLS-1$ //$NON-NLS-2$ + "p7c", "application/x-pkcs7-mime", //$NON-NLS-1$ //$NON-NLS-2$ + "p7m", "application/pkcs7-mime", //$NON-NLS-1$ //$NON-NLS-2$ + "p7m", "application/x-pkcs7-mime", //$NON-NLS-1$ //$NON-NLS-2$ + "p7r", "application/x-pkcs7-certreqresp", //$NON-NLS-1$ //$NON-NLS-2$ + "p7s", "application/pkcs7-signature", //$NON-NLS-1$ //$NON-NLS-2$ + "part", "application/pro_eng", //$NON-NLS-1$ //$NON-NLS-2$ + "pas", "text/pascal", //$NON-NLS-1$ //$NON-NLS-2$ + "pbm", "image/x-portable-bitmap", //$NON-NLS-1$ //$NON-NLS-2$ + "pcl", "application/vnd.hp-pcl", //$NON-NLS-1$ //$NON-NLS-2$ + "pcl", "application/x-pcl", //$NON-NLS-1$ //$NON-NLS-2$ + "pct", "image/x-pict", //$NON-NLS-1$ //$NON-NLS-2$ + "pcx", "image/x-pcx", //$NON-NLS-1$ //$NON-NLS-2$ + "pdb", "chemical/x-pdb", //$NON-NLS-1$ //$NON-NLS-2$ + "pdf", "application/pdf", //$NON-NLS-1$ //$NON-NLS-2$ + "pfunk", "audio/make", //$NON-NLS-1$ //$NON-NLS-2$ + "pfunk", "audio/make.my.funk", //$NON-NLS-1$ //$NON-NLS-2$ + "pgm", "image/x-portable-graymap", //$NON-NLS-1$ //$NON-NLS-2$ + "pgm", "image/x-portable-greymap", //$NON-NLS-1$ //$NON-NLS-2$ + "pic", "image/pict", //$NON-NLS-1$ //$NON-NLS-2$ + "pict", "image/pict", //$NON-NLS-1$ //$NON-NLS-2$ + "pkg", "application/x-newton-compatible-pkg", //$NON-NLS-1$ //$NON-NLS-2$ + "pko", "application/vnd.ms-pki.pko", //$NON-NLS-1$ //$NON-NLS-2$ + "pl", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "pl", "text/x-script.perl", //$NON-NLS-1$ //$NON-NLS-2$ + "plx", "application/x-pixclscript", //$NON-NLS-1$ //$NON-NLS-2$ + "pm", "image/x-xpixmap", //$NON-NLS-1$ //$NON-NLS-2$ + "pm", "text/x-script.perl-module", //$NON-NLS-1$ //$NON-NLS-2$ + "pm4", "application/x-pagemaker", //$NON-NLS-1$ //$NON-NLS-2$ + "pm5", "application/x-pagemaker", //$NON-NLS-1$ //$NON-NLS-2$ + "png", "image/png", //$NON-NLS-1$ //$NON-NLS-2$ + "pnm", "application/x-portable-anymap", //$NON-NLS-1$ //$NON-NLS-2$ + "pnm", "image/x-portable-anymap", //$NON-NLS-1$ //$NON-NLS-2$ + "pot", "application/mspowerpoint", //$NON-NLS-1$ //$NON-NLS-2$ + "pot", "application/vnd.ms-powerpoint", //$NON-NLS-1$ //$NON-NLS-2$ + "pov", "model/x-pov", //$NON-NLS-1$ //$NON-NLS-2$ + "ppa", "application/vnd.ms-powerpoint", //$NON-NLS-1$ //$NON-NLS-2$ + "ppm", "image/x-portable-pixmap", //$NON-NLS-1$ //$NON-NLS-2$ + "pps", "application/mspowerpoint", //$NON-NLS-1$ //$NON-NLS-2$ + "pps", "application/vnd.ms-powerpoint", //$NON-NLS-1$ //$NON-NLS-2$ + "ppt", "application/mspowerpoint", //$NON-NLS-1$ //$NON-NLS-2$ + "ppt", "application/powerpoint", //$NON-NLS-1$ //$NON-NLS-2$ + "ppt", "application/vnd.ms-powerpoint", //$NON-NLS-1$ //$NON-NLS-2$ + "ppt", "application/x-mspowerpoint", //$NON-NLS-1$ //$NON-NLS-2$ + "ppz", "application/mspowerpoint", //$NON-NLS-1$ //$NON-NLS-2$ + "pre", "application/x-freelance", //$NON-NLS-1$ //$NON-NLS-2$ + "prt", "application/pro_eng", //$NON-NLS-1$ //$NON-NLS-2$ + "ps", "application/postscript", //$NON-NLS-1$ //$NON-NLS-2$ + "psd", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "pvu", "paleovu/x-pv", //$NON-NLS-1$ //$NON-NLS-2$ + "pwz", "application/vnd.ms-powerpoint", //$NON-NLS-1$ //$NON-NLS-2$ + "py", "text/x-script.phyton", //$NON-NLS-1$ //$NON-NLS-2$ + "pyc", "applicaiton/x-bytecode.python", //$NON-NLS-1$ //$NON-NLS-2$ + "qcp", "audio/vnd.qcelp", //$NON-NLS-1$ //$NON-NLS-2$ + "qd3", "x-world/x-3dmf", //$NON-NLS-1$ //$NON-NLS-2$ + "qd3d", "x-world/x-3dmf", //$NON-NLS-1$ //$NON-NLS-2$ + "qif", "image/x-quicktime", //$NON-NLS-1$ //$NON-NLS-2$ + "qt", "video/quicktime", //$NON-NLS-1$ //$NON-NLS-2$ + "qtc", "video/x-qtc", //$NON-NLS-1$ //$NON-NLS-2$ + "qti", "image/x-quicktime", //$NON-NLS-1$ //$NON-NLS-2$ + "qtif", "image/x-quicktime", //$NON-NLS-1$ //$NON-NLS-2$ + "ra", "audio/x-pn-realaudio", //$NON-NLS-1$ //$NON-NLS-2$ + "ra", "audio/x-pn-realaudio-plugin", //$NON-NLS-1$ //$NON-NLS-2$ + "ra", "audio/x-realaudio", //$NON-NLS-1$ //$NON-NLS-2$ + "ram", "audio/x-pn-realaudio", //$NON-NLS-1$ //$NON-NLS-2$ + "ras", "application/x-cmu-raster", //$NON-NLS-1$ //$NON-NLS-2$ + "ras", "image/cmu-raster", //$NON-NLS-1$ //$NON-NLS-2$ + "ras", "image/x-cmu-raster", //$NON-NLS-1$ //$NON-NLS-2$ + "rast", "image/cmu-raster", //$NON-NLS-1$ //$NON-NLS-2$ + "rexx", "text/x-script.rexx", //$NON-NLS-1$ //$NON-NLS-2$ + "rf", "image/vnd.rn-realflash", //$NON-NLS-1$ //$NON-NLS-2$ + "rgb", "image/x-rgb", //$NON-NLS-1$ //$NON-NLS-2$ + "rm", "application/vnd.rn-realmedia", //$NON-NLS-1$ //$NON-NLS-2$ + "rm", "audio/x-pn-realaudio", //$NON-NLS-1$ //$NON-NLS-2$ + "rmi", "audio/mid", //$NON-NLS-1$ //$NON-NLS-2$ + "rmm", "audio/x-pn-realaudio", //$NON-NLS-1$ //$NON-NLS-2$ + "rmp", "audio/x-pn-realaudio", //$NON-NLS-1$ //$NON-NLS-2$ + "rmp", "audio/x-pn-realaudio-plugin", //$NON-NLS-1$ //$NON-NLS-2$ + "rng", "application/ringing-tones", //$NON-NLS-1$ //$NON-NLS-2$ + "rng", "application/vnd.nokia.ringing-tone", //$NON-NLS-1$ //$NON-NLS-2$ + "rnx", "application/vnd.rn-realplayer", //$NON-NLS-1$ //$NON-NLS-2$ + "roff", "application/x-troff", //$NON-NLS-1$ //$NON-NLS-2$ + "rp", "image/vnd.rn-realpix", //$NON-NLS-1$ //$NON-NLS-2$ + "rpm", "audio/x-pn-realaudio-plugin", //$NON-NLS-1$ //$NON-NLS-2$ + "rt", "text/richtext", //$NON-NLS-1$ //$NON-NLS-2$ + "rt", "text/vnd.rn-realtext", //$NON-NLS-1$ //$NON-NLS-2$ + "rtf", "application/rtf", //$NON-NLS-1$ //$NON-NLS-2$ + "rtf", "application/x-rtf", //$NON-NLS-1$ //$NON-NLS-2$ + "rtf", "text/richtext", //$NON-NLS-1$ //$NON-NLS-2$ + "rtx", "application/rtf", //$NON-NLS-1$ //$NON-NLS-2$ + "rtx", "text/richtext", //$NON-NLS-1$ //$NON-NLS-2$ + "rv", "video/vnd.rn-realvideo", //$NON-NLS-1$ //$NON-NLS-2$ + + "s", "text/x-asm", //$NON-NLS-1$ //$NON-NLS-2$ + "s3m", "audio/s3m", //$NON-NLS-1$ //$NON-NLS-2$ + "saveme", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "sbk", "application/x-tbook", //$NON-NLS-1$ //$NON-NLS-2$ + "scm", "application/x-lotusscreencam", //$NON-NLS-1$ //$NON-NLS-2$ + "scm", "text/x-script.guile", //$NON-NLS-1$ //$NON-NLS-2$ + "scm", "text/x-script.scheme", //$NON-NLS-1$ //$NON-NLS-2$ + "scm", "video/x-scm", //$NON-NLS-1$ //$NON-NLS-2$ + "sdml", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "sdp", "application/sdp", //$NON-NLS-1$ //$NON-NLS-2$ + "sdp", "application/x-sdp", //$NON-NLS-1$ //$NON-NLS-2$ + "sdr", "application/sounder", //$NON-NLS-1$ //$NON-NLS-2$ + "sea", "application/sea", //$NON-NLS-1$ //$NON-NLS-2$ + "sea", "application/x-sea", //$NON-NLS-1$ //$NON-NLS-2$ + "set", "application/set", //$NON-NLS-1$ //$NON-NLS-2$ + "sgm", "text/sgml", //$NON-NLS-1$ //$NON-NLS-2$ + "sgm", "text/x-sgml", //$NON-NLS-1$ //$NON-NLS-2$ + "sgml", "text/sgml", //$NON-NLS-1$ //$NON-NLS-2$ + "sgml", "text/x-sgml", //$NON-NLS-1$ //$NON-NLS-2$ + "sh", "application/x-bsh", //$NON-NLS-1$ //$NON-NLS-2$ + "sh", "application/x-sh", //$NON-NLS-1$ //$NON-NLS-2$ + "sh", "application/x-shar", //$NON-NLS-1$ //$NON-NLS-2$ + "sh", "text/x-script.sh", //$NON-NLS-1$ //$NON-NLS-2$ + "shar", "application/x-bsh", //$NON-NLS-1$ //$NON-NLS-2$ + "shar", "application/x-shar", //$NON-NLS-1$ //$NON-NLS-2$ + "shtml", "text/html", //$NON-NLS-1$ //$NON-NLS-2$ + "shtml", "text/x-server-parsed-html", //$NON-NLS-1$ //$NON-NLS-2$ + "sid", "audio/x-psid", //$NON-NLS-1$ //$NON-NLS-2$ + "sit", "application/x-sit", //$NON-NLS-1$ //$NON-NLS-2$ + "sit", "application/x-stuffit", //$NON-NLS-1$ //$NON-NLS-2$ + "skd", "application/x-koan", //$NON-NLS-1$ //$NON-NLS-2$ + "skm", "application/x-koan", //$NON-NLS-1$ //$NON-NLS-2$ + "skp", "application/x-koan", //$NON-NLS-1$ //$NON-NLS-2$ + "skt", "application/x-koan", //$NON-NLS-1$ //$NON-NLS-2$ + "sl", "application/x-seelogo", //$NON-NLS-1$ //$NON-NLS-2$ + "smi", "application/smil", //$NON-NLS-1$ //$NON-NLS-2$ + "smil", "application/smil", //$NON-NLS-1$ //$NON-NLS-2$ + "snd", "audio/basic", //$NON-NLS-1$ //$NON-NLS-2$ + "snd", "audio/x-adpcm", //$NON-NLS-1$ //$NON-NLS-2$ + "sol", "application/solids", //$NON-NLS-1$ //$NON-NLS-2$ + "spc", "application/x-pkcs7-certificates", //$NON-NLS-1$ //$NON-NLS-2$ + "spc", "text/x-speech", //$NON-NLS-1$ //$NON-NLS-2$ + "spl", "application/futuresplash", //$NON-NLS-1$ //$NON-NLS-2$ + "spr", "application/x-sprite", //$NON-NLS-1$ //$NON-NLS-2$ + "sprite", "application/x-sprite", //$NON-NLS-1$ //$NON-NLS-2$ + "src", "application/x-wais-source", //$NON-NLS-1$ //$NON-NLS-2$ + "ssi", "text/x-server-parsed-html", //$NON-NLS-1$ //$NON-NLS-2$ + "ssm", "application/streamingmedia", //$NON-NLS-1$ //$NON-NLS-2$ + "sst", "application/vnd.ms-pki.certstore", //$NON-NLS-1$ //$NON-NLS-2$ + "step", "application/step", //$NON-NLS-1$ //$NON-NLS-2$ + "stl", "application/sla", //$NON-NLS-1$ //$NON-NLS-2$ + "stl", "application/vnd.ms-pki.stl", //$NON-NLS-1$ //$NON-NLS-2$ + "stl", "application/x-navistyle", //$NON-NLS-1$ //$NON-NLS-2$ + "stp", "application/step", //$NON-NLS-1$ //$NON-NLS-2$ + "sv4cpio", "application/x-sv4cpio", //$NON-NLS-1$ //$NON-NLS-2$ + "sv4crc", "application/x-sv4crc", //$NON-NLS-1$ //$NON-NLS-2$ + "svf", "image/vnd.dwg", //$NON-NLS-1$ //$NON-NLS-2$ + "svf", "image/x-dwg", //$NON-NLS-1$ //$NON-NLS-2$ + "svr", "application/x-world", //$NON-NLS-1$ //$NON-NLS-2$ + "svr", "x-world/x-svr", //$NON-NLS-1$ //$NON-NLS-2$ + "swf", "application/x-shockwave-flash", //$NON-NLS-1$ //$NON-NLS-2$ + + "t", "application/x-troff", //$NON-NLS-1$ //$NON-NLS-2$ + "talk", "text/x-speech", //$NON-NLS-1$ //$NON-NLS-2$ + "tar", "application/x-tar", //$NON-NLS-1$ //$NON-NLS-2$ + "tbk", "application/toolbook", //$NON-NLS-1$ //$NON-NLS-2$ + "tbk", "application/x-tbook", //$NON-NLS-1$ //$NON-NLS-2$ + "tcl", "application/x-tcl", //$NON-NLS-1$ //$NON-NLS-2$ + "tcl", "text/x-script.tcl", //$NON-NLS-1$ //$NON-NLS-2$ + "tcsh", "text/x-script.tcsh", //$NON-NLS-1$ //$NON-NLS-2$ + "tex", "application/x-tex", //$NON-NLS-1$ //$NON-NLS-2$ + "texi", "application/x-texinfo", //$NON-NLS-1$ //$NON-NLS-2$ + "texinfo", "application/x-texinfo", //$NON-NLS-1$ //$NON-NLS-2$ + "text", "application/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "text", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + "tgz", "application/gnutar", //$NON-NLS-1$ //$NON-NLS-2$ + "tgz", "application/x-compressed", //$NON-NLS-1$ //$NON-NLS-2$ + "tif", "image/tiff", //$NON-NLS-1$ //$NON-NLS-2$ + "tif", "image/x-tiff", //$NON-NLS-1$ //$NON-NLS-2$ + "tiff", "image/tiff", //$NON-NLS-1$ //$NON-NLS-2$ + "tiff", "image/x-tiff", //$NON-NLS-1$ //$NON-NLS-2$ + "tr", "application/x-troff", //$NON-NLS-1$ //$NON-NLS-2$ + "tsi", "audio/tsp-audio", //$NON-NLS-1$ //$NON-NLS-2$ + "tsp", "application/dsptype", //$NON-NLS-1$ //$NON-NLS-2$ + "tsp", "audio/tsplayer", //$NON-NLS-1$ //$NON-NLS-2$ + "tsv", "text/tab-separated-values", //$NON-NLS-1$ //$NON-NLS-2$ + "turbot", "image/florian", //$NON-NLS-1$ //$NON-NLS-2$ + "txt", "text/plain", //$NON-NLS-1$ //$NON-NLS-2$ + + "uil", "text/x-uil", //$NON-NLS-1$ //$NON-NLS-2$ + "uni", "text/uri-list", //$NON-NLS-1$ //$NON-NLS-2$ + "unis", "text/uri-list", //$NON-NLS-1$ //$NON-NLS-2$ + "unv", "application/i-deas", //$NON-NLS-1$ //$NON-NLS-2$ + "uri", "text/uri-list", //$NON-NLS-1$ //$NON-NLS-2$ + "uris", "text/uri-list", //$NON-NLS-1$ //$NON-NLS-2$ + "ustar", "application/x-ustar", //$NON-NLS-1$ //$NON-NLS-2$ + "ustar", "multipart/x-ustar", //$NON-NLS-1$ //$NON-NLS-2$ + "uu", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "uu", "text/x-uuencode", //$NON-NLS-1$ //$NON-NLS-2$ + "uue", "text/x-uuencode", //$NON-NLS-1$ //$NON-NLS-2$ + + "vcd", "application/x-cdlink", //$NON-NLS-1$ //$NON-NLS-2$ + "vcs", "text/x-vcalendar", //$NON-NLS-1$ //$NON-NLS-2$ + "vda", "application/vda", //$NON-NLS-1$ //$NON-NLS-2$ + "vdo", "video/vdo", //$NON-NLS-1$ //$NON-NLS-2$ + "vew", "application/groupwise", //$NON-NLS-1$ //$NON-NLS-2$ + "viv", "video/vivo", //$NON-NLS-1$ //$NON-NLS-2$ + "viv", "video/vnd.vivo", //$NON-NLS-1$ //$NON-NLS-2$ + "vivo", "video/vivo", //$NON-NLS-1$ //$NON-NLS-2$ + "vivo", "video/vnd.vivo", //$NON-NLS-1$ //$NON-NLS-2$ + "vmd", "application/vocaltec-media-desc", //$NON-NLS-1$ //$NON-NLS-2$ + "vmf", "application/vocaltec-media-file", //$NON-NLS-1$ //$NON-NLS-2$ + "voc", "audio/voc", //$NON-NLS-1$ //$NON-NLS-2$ + "voc", "audio/x-voc", //$NON-NLS-1$ //$NON-NLS-2$ + "vos", "video/vosaic", //$NON-NLS-1$ //$NON-NLS-2$ + "vox", "audio/voxware", //$NON-NLS-1$ //$NON-NLS-2$ + "vqe", "audio/x-twinvq-plugin", //$NON-NLS-1$ //$NON-NLS-2$ + "vqf", "audio/x-twinvq", //$NON-NLS-1$ //$NON-NLS-2$ + "vql", "audio/x-twinvq-plugin", //$NON-NLS-1$ //$NON-NLS-2$ + "vrml", "application/x-vrml", //$NON-NLS-1$ //$NON-NLS-2$ + "vrml", "model/vrml", //$NON-NLS-1$ //$NON-NLS-2$ + "vrml", "x-world/x-vrml", //$NON-NLS-1$ //$NON-NLS-2$ + "vrt", "x-world/x-vrt", //$NON-NLS-1$ //$NON-NLS-2$ + "vsd", "application/x-visio", //$NON-NLS-1$ //$NON-NLS-2$ + "vst", "application/x-visio", //$NON-NLS-1$ //$NON-NLS-2$ + "vsw", "application/x-visio", //$NON-NLS-1$ //$NON-NLS-2$ + + "w60", "application/wordperfect6.0", //$NON-NLS-1$ //$NON-NLS-2$ + "w61", "application/wordperfect6.1", //$NON-NLS-1$ //$NON-NLS-2$ + "w6w", "application/msword", //$NON-NLS-1$ //$NON-NLS-2$ + "wav", "audio/wav", //$NON-NLS-1$ //$NON-NLS-2$ + "wav", "audio/x-wav", //$NON-NLS-1$ //$NON-NLS-2$ + "wb1", "application/x-qpro", //$NON-NLS-1$ //$NON-NLS-2$ + "wbmp", "image/vnd.wap.wbmp", //$NON-NLS-1$ //$NON-NLS-2$ + "web", "application/vnd.xara", //$NON-NLS-1$ //$NON-NLS-2$ + "wiz", "application/msword", //$NON-NLS-1$ //$NON-NLS-2$ + "wk1", "application/x-123", //$NON-NLS-1$ //$NON-NLS-2$ + "wmf", "windows/metafile", //$NON-NLS-1$ //$NON-NLS-2$ + "wml", "text/vnd.wap.wml", //$NON-NLS-1$ //$NON-NLS-2$ + "wmlc", "application/vnd.wap.wmlc", //$NON-NLS-1$ //$NON-NLS-2$ + "wmls", "text/vnd.wap.wmlscript", //$NON-NLS-1$ //$NON-NLS-2$ + "wmlsc", "application/vnd.wap.wmlscriptc", //$NON-NLS-1$ //$NON-NLS-2$ + "word", "application/msword", //$NON-NLS-1$ //$NON-NLS-2$ + "wpd", "application/x-wpwin", //$NON-NLS-1$ //$NON-NLS-2$ + "wq1", "application/x-lotus", //$NON-NLS-1$ //$NON-NLS-2$ + "wri", "application/mswrite", //$NON-NLS-1$ //$NON-NLS-2$ + "wri", "application/x-wri", //$NON-NLS-1$ //$NON-NLS-2$ + "wrl", "application/x-world", //$NON-NLS-1$ //$NON-NLS-2$ + "wrl", "model/vrml", //$NON-NLS-1$ //$NON-NLS-2$ + "wrl", "x-world/x-vrml", //$NON-NLS-1$ //$NON-NLS-2$ + "wrz", "model/vrml", //$NON-NLS-1$ //$NON-NLS-2$ + "wrz", "x-world/x-vrml", //$NON-NLS-1$ //$NON-NLS-2$ + "wsc", "text/scriplet", //$NON-NLS-1$ //$NON-NLS-2$ + "wsrc", "application/x-wais-source", //$NON-NLS-1$ //$NON-NLS-2$ + "wtk", "application/x-wintalk", //$NON-NLS-1$ //$NON-NLS-2$ + "xbm", "image/x-xbitmap", //$NON-NLS-1$ //$NON-NLS-2$ + "xbm", "image/x-xbm", //$NON-NLS-1$ //$NON-NLS-2$ + "xbm", "image/xbm", //$NON-NLS-1$ //$NON-NLS-2$ + "xdr", "video/x-amt-demorun", //$NON-NLS-1$ //$NON-NLS-2$ + "xgz", "xgl/drawing", //$NON-NLS-1$ //$NON-NLS-2$ + "xif", "image/vnd.xiff", //$NON-NLS-1$ //$NON-NLS-2$ + "xl", "application/excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xla", "application/excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xla", "application/x-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xla", "application/x-msexcel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlb", "application/excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlb", "application/vnd.ms-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlb", "application/x-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlc", "application/excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlc", "application/vnd.ms-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlc", "application/x-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xld", "application/excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xld", "application/x-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlk", "application/excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlk", "application/x-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xll", "application/excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xll", "application/vnd.ms-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xll", "application/x-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlm", "application/excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlm", "application/vnd.ms-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlm", "application/x-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xls", "application/excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xls", "application/vnd.ms-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xls", "application/x-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xls", "application/x-msexcel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlt", "application/excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlt", "application/x-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlv", "application/excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlv", "application/x-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlw", "application/excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlw", "application/vnd.ms-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlw", "application/x-excel", //$NON-NLS-1$ //$NON-NLS-2$ + "xlw", "application/x-msexcel", //$NON-NLS-1$ //$NON-NLS-2$ + "xm", "audio/xm", //$NON-NLS-1$ //$NON-NLS-2$ + "xml", "application/xml", //$NON-NLS-1$ //$NON-NLS-2$ + "xml", "text/xml", //$NON-NLS-1$ //$NON-NLS-2$ + "xmz", "xgl/movie", //$NON-NLS-1$ //$NON-NLS-2$ + "xpix", "application/x-vnd.ls-xpix", //$NON-NLS-1$ //$NON-NLS-2$ + "xpm", "image/x-xpixmap", //$NON-NLS-1$ //$NON-NLS-2$ + "xpm", "image/xpm", //$NON-NLS-1$ //$NON-NLS-2$ + "x-png", "image/png", //$NON-NLS-1$ //$NON-NLS-2$ + "xsr", "video/x-amt-showrun", //$NON-NLS-1$ //$NON-NLS-2$ + "xwd", "image/x-xwd", //$NON-NLS-1$ //$NON-NLS-2$ + "xwd", "image/x-xwindowdump", //$NON-NLS-1$ //$NON-NLS-2$ + "xyz", "chemical/x-pdb", //$NON-NLS-1$ //$NON-NLS-2$ + + "z", "application/x-compress", //$NON-NLS-1$ //$NON-NLS-2$ + "z", "application/x-compressed", //$NON-NLS-1$ //$NON-NLS-2$ + "zip", "application/x-compressed", //$NON-NLS-1$ //$NON-NLS-2$ + "zip", "application/x-zip-compressed", //$NON-NLS-1$ //$NON-NLS-2$ + "zip", "application/zip", //$NON-NLS-1$ //$NON-NLS-2$ + "zip", "multipart/x-zip", //$NON-NLS-1$ //$NON-NLS-2$ + "zoo", "application/octet-stream", //$NON-NLS-1$ //$NON-NLS-2$ + "zsh", "text/x-script.zsh", //$NON-NLS-1$ //$NON-NLS-2$ + }; +} \ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/SecureAction.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/SecureAction.java new file mode 100755 index 000000000..74b11036b --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/SecureAction.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2003, 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.p2.testserver; + +import java.io.IOException; +import java.net.URL; +import java.net.URLConnection; +import java.security.*; +import org.osgi.framework.Bundle; + +/** + * Utility class to execute common privileged code. + */ +public class SecureAction { + // make sure we use the correct controlContext; + private AccessControlContext controlContext; + + /** + * Constructs a new SecureAction object. The constructed SecureAction object + * uses the caller's AccessControlContext to perform security checks + */ + public SecureAction() { + // save the control context to be used. + this.controlContext = AccessController.getContext(); + } + + /** + * Gets a resource from a bundle. + * @param bundle the bundle to get the resource from + * @param name The name of the resource + * @return The URL of the resource + */ + + public URL getBundleResource(final Bundle bundle, final String name) { + if (System.getSecurityManager() == null) + return bundle.getResource(name); + return (URL) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return bundle.getResource(name); + } + }, controlContext); + } + + public URLConnection openURL(final URL url) throws IOException { + if (System.getSecurityManager() == null) + return open(url); + try { + return (URLConnection) AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws IOException { + return open(url); + } + }, controlContext); + } catch(PrivilegedActionException ex) { + throw (IOException) ex.getException(); + } + } + + URLConnection open(final URL url)throws IOException + { + URLConnection connection = url.openConnection(); + connection.connect(); /* establish connection to check permissions */ + return connection; + } + + /** + * Returns a system property. Same as calling + * System.getProperty(String,String). + * @param property the property key. + * @param def the default value if the property key does not exist. + * @return the value of the property or the def value if the property + * does not exist. + */ + public String getProperty(final String property, final String def) { + if (System.getSecurityManager() == null) + return System.getProperty(property, def); + return (String) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty(property, def); + } + }, controlContext); + } + +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/SecureContext.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/SecureContext.java new file mode 100644 index 000000000..a9fc4e5f4 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/SecureContext.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.p2.testserver; + +import java.net.URL; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.osgi.service.http.HttpContext; + +/** + * The SecureContext can be used to add basic authentication to a path. + * This implementation requires the user "Aladdin" to log in with the password "open sesame". + */ +public class SecureContext implements HttpContext { + private HttpContext theDefaultContext; + + public SecureContext(HttpContext defaultContext) { + theDefaultContext = defaultContext; + } + + public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) { + String auth = request.getHeader("Authorization"); //$NON-NLS-1$ + // Response is Aladdin:open sesame in Base64 encoding (from RFC example) + if (auth != null && "QWxhZGRpbjpvcGVuIHNlc2FtZQ==".equals(auth.substring(6))) //$NON-NLS-1$ + return true; + + // if not authorized or wrong user/password + response.setHeader("WWW-Authenticate", "BASIC realm=\"p2 Http Testing Server (Aladdin, open sesame)\""); //$NON-NLS-1$//$NON-NLS-2$ + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + return false; + + } + + public String getMimeType(String name) { + return theDefaultContext.getMimeType(name); + } + + public URL getResource(String name) { + return theDefaultContext.getResource(name); + } + +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/BasicResourceDelivery.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/BasicResourceDelivery.java new file mode 100644 index 000000000..62cf0a9f0 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/BasicResourceDelivery.java @@ -0,0 +1,317 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Cloudsmith Inc. - this copy and adaption to abstract servlet + *******************************************************************************/ +package org.eclipse.equinox.p2.testserver.servlets; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLConnection; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.eclipse.equinox.p2.testserver.Activator; +import org.eclipse.equinox.p2.testserver.HttpConstants; +import org.eclipse.equinox.p2.testserver.MimeLookup; +import org.eclipse.equinox.p2.testserver.SecureAction; +import org.osgi.service.http.HttpService; + +public class BasicResourceDelivery extends HttpServlet { + private static final long serialVersionUID = 1L; + // private static final String CHARSET = "utf-8"; //$NON-NLS-1$ + private SecureAction secureAction; + private String alias; + private URI path; + protected static final String defaultMimeType = "application/octet-stream"; //$NON-NLS-1$ + + /** + * Delivers resources from the bundle, or from an absolute URI + */ + public BasicResourceDelivery(String theAlias, URI thePath) { + secureAction = new SecureAction(); + alias = theAlias; + path = thePath; + } + + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + URI resource = null; + try { + resource = getFilename(request.getRequestURI()); + } catch (URISyntaxException e) { + /* ignore - just leave resource == null */ + } + + URL url = null; + if (resource != null) { + if (!resource.isAbsolute()) + url = getServletContext().getResource(resource.getPath()); + else + url = resource.toURL(); + } + + if (url == null) { + fileNotFound(resource, request, response); + return; + } + + // process cache control + URLConnection conn = secureAction.openURL(url); + + long modifiedSince = request.getDateHeader("If-Modified-Since"); //$NON-NLS-1$ + if (modifiedSince >= 0) { + long modified = getLastModified(conn); + if ((modified > 0) && (modifiedSince >= modified)) { + response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); + return; + } + } + InputStream in; + try { + in = conn.getInputStream(); + } catch (IOException ex) { + fileNotFound(resource, request, response); + return; + } + try { + // always set the default charset + // not in Servlet 2.1 // response.setCharacterEncoding(CHARSET); + deliver(conn, in, resource.toString(), request, response); // TODO: modify to resource==URI ? + } finally { + in.close(); + } + } + + protected void deliver(URLConnection conn, InputStream in, String filename, HttpServletRequest request, HttpServletResponse response) throws IOException { + this.doDeliver(conn, in, filename, request, response); + } + + /** + * Default method delivering content from a file. Subclasses should override this method + * to deliver "broken content" (e.g. truncated, mismatched content length etc.). + * This default method performs the same delivery as the default "register resource" in the + * http service. + * @param conn - The URLConnection to the resource + * @param in - InputStream to read from + * @param filename - the filename being read + * @param request - the servlet request + * @param response - the servlet response + * @throws IOException - on errors + */ + protected void doDeliver(URLConnection conn, InputStream in, String filename, HttpServletRequest request, HttpServletResponse response) throws IOException { + long modified = conn.getLastModified(); + // set when the resource was modified + addDateHeader(response, HttpConstants.LAST_MODIFIED, modified); + + int contentlength = getContentLength(conn); + if (contentlength >= 0) { + response.setContentLength(contentlength); + + String mimeType = computeMimeType(filename, conn); + response.setContentType(mimeType); + + // We want to use a writer if we are sending text + if (mimeType.startsWith("text/")) //$NON-NLS-1$ + { + PrintWriter writer = response.getWriter(); + + writer.flush(); /* write the headers and unbuffer the output */ + + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + + char buffer[] = new char[4096]; + int read; + while ((read = reader.read(buffer, 0, buffer.length)) != -1) { + writer.write(buffer, 0, read); + } + } else { + ServletOutputStream out = response.getOutputStream(); + + out.flush(); /* write the headers and unbuffer the output */ + + byte buffer[] = new byte[4096]; + int read; + while ((read = in.read(buffer, 0, buffer.length)) != -1) { + out.write(buffer, 0, read); + out.flush(); + } + } + } + } + + protected void fileNotFound(URI file, HttpServletRequest request, HttpServletResponse response) throws IOException { + response.sendError(HttpServletResponse.SC_NOT_FOUND, (file == null ? "" : file.toString()) + " not found"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + protected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + URI resource = null; + try { + resource = getFilename(request.getRequestURI()); + } catch (URISyntaxException e) { + /* ignore - just leave resource == null */ + } + + URL url = null; + if (resource != null) { + if (!resource.isAbsolute()) + url = getServletContext().getResource(resource.getPath()); + else + url = resource.toURL(); + } + + if (url == null) { + fileNotFound(resource, request, response); + return; + } + URLConnection conn = secureAction.openURL(url); + // always set default charset + // Not in Servlet 2.1 // response.setCharacterEncoding(CHARSET); + doDeliverHead(resource.toString(), conn, request, response); // TODO: change API to use URI? + } + + protected void deliverHead(String filename, URLConnection conn, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + this.doDeliverHead(filename, conn, request, response); + } + + protected void doDeliverHead(String filename, URLConnection conn, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + int contentlength = getContentLength(conn); + if (contentlength >= 0) { + response.setContentLength(contentlength); + + String mimeType = computeMimeType(filename, conn); + response.setContentType(mimeType); + long modified = getLastModified(conn); + addDateHeader(response, HttpConstants.LAST_MODIFIED, modified); + } else { + super.doHead(request, response); + } + + } + + /** + * Override to lie about last modified + * @param conn + * @return time in ms + */ + protected long getLastModified(URLConnection conn) { + return conn.getLastModified(); + } + + /** + * Override to lie about content length + * @param conn + * @return length in bytes + */ + protected int getContentLength(URLConnection conn) { + return conn.getContentLength(); + } + + protected URI getFilename(String filename) throws URISyntaxException { + //If the requested URI is equal to the Registeration's alias, send the file + //corresponding to the alias. Otherwise, we have request for a file in an + //registered directory (the file was not directly registered itself). + if (filename.equals(alias)) { + filename = path.getPath(); + } else { + // The file we re looking for is the registered resource (alias) + the rest of the + // filename that is not part of the registered resource. For example, if we export + // /a to /tmp and we have a request for /a/b/foo.txt, then /tmp is our directory + // (file.toString()) and /b/foo.txt is the rest. + // The result is that we open the file /tmp/b/foo.txt. + + int aliaslen = alias.length(); + int pathlen = path.getPath().length(); + + if (pathlen == 1) /* path == "/" */ + { + if (aliaslen > 1) /* alias != "/" */ + { + filename = filename.substring(aliaslen); + } + } else /* path != "/" */ + { + StringBuffer buf = new StringBuffer(aliaslen + pathlen); + buf.append(path.getPath()); + + if (aliaslen == 1) /* alias == "/" */ + { + buf.append(filename); + } else /* alias != "/" */ + { + buf.append(filename.substring(aliaslen)); + } + + filename = buf.toString(); + } + } + return new URI(path.getScheme(), path.getUserInfo(), path.getHost(), path.getPort(), filename, path.getQuery(), path.getFragment()); + // return (filename); + } + + /** + * This method returns the correct MIME type of a given URI by first checking + * the HttpContext::getMimeType and, if null, checking the httpservice's MIMETypes table. + * return mimetype with charset=utf-8 for all text/... types + */ + protected String computeMimeType(String name, URLConnection conn) { + String mimeType = computeMimeType2(name, conn); + if (mimeType.startsWith("text/")) //$NON-NLS-1$ + return mimeType + "; charset=utf-8"; //$NON-NLS-1$ + return mimeType; + } + + protected String computeMimeType2(String name, URLConnection conn) { + // use type set in connection if it is available + String mimeType = conn.getContentType(); + if (mimeType != null) { + return (mimeType); + } + // use type from context + mimeType = getServletContext().getMimeType(name); + if (mimeType != null) { + return (mimeType); + } + // try the "extras" + return MimeLookup.getMimeType(name); + } + + public HttpService getHttpService() { + return Activator.getInstance().getHttp(); + } + + public static final DateFormat PATTERN_RFC1123 = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US); //$NON-NLS-1$ + + /** + * Support setting date header - in servlet > 2.1 it is possible to call this method directly on the HttpResponse. + * @param response + * @param name + * @param timestamp + */ + public void addDateHeader(HttpServletResponse response, String name, long timestamp) { + DateFormat df = PATTERN_RFC1123; + // must always be GMT + df.setTimeZone(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$ + response.setHeader(name, df.format(new Date(timestamp))); + + } + +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/ChopAndDelay.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/ChopAndDelay.java new file mode 100644 index 000000000..9359eacb0 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/ChopAndDelay.java @@ -0,0 +1,129 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.p2.testserver.servlets; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.net.URI; +import java.net.URLConnection; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.eclipse.equinox.p2.testserver.LinearChange; + +/** + * The ChopAndDelay deliver the content chopped up in smaller packets and adds delay + * between packets. + * + */ +public class ChopAndDelay extends BasicResourceDelivery { + + int chopFactor; + private LinearChange delayFunction; + private long msDelay; + + /** + * Create a file molester that turns content into gibberish. + * + * @param theAlias the path this servlet is registered under + * @param thePath the path to use as root for the alias + * @param chopFactor - a value between 1 and 12 where 1 is one byte, and 12 is 4k bytes at a time. + * @param delayFunction - function returning a series of delay values + */ + public ChopAndDelay(String theAlias, URI thePath, int chopFactor, LinearChange delayFunction) { + super(theAlias, thePath); + if (chopFactor < 1 || chopFactor > 12) + throw new IllegalArgumentException("chopFactor must be between 1 and 12 (inclusive) - was:" + Integer.valueOf(chopFactor)); //$NON-NLS-1$ + this.chopFactor = chopFactor; + if (msDelay < 0) + throw new IllegalArgumentException("msDelay must be >= 0 - was:" + Integer.valueOf(chopFactor)); //$NON-NLS-1$ + this.delayFunction = delayFunction; + msDelay = 0L; + this.delayFunction = delayFunction; + if (this.delayFunction.hasNext()) + msDelay = delayFunction.next(); + } + + private static final long serialVersionUID = 1L; + + protected void deliver(URLConnection conn, InputStream in, String filename, HttpServletRequest request, HttpServletResponse response) throws IOException { + // chop up all files + doChop(conn, in, filename, request, response); + } + + protected void doChop(URLConnection conn, InputStream in, String filename, HttpServletRequest request, HttpServletResponse response) throws IOException { + LinearChange delayer = delayFunction.fork(); + int contentlength = conn.getContentLength(); + if (contentlength >= 0) { + response.setContentLength(contentlength); + + String mimeType = computeMimeType(filename, conn); + response.setContentType(mimeType); + + // We want to use a writer if we are sending text + if (mimeType.startsWith("text/")) //$NON-NLS-1$ + { + PrintWriter writer = response.getWriter(); + + writer.flush(); /* write the headers and unbuffer the output */ + + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + + int chunksize = 1 << chopFactor; + char buffer[] = new char[4096]; + int read; + while ((read = reader.read(buffer, 0, buffer.length)) != -1) { + int nChunks = read / chunksize + (read % chunksize > 0 ? 1 : 0); + for (int i = 0; i < nChunks; i++) { + writer.write(buffer, i * chunksize, Math.min(chunksize, read - i * chunksize)); + writer.flush(); + if (msDelay > 0) + try { + Thread.sleep(msDelay); + } catch (InterruptedException e) { + // ignore + } + if (delayer.hasNext()) + msDelay = delayer.next(); + } + } + } else { + ServletOutputStream out = response.getOutputStream(); + + out.flush(); /* write the headers and unbuffer the output */ + + int chunksize = 1 << chopFactor; + byte buffer[] = new byte[4096]; + int read; + while ((read = in.read(buffer, 0, buffer.length)) != -1) { + int nChunks = read / chunksize + (read % chunksize > 0 ? 1 : 0); + for (int i = 0; i < nChunks; i++) { + out.write(buffer, i * chunksize, Math.min(chunksize, read - i * chunksize)); + out.flush(); + if (msDelay > 0) + try { + Thread.sleep(msDelay); + } catch (InterruptedException e) { + // ignore + } + if (delayer.hasNext()) + msDelay = delayer.next(); + } + } + } + } + } + +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/ContentLengthLier.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/ContentLengthLier.java new file mode 100644 index 000000000..98a037736 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/ContentLengthLier.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.p2.testserver.servlets; + +import java.net.URI; +import java.net.URLConnection; + +public class ContentLengthLier extends BasicResourceDelivery { + + double keepFactor; + + /** + * The ContentLengthLier sets the content length to a percentage of the original length. + * Values between 0 and 200 can be used (to lie about files being both smaller < 100, or larger > 100). + * + * @param theAlias + * @param thePath + * @param keepPercent - how much to lie between 0 and 200 (inclusive) + */ + public ContentLengthLier(String theAlias, URI thePath, int keepPercent) { + super(theAlias, thePath); + if (keepPercent < 0 || keepPercent > 200) + throw new IllegalArgumentException("keepPercent must be between 0 and 200 - was:" + Integer.valueOf(keepPercent)); //$NON-NLS-1$ + keepFactor = keepPercent / 100.0; + } + + private static final long serialVersionUID = 1L; + + protected int getContentLength(URLConnection conn) { + int contentLength = conn.getContentLength(); + return (contentLength >= 0) ? (int) (contentLength * keepFactor) : contentLength; + + } + +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/FileMolester.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/FileMolester.java new file mode 100644 index 000000000..3a5485230 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/FileMolester.java @@ -0,0 +1,118 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.p2.testserver.servlets; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.net.URI; +import java.net.URLConnection; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * The FileMolester will keep a certain amount of the file from the beginning, and return + * garbage/gibberish for the rest of the file's content. The garbage is produced by shifting every + * byte 1 bit to the left. + * + * The idea for keeping some percentage is to support keeping xml headers / doctype etc. + */ +public class FileMolester extends BasicResourceDelivery { + + int keepLength; + + /** + * Create a file molester that turns content into gibberish. + * + * @param theAlias the path this servlet is registered under + * @param thePath the path to use as root for the alias + * @param keepLength - how many bytes in the beginning that will be unmolested + */ + public FileMolester(String theAlias, URI thePath, int keepLength) { + super(theAlias, thePath); + if (keepLength < 0) + throw new IllegalArgumentException("keepLength must be >= 0 - was:" + Integer.valueOf(keepLength)); //$NON-NLS-1$ + this.keepLength = keepLength; + } + + private static final long serialVersionUID = 1L; + + protected void deliver(URLConnection conn, InputStream in, String filename, HttpServletRequest request, HttpServletResponse response) throws IOException { + // molest all files + doMolest(conn, in, filename, request, response); + } + + protected void doMolest(URLConnection conn, InputStream in, String filename, HttpServletRequest request, HttpServletResponse response) throws IOException { + int contentlength = conn.getContentLength(); + if (contentlength >= 0) { + response.setContentLength(contentlength); + + String mimeType = computeMimeType(filename, conn); + response.setContentType(mimeType); + + // We want to use a writer if we are sending text + if (mimeType.startsWith("text/")) //$NON-NLS-1$ + { + PrintWriter writer = response.getWriter(); + + writer.flush(); /* write the headers and unbuffer the output */ + + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + + char buffer[] = new char[4096]; + int read; + int written = 0; + while ((read = reader.read(buffer, 0, buffer.length)) != -1) { + if (written + read > keepLength) + molest(buffer, written, read); + writer.write(buffer, 0, read); + written += read; + } + } else { + ServletOutputStream out = response.getOutputStream(); + + out.flush(); /* write the headers and unbuffer the output */ + + byte buffer[] = new byte[4096]; + int read; + int written = 0; + while ((read = in.read(buffer, 0, buffer.length)) != -1) { + if (written + read > keepLength) + molest(buffer, written, read); + out.write(buffer, 0, read); + written += read; + } + } + } + } + + /** Molest a char buffer */ + private void molest(char[] buffer, int written, int read) { + int start = keepLength - written; + if (start > read) + return; + for (int i = start < 0 ? 0 : start; i < read; i++) + buffer[i] = (char) (buffer[i] << 1); + } + + /** Molest a byte buffer */ + private void molest(byte[] buffer, int written, int read) { + int start = keepLength - written; + if (start > read) + return; + for (int i = start < 0 ? 0 : start; i < read; i++) + buffer[i] = (byte) (buffer[i] << 1); + } +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/HelloWorld.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/HelloWorld.java new file mode 100644 index 000000000..7bc682803 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/HelloWorld.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.p2.testserver.servlets; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Simple "smoke test" servlet - for manual testing that the http server is running and is + * capable of running servlets. + */ +public class HelloWorld extends HttpServlet { + + private static final long serialVersionUID = 1L; + + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + response.setContentType("text/html"); //$NON-NLS-1$ + PrintWriter writer = response.getWriter(); + writer.println(""); //$NON-NLS-1$ + writer.println(""); //$NON-NLS-1$ + writer.println("Hello, Equinox Embedded HTTP World"); //$NON-NLS-1$ + writer.println("
"); //$NON-NLS-1$ + writer.println(""); //$NON-NLS-1$ + writer.println(""); //$NON-NLS-1$ + } +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/LastModifiedLier.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/LastModifiedLier.java new file mode 100644 index 000000000..4b7da6cbe --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/LastModifiedLier.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.p2.testserver.servlets; + +import java.net.URI; +import java.net.URLConnection; + +/** + * Manipulates the last modified time of serviced files. + * The manipulator will set all modified times to 0 if TYPE_ZERO is used, to 1 if TYPE_OLD is used, + * to the current time if TYPE_NOW is used, and a value 24 hours into the future if TYPE_FUTURE is used. + * (Future values are not allowed in HTTP - the server should guard against them and force the value + * to be no bigger than the response date). + * + */ +public class LastModifiedLier extends BasicResourceDelivery { + + public static final int TYPE_ZERO = 1; + public static final int TYPE_OLD = 2; + public static final int TYPE_NOW = 3; + public static final int TYPE_FUTURE = 4; + + private int type; + + /** + * The ContentLengthLier sets the content length to a percentage of the original length. + * Values between 0 and 200 can be used (to lie about files being both smaller < 100, or larger > 100). + * + * @param theAlias + * @param thePath + * @param timeType - a TYPE_XXX constant defining what time to return + */ + public LastModifiedLier(String theAlias, URI thePath, int timeType) { + super(theAlias, thePath); + if (timeType < TYPE_ZERO || timeType > TYPE_FUTURE) + throw new IllegalArgumentException("unknown timeType, was:" + Integer.valueOf(timeType)); //$NON-NLS-1$ + type = timeType; + } + + private static final long serialVersionUID = 1L; + + protected long getLastModified(URLConnection conn) { + // ignore real value and lie based on constant + return getLastModified(); + } + + private long getLastModified() { + switch (type) { + case TYPE_ZERO : + return 0L; + case TYPE_OLD : + return 1L; + case TYPE_NOW : + return System.currentTimeMillis(); + case TYPE_FUTURE : + return System.currentTimeMillis() + 24 * 60 * 60 * 1000; + } + // should not happen + return 0L; + } +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/StatusCodeResponse.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/StatusCodeResponse.java new file mode 100644 index 000000000..d162dcd75 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/StatusCodeResponse.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.p2.testserver.servlets; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Produces a response with a status code specified in the request URI. + * Requires to be registered for "/status" path. The request is made on the format + * "/status/code/" where code is the HTTP integer status code. The path after /code/ can be + * anything - it is always ignored. + * The response to GET produces HTML text "Requested status: code". + * The response to HEAD just produces the status header response. + * + */ +public class StatusCodeResponse extends HttpServlet { + + private static final long serialVersionUID = 1L; + + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + response.setContentType("text/html"); //$NON-NLS-1$ + PrintWriter writer = response.getWriter(); + doStatus(request, response, writer); + } + + protected void doStatus(HttpServletRequest request, HttpServletResponse response, PrintWriter writer) { + String requestPath = request.getRequestURI(); + String[] result = requestPath.split("/"); //$NON-NLS-1$ + if (result.length < 3 && !"status".equalsIgnoreCase(result[1])) //$NON-NLS-1$ + { + getServletContext().log("Error Servlet requires being configured to get /status/statuscode paths. Example /status/500, got" + requestPath); //$NON-NLS-1$ + return; + } + // get the error code + int errorCode = 0; + try { + errorCode = Integer.parseInt(result[2]); + } catch (NumberFormatException e) { + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + getServletContext().log("Number format exception in /status/statuscode path.", e); //$NON-NLS-1$ + return; + } + + // set the errorCode as the response and write a message + response.setStatus(errorCode); + if (writer != null) + htmlPage(writer, "Requested Status: " + Integer.valueOf(errorCode), false); //$NON-NLS-1$ + } + + public void doHead(HttpServletRequest request, HttpServletResponse response) { + // produce same reponse as for GET, but no content (writer == null) + doStatus(request, response, null); + } + + private void htmlPage(PrintWriter writer, String body, boolean consoleOutput) { + if (consoleOutput) + System.err.println(body); + + writer.println(""); //$NON-NLS-1$ + writer.println(""); //$NON-NLS-1$ + writer.println(body); + writer.println("
"); //$NON-NLS-1$ + writer.println(""); //$NON-NLS-1$ + writer.println(""); //$NON-NLS-1$ + writer.flush(); + } +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/TimeOut.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/TimeOut.java new file mode 100644 index 000000000..ea56102bb --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/TimeOut.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.p2.testserver.servlets; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * This servlet is a "black hole" - it just sleeps for an hour on any request. + * + */ +public class TimeOut extends HttpServlet { + + private static final long serialVersionUID = 1L; + private static long MINUTES_MS = 1000 * 60; // minutes in ms + + protected void doGet(HttpServletRequest request, HttpServletResponse response) { + doDelay(); + } + + private void doDelay() { + // Do nothing... + try { + Thread.sleep(60 * MINUTES_MS); // sleep 1 hour + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + protected void doHead(HttpServletRequest request, HttpServletResponse response) { + doDelay(); + } + +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/Truncator.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/Truncator.java new file mode 100644 index 000000000..17c4bf636 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/servlets/Truncator.java @@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) 2009, Cloudsmith Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.p2.testserver.servlets; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.net.URI; +import java.net.URLConnection; +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class Truncator extends BasicResourceDelivery { + + double keepFactor; + + public Truncator(String theAlias, URI thePath, int keepPercent) { + super(theAlias, thePath); + if (keepPercent < 0 || keepPercent > 100) + throw new IllegalArgumentException("keepPercent must be between 0 and 100 - was:" + Integer.valueOf(keepPercent)); //$NON-NLS-1$ + keepFactor = keepPercent / 100.0; + } + + private static final long serialVersionUID = 1L; + + protected void deliver(URLConnection conn, InputStream in, String filename, HttpServletRequest request, HttpServletResponse response) throws IOException { + // truncate all files + doTruncate(conn, in, filename, request, response); + } + + protected void doTruncate(URLConnection conn, InputStream in, String filename, HttpServletRequest request, HttpServletResponse response) throws IOException { + int contentlength = conn.getContentLength(); + if (contentlength >= 0) { + response.setContentLength(contentlength); + + String mimeType = computeMimeType(filename, conn); + response.setContentType(mimeType); + + // We want to use a writer if we are sending text + if (mimeType.startsWith("text/")) //$NON-NLS-1$ + { + PrintWriter writer = response.getWriter(); + + writer.flush(); /* write the headers and unbuffer the output */ + + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + + char buffer[] = new char[4096]; + int read; + int written = 0; + while ((read = reader.read(buffer, 0, buffer.length)) != -1) { + read = cap(contentlength, written, read); + writer.write(buffer, 0, read); + written += read; + } + } else { + ServletOutputStream out = response.getOutputStream(); + + out.flush(); /* write the headers and unbuffer the output */ + + byte buffer[] = new byte[4096]; + int read; + int written = 0; + while ((read = in.read(buffer, 0, buffer.length)) != -1) { + read = cap(contentlength, written, read); + out.write(buffer, 0, read); + written += read; + } + } + } + } + + /** + * Returns read if entire amount should be read. Returns a lower number if + * written + read > keepPercent of total + * @param total + * @param written + * @param read + * @return read, or a lower number if cap is reached + */ + private int cap(int total, int written, int read) { + int cap = (int) (keepFactor * total); + return (read + written) > cap ? cap - written : read; + } + + protected void deliverHead(String filename, URLConnection conn, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + // deliver normal head response + super.doDeliverHead(filename, conn, request, response); + + } + +} diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/artifacts.xml b/bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/artifacts.xml new file mode 100644 index 000000000..19e55d746 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/artifacts.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/features/aaFeature_1.0.0.jar b/bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/features/aaFeature_1.0.0.jar new file mode 100644 index 000000000..f800a9ad2 Binary files /dev/null and b/bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/features/aaFeature_1.0.0.jar differ diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/plugins/aaPlugin_1.0.0.jar b/bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/plugins/aaPlugin_1.0.0.jar new file mode 100644 index 000000000..65ff62b79 Binary files /dev/null and b/bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/plugins/aaPlugin_1.0.0.jar differ diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/readme.txt b/bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/readme.txt new file mode 100644 index 000000000..6fcc19b18 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/webfiles/ar/simple/readme.txt @@ -0,0 +1,2 @@ +This is a very simple artifact repository containing a single group IU (a feature), and +a single bundle IU. This repository is used by ArtifactRepositoryManagerTest \ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/index.html b/bundles/org.eclipse.equinox.p2.testserver/webfiles/index.html new file mode 100644 index 000000000..ce54eb75c --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/webfiles/index.html @@ -0,0 +1,41 @@ + + +

Welcome to the p2 test server

+

You can access all files under the "webfiles" folder in this bundle via either a "public" or "private" +pseudoroot. Try the public link here

+

To access using a login, password, you simply use the pseudoroot "/private", and you will be asked to +log in. The credentials are: user: Aladdin, password: open sesame. Try it +here

+

The following real content is registered:

+ +

The content listed below is also available and can be accessed under: +

+

Content

+ +

The following two URL's are also available

+ + + \ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/index.xml b/bundles/org.eclipse.equinox.p2.testserver/webfiles/index.xml new file mode 100644 index 000000000..9e25031b4 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/webfiles/index.xml @@ -0,0 +1,10 @@ + + +

Welcome to the p2 test server

+

You can access all files under the "webfiles" folder in this bundle via either a "public" or "private" +pseudoroot. Try the public link here

+

To access using a login, password, you simply use the pseudoroot "/private", and you will be asked to +log in. The credentials are: user: Aladdin, password: open sesame. Try it +here

+ + \ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/mdr/composite/compositeContent.xml b/bundles/org.eclipse.equinox.p2.testserver/webfiles/mdr/composite/compositeContent.xml new file mode 100644 index 000000000..af4be35bc --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/webfiles/mdr/composite/compositeContent.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/mdr/composite/one/content.xml b/bundles/org.eclipse.equinox.p2.testserver/webfiles/mdr/composite/one/content.xml new file mode 100644 index 000000000..41f172f48 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/webfiles/mdr/composite/one/content.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + (org.eclipse.update.install.features=true) + + + + + + + + + true + + + + + + [Enter License Description here.] + + + + [Enter Copyright Description here.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (org.eclipse.update.install.features=true) + + + + + + + [Enter License Description here.] + + + + [Enter Copyright Description here.] + + + + + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/mdr/composite/two/content.xml b/bundles/org.eclipse.equinox.p2.testserver/webfiles/mdr/composite/two/content.xml new file mode 100644 index 000000000..fd315dbb3 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/webfiles/mdr/composite/two/content.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + (org.eclipse.update.install.features=true) + + + + + + + + + true + + + + + + [Enter License Description here.] + + + + [Enter Copyright Description here.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (org.eclipse.update.install.features=true) + + + + + + + [Enter License Description here.] + + + + [Enter Copyright Description here.] + + + + + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/features/test.feature_1.0.0.jar b/bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/features/test.feature_1.0.0.jar new file mode 100644 index 000000000..80bbc69fd Binary files /dev/null and b/bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/features/test.feature_1.0.0.jar differ diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/plugins/test.bundle_1.0.0.jar b/bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/plugins/test.bundle_1.0.0.jar new file mode 100644 index 000000000..00dd829d8 Binary files /dev/null and b/bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/plugins/test.bundle_1.0.0.jar differ diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/plugins/test.fragment_1.0.0.jar b/bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/plugins/test.fragment_1.0.0.jar new file mode 100644 index 000000000..d033e2eda Binary files /dev/null and b/bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/plugins/test.fragment_1.0.0.jar differ diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/site.xml b/bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/site.xml new file mode 100644 index 000000000..4e619773e --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.testserver/webfiles/updatesite/site.xml @@ -0,0 +1,4 @@ + + + + -- cgit v1.2.3