diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.http.jetty')
19 files changed, 1788 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.http.jetty/.classpath b/bundles/org.eclipse.equinox.http.jetty/.classpath new file mode 100644 index 000000000..64c5e31b7 --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/bundles/org.eclipse.equinox.http.jetty/.project b/bundles/org.eclipse.equinox.http.jetty/.project new file mode 100644 index 000000000..184df49c4 --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/.project @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.equinox.http.jetty</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> + </natures> +</projectDescription> diff --git a/bundles/org.eclipse.equinox.http.jetty/.settings/.api_filters b/bundles/org.eclipse.equinox.http.jetty/.settings/.api_filters new file mode 100644 index 000000000..4d2c856a1 --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/.settings/.api_filters @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.equinox.http.jetty" version="2">
+ <resource path="META-INF/MANIFEST.MF">
+ <filter comment="Increased minor version since API has been deprecated" id="926941240">
+ <message_arguments>
+ <message_argument value="3.4.0"/>
+ <message_argument value="3.3.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/bundles/org.eclipse.equinox.http.jetty/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.http.jetty/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..449cf187f --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,328 @@ +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.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=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +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=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +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=error +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +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.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.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +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.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +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.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +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.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.5 +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_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.http.jetty/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.http.jetty/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..2939a483a --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,57 @@ +#Tue Aug 21 11:29:42 CDT 2007 +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=3 +org.eclipse.jdt.ui.staticondemandthreshold=3 +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.correct_indentation=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.http.jetty/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.http.jetty/META-INF/MANIFEST.MF new file mode 100644 index 000000000..e020e9b83 --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/META-INF/MANIFEST.MF @@ -0,0 +1,31 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %bundleName +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-SymbolicName: org.eclipse.equinox.http.jetty +Bundle-Version: 3.4.0.qualifier +Bundle-Activator: org.eclipse.equinox.http.jetty.internal.Activator +Import-Package: javax.servlet;version="[2.6.0,4.0.0)", + javax.servlet.http;version="[2.6.0,4.0.0)", + org.eclipse.equinox.http.servlet;version="[1.2.0,2.0.0)", + org.eclipse.jetty.http;version="[9.4.0,10.0.0)", + org.eclipse.jetty.server;version="[9.4.0,10.0.0)", + org.eclipse.jetty.server.handler;version="[9.4.0,10.0.0)", + org.eclipse.jetty.server.nio;version="[9.4.0,10.0.0)", + org.eclipse.jetty.server.session;version="[9.4.0,10.0.0)", + org.eclipse.jetty.servlet;version="[9.4.0,10.0.0)", + org.eclipse.jetty.util;version="[9.4.0,10.0.0)", + org.eclipse.jetty.util.component;version="[9.4.0,10.0.0)", + org.eclipse.jetty.util.log;version="[9.4.0,10.0.0)", + org.eclipse.jetty.util.ssl;version="[9.4.0,10.0.0)", + org.eclipse.jetty.util.thread;version="[9.4.0,10.0.0)", + org.osgi.framework;version="1.3.0", + org.osgi.framework.startlevel;version="1.0.0", + org.osgi.framework.wiring;version="1.2.0", + org.osgi.service.cm;version="1.2.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: org.eclipse.equinox.http.jetty;version="1.4.0" +Comment-Header: Both Eclipse-LazyStart and Bundle-ActivationPolicy are specified for compatibility with 3.2 +Eclipse-LazyStart: true +Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.equinox.http.jetty/OSGI-INF/metatype/config.xml b/bundles/org.eclipse.equinox.http.jetty/OSGI-INF/metatype/config.xml new file mode 100644 index 000000000..61b1fb3be --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/OSGI-INF/metatype/config.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<MetaData xmlns="http://www.osgi.org/xmlns/metatype/v1.0.0"> + <OCD name="%configurationName" id="server.config" description="%configurationDescription"> + <AD id="http.enabled" type="Boolean" default="true"/> + <AD id="http.port" type="Integer" default="0"/> + <AD id="http.host" type="String" cardinality="1"/> + <AD id="http.nio" type="Boolean" default="true"/> + <AD id="http.minThreads" type="Integer" default="8"/> + <AD id="http.maxThreads" type="Integer" default="200"/> + <AD id="https.enabled" type="Boolean" default="false"/> + <AD id="https.port" type="Integer" default="0"/> + <AD id="https.host" type="String" cardinality="1"/> + <AD id="ssl.keystore" type="String" cardinality="1"/> + <AD id="ssl.password" type="String" cardinality="1"/> + <AD id="ssl.keypassword" type="String" cardinality="1"/> + <AD id="ssl.needclientauth" type="Boolean" cardinality="1"/> + <AD id="ssl.wantclientauth" type="Boolean" cardinality="1"/> + <AD id="ssl.protocol" type="String" cardinality="1"/> + <AD id="ssl.algorithm" type="String" cardinality="1"/> + <AD id="ssl.keystoretype" type="String" cardinality="1"/> + <AD id="context.path" type="String" cardinality="1"/> + <AD id="context.sessioninactiveinterval" type="Integer" cardinality="1"/> + <AD id="other.info" type="String" cardinality="1"/> + </OCD> + <Designate pid="org.eclipse.equinox.http.jetty.config.designate" factoryPid="org.eclipse.equinox.http.jetty.config" bundle="*"> + <Object ocdref="server.config"/> + </Designate> +</MetaData> diff --git a/bundles/org.eclipse.equinox.http.jetty/about.html b/bundles/org.eclipse.equinox.http.jetty/about.html new file mode 100644 index 000000000..d7e1cdf1e --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>January 30, 2007</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.http.jetty/build.properties b/bundles/org.eclipse.equinox.http.jetty/build.properties new file mode 100644 index 000000000..c51e68ea3 --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/build.properties @@ -0,0 +1,18 @@ +############################################################################### +# Copyright (c) 2005, 2007 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 +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/,\ + about.html,\ + plugin.properties +src.includes = about.html diff --git a/bundles/org.eclipse.equinox.http.jetty/plugin.properties b/bundles/org.eclipse.equinox.http.jetty/plugin.properties new file mode 100644 index 000000000..aae3bad6d --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/plugin.properties @@ -0,0 +1,14 @@ +############################################################################### +# Copyright (c) 2005, 2009 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 +############################################################################### +bundleName = Jetty Http Service +providerName = Eclipse.org - Equinox +configurationName = Http Server Configuration +configurationDescription = Provides Http Server Configuration Parameters
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.http.jetty/pom.xml b/bundles/org.eclipse.equinox.http.jetty/pom.xml new file mode 100644 index 000000000..c38ebeebb --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/pom.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2012, 2016 Eclipse Foundation and others. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Distribution License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/org/documents/edl-v10.php + + Contributors: + Igor Fedorenko - initial implementation + Raymond Augé - bug fixes and enhancements +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>rt.equinox.bundles</artifactId> + <groupId>org.eclipse.equinox.bundles</groupId> + <version>4.7.0-SNAPSHOT</version> + <relativePath>../../</relativePath> + </parent> + <groupId>org.eclipse.equinox</groupId> + <artifactId>org.eclipse.equinox.http.jetty</artifactId> + <version>3.4.0-SNAPSHOT</version> + <packaging>eclipse-plugin</packaging> +</project> diff --git a/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/JettyConfigurator.java b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/JettyConfigurator.java new file mode 100644 index 000000000..d171183c9 --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/JettyConfigurator.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2007, 2011 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.http.jetty; + +import java.security.Permission; +import java.util.Dictionary; +import org.eclipse.equinox.http.jetty.internal.Activator; +import org.osgi.framework.Constants; +import org.osgi.service.cm.ConfigurationPermission; + +/** + * <p> + * JettyConfigurator provides API level access for creating configured instances of a Jetty-based Http Service. + * The created instances are not persistent across re-starts of the bundle. + * </p> + * + * @see org.eclipse.equinox.http.jetty.JettyConstants + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + */ +public class JettyConfigurator { + private static final String PID_PREFIX = "org.eclipse.equinox.http.jetty.JettyConfigurator."; //$NON-NLS-1$ + private static Permission configurationPermission = new ConfigurationPermission("*", ConfigurationPermission.CONFIGURE); //$NON-NLS-1$ + + /** + * Creates an instance of Jetty parameterized with a dictionary of settings + * @param id The identifier for the server instance + * @param settings The dictionary of settings used to configure the server instance + * @throws Exception If the server failed to start for any reason + */ + public static void startServer(String id, Dictionary<String, ? extends Object> settings) throws Exception { + checkConfigurationPermission(); + String pid = PID_PREFIX + id; + @SuppressWarnings("unchecked") + Dictionary<String, Object> raw = (Dictionary<String, Object>) settings; + raw.put(Constants.SERVICE_PID, pid); + Activator.startServer(pid, raw); + } + + /** + * Stops a previously started instance of Jetty. If the identified instance is not started this will call will do nothing. + * @param id The identifier for the server instance + * @throws Exception If the server failed to stop for any reason. + */ + public static void stopServer(String id) throws Exception { + checkConfigurationPermission(); + Activator.stopServer(PID_PREFIX + id); + } + + private static void checkConfigurationPermission() throws SecurityException { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkPermission(configurationPermission); + } +} diff --git a/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/JettyConstants.java b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/JettyConstants.java new file mode 100644 index 000000000..e9483bfef --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/JettyConstants.java @@ -0,0 +1,165 @@ +/******************************************************************************* + * Copyright (c) 2007, 2016 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 + * Raymond Augé - bug fixes and enhancements + *******************************************************************************/ +package org.eclipse.equinox.http.jetty; + +/** + * <p> + * Provides configuration constants for use with JettyConfigurator. + * </p> + * @since 1.1 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface JettyConstants { + + /** + * name="http.enabled" type="Boolean" (default: true) + */ + public static final String HTTP_ENABLED = "http.enabled"; //$NON-NLS-1$ + + /** + * name="http.port" type="Integer" (default: 0 -- first available port) + */ + public static final String HTTP_PORT = "http.port"; //$NON-NLS-1$ + + /** + * name="http.host" type="String" (default: 0.0.0.0 -- all network adapters) + */ + public static final String HTTP_HOST = "http.host"; //$NON-NLS-1$ + + /** + * name="http.nio" type="Boolean" (default: true, with some exceptions for JREs with known NIO problems) + * @since 1.1 + */ + public static final String HTTP_NIO = "http.nio"; //$NON-NLS-1$ + + /** + * name="https.enabled" type="Boolean" (default: false) + */ + public static final String HTTPS_ENABLED = "https.enabled"; //$NON-NLS-1$ + + /** + * name="https.host" type="String" (default: 0.0.0.0 -- all network adapters) + */ + public static final String HTTPS_HOST = "https.host"; //$NON-NLS-1$ + + /** + * name="https.port" type="Integer" (default: 0 -- first available port) + */ + public static final String HTTPS_PORT = "https.port"; //$NON-NLS-1$ + + /** + * name="http.maxThreads" type="Integer" (default: 200 -- max number of threads) + * @since 1.2 + */ + public static final String HTTP_MAXTHREADS = "http.maxThreads"; //$NON-NLS-1$ + + /** + * name="http.maxThreads" type="Integer" (default: 8 -- max number of threads) + * @since 1.2 + */ + public static final String HTTP_MINTHREADS = "http.minThreads"; //$NON-NLS-1$ + + /** + * @deprecated + * @since 1.3 + */ + public static final String MULTIPART_FILESIZETHRESHOLD = "multipart.fileSizeThreshold"; //$NON-NLS-1$ + + /** + * @deprecated + * @since 1.3 + */ + public static final String MULTIPART_LOCATION = "multipart.location"; //$NON-NLS-1$ + + /** + * @deprecated + * @since 1.3 + */ + public static final String MULTIPART_MAXFILESIZE = "multipart.maxFileSize"; //$NON-NLS-1$ + + /** + * @deprecated + * @since 1.3 + */ + public static final String MULTIPART_MAXREQUESTSIZE = "multipart.maxRequestSize"; //$NON-NLS-1$ + + /** + * name="ssl.keystore" type="String" + */ + public static final String SSL_KEYSTORE = "ssl.keystore"; //$NON-NLS-1$ + + /** + * name="ssl.password" type="String" + */ + public static final String SSL_PASSWORD = "ssl.password"; //$NON-NLS-1$ + + /** + * name="ssl.keypassword" type="String" + */ + public static final String SSL_KEYPASSWORD = "ssl.keypassword"; //$NON-NLS-1$ + + /** + * name="ssl.needclientauth" type="Boolean" + */ + public static final String SSL_NEEDCLIENTAUTH = "ssl.needclientauth"; //$NON-NLS-1$ + + /** + * name="ssl.wantclientauth" type="Boolean" + */ + public static final String SSL_WANTCLIENTAUTH = "ssl.wantclientauth"; //$NON-NLS-1$ + + /** + * name="ssl.protocol" type="String" + */ + public static final String SSL_PROTOCOL = "ssl.protocol"; //$NON-NLS-1$ + + /** + * name="ssl.algorithm" type="String" + */ + public static final String SSL_ALGORITHM = "ssl.algorithm"; //$NON-NLS-1$ + + /** + * name="ssl.keystoretype" type="String" + */ + public static final String SSL_KEYSTORETYPE = "ssl.keystoretype"; //$NON-NLS-1$ + + /** + * name="context.path" type="String" + */ + public static final String CONTEXT_PATH = "context.path"; //$NON-NLS-1$ + + /** + * name="context.sessioninactiveinterval" type="Integer" + */ + public static final String CONTEXT_SESSIONINACTIVEINTERVAL = "context.sessioninactiveinterval"; //$NON-NLS-1$ + + /** + * name="customizer.class" type="String" <br /> + * (full qualified name of the class that implements + * <code>org.eclipse.equinox.http.jetty.JettyCustomizer</code> and has a public no-arg constructor; + * the class must be supplied via a fragment to this bundle's classpath)</code> + * @since 1.1 + */ + public static final String CUSTOMIZER_CLASS = "customizer.class"; //$NON-NLS-1$ + + /** + * name="other.info" type="String" + */ + public static final String OTHER_INFO = "other.info"; //$NON-NLS-1$ + + /** + * @since 1.3 + */ + public static final String PROPERTY_PREFIX = "org.eclipse.equinox.http.jetty."; //$NON-NLS-1$ + +} diff --git a/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/JettyCustomizer.java b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/JettyCustomizer.java new file mode 100644 index 000000000..bd90f2c33 --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/JettyCustomizer.java @@ -0,0 +1,85 @@ +/******************************************************************************* + * Copyright (c) 2008, 2011 Gunnar Wagenknecht, 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: + * Gunnar Wagenknecht - initial API and implementation + * IBM Corporation - improvements and ongoing maintenance + *******************************************************************************/ +package org.eclipse.equinox.http.jetty; + +import java.util.Dictionary; + +/** + * Jetty Customizer allows one to customize Jetty contexts and connectors. + * <p> + * This abstract class must be extended by clients which wish to customize + * the created Jetty contexts or connectors further. + * </p> + * @since 1.1 + */ +public abstract class JettyCustomizer { + + /** + * Called by the framework when the Jetty context has been created + * and initialized. + * <p> + * Implementors may perform additional configuration of the Jetty context. + * However, they must be aware that changing certain central functionalities + * of the context such as class loading are already configured by the + * framework. Changing those may cause breakage and thus must be avoided. + * </p> + * @param context + * the Jetty context; in case of Jetty 7 the context is of + * type <code>org.eclipse.jetty.servlet.ServletContextHandler</code> + * @param settings + * the settings as passed to {@link JettyConfigurator#startServer(String, Dictionary)} + * @return context + * the customized context; in case of Jetty 7 the context is of + * type <code>org.eclipse.jetty.servlet.ServletContextHandler</code> + */ + public Object customizeContext(Object context, Dictionary<String, ?> settings) { + return context; + } + + /** + * Called by the framework when the Jetty Http Connector has been created + * and initialized. + * <p> + * Implementors may perform additional configuration of the Jetty Connector. + * </p> + * @param connector + * the Jetty connector; in case of Jetty 7 the context is of + * type <code>org.eclipse.jetty.server.Connector</code> + * @param settings + * the settings as passed to {@link JettyConfigurator#startServer(String, Dictionary)} + * @return connector + * the customized connector; in case of Jetty 6 the connector is of + * type <code>org.eclipse.jetty.server.Connector</code> + */ + public Object customizeHttpConnector(Object connector, Dictionary<String, ?> settings) { + return connector; + } + + /** + * Called by the framework when the Jetty Https Connector has been created + * and initialized. + * <p> + * Implementors may perform additional configuration of the Jetty Connector. + * </p> + * @param connector + * the Jetty connector; in case of Jetty 7 the connector is of + * type <code>oorg.eclipse.jetty.server.Connector</code> + * @param settings + * the settings as passed to {@link JettyConfigurator#startServer(String, Dictionary)} + * @return connector + * the customized connector; in case of Jetty 7 the connector is of + * type <code>org.eclipse.jetty.server.Connector</code> + */ + public Object customizeHttpsConnector(Object connector, Dictionary<String, ?> settings) { + return connector; + } +} diff --git a/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/Activator.java b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/Activator.java new file mode 100644 index 000000000..f9e59b27e --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/Activator.java @@ -0,0 +1,224 @@ +/******************************************************************************* + * Copyright (c) 2005, 2016 Cognos Incorporated, 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: + * Cognos Incorporated - initial API and implementation + * IBM Corporation - bug fixes and enhancements + * Raymond Augé - bug fixes and enhancements + *******************************************************************************/ + +package org.eclipse.equinox.http.jetty.internal; + +import java.io.File; +import java.util.*; +import org.eclipse.equinox.http.jetty.JettyConstants; +import org.osgi.framework.*; +import org.osgi.framework.startlevel.BundleStartLevel; +import org.osgi.framework.wiring.BundleCapability; +import org.osgi.framework.wiring.BundleRevision; +import org.osgi.service.cm.ManagedServiceFactory; + +public class Activator implements BundleActivator { + + private static final String JETTY_WORK_DIR = "jettywork"; //$NON-NLS-1$ + private static final String DEFAULT_PID = "default"; //$NON-NLS-1$ + private static final String MANAGED_SERVICE_FACTORY_PID = "org.eclipse.equinox.http.jetty.config"; //$NON-NLS-1$ + + // OSGi Http Service suggest these properties for setting the default ports + private static final String ORG_OSGI_SERVICE_HTTP_PORT = "org.osgi.service.http.port"; //$NON-NLS-1$ + private static final String ORG_OSGI_SERVICE_HTTP_PORT_SECURE = "org.osgi.service.http.port.secure"; //$NON-NLS-1$ + + // controls whether start() should automatically start an Http Service based on BundleContext properties (default is true) + // Note: only used if the bundle is explicitly started (e.g. not "lazy" activated) + private static final String AUTOSTART = "org.eclipse.equinox.http.jetty.autostart"; //$NON-NLS-1$ + + // Jetty will use a basic stderr logger if no other logging mechanism is provided. + // This setting can be used to over-ride the stderr logger threshold(and only this default logger) + // Valid values are in increasing threshold: "debug", "info", "warn", "error", and "off" + // (default threshold is "warn") + private static final String LOG_STDERR_THRESHOLD = "org.eclipse.equinox.http.jetty.log.stderr.threshold"; //$NON-NLS-1$ + + // The staticServerManager is use by the start and stopServer methods and must be accessed in a static synchronized block + // to ensure it is correctly handled in terms of the bundle life-cycle. + private static HttpServerManager staticServerManager; + + private HttpServerManager httpServerManager; + @SuppressWarnings("rawtypes") + private ServiceRegistration registration; + + public void start(BundleContext context) throws Exception { + File jettyWorkDir = new File(context.getDataFile(""), JETTY_WORK_DIR); //$NON-NLS-1$ + jettyWorkDir.mkdir(); + EquinoxStdErrLog.setThresholdLogger(context.getProperty(LOG_STDERR_THRESHOLD)); + httpServerManager = new HttpServerManager(jettyWorkDir); + + boolean autostart = Details.getBoolean(context, AUTOSTART, true); + if (autostart && !isBundleLazyActivationPolicyUsed(context)) { + Dictionary<String, Object> defaultSettings = createDefaultSettings(context); + httpServerManager.updated(DEFAULT_PID, defaultSettings); + } + + Dictionary<String, Object> dictionary = new Hashtable<String, Object>(); + dictionary.put(Constants.SERVICE_PID, MANAGED_SERVICE_FACTORY_PID); + + registration = context.registerService(ManagedServiceFactory.class.getName(), httpServerManager, dictionary); + setStaticServerManager(httpServerManager); + } + + private boolean isBundleLazyActivationPolicyUsed(BundleContext context) { + if (context.getBundle().adapt(BundleStartLevel.class).isActivationPolicyUsed()) { + // checking for lazy capability; NOTE this is equinox specific + // but we fall back to header lookup for other frameworks + List<BundleCapability> moduleData = context.getBundle().adapt(BundleRevision.class).getDeclaredCapabilities("equinox.module.data"); //$NON-NLS-1$ + String activationPolicy = null; + if (moduleData.isEmpty()) { + activationPolicy = context.getBundle().getHeaders("").get(Constants.BUNDLE_ACTIVATIONPOLICY); //$NON-NLS-1$ + } else { + activationPolicy = (String) moduleData.get(0).getAttributes().get("activation.policy"); //$NON-NLS-1$ + } + return activationPolicy == null ? false : activationPolicy.startsWith(Constants.ACTIVATION_LAZY); + } + return false; + } + + public void stop(BundleContext context) throws Exception { + setStaticServerManager(null); + registration.unregister(); + registration = null; + + httpServerManager.shutdown(); + httpServerManager = null; + } + + private Dictionary<String, Object> createDefaultSettings(BundleContext context) { + Dictionary<String, Object> defaultSettings = new Hashtable<String, Object>(); + + // PID + defaultSettings.put(Constants.SERVICE_PID, DEFAULT_PID); + + // HTTP Enabled (default is true) + Boolean httpEnabled = Details.getBooleanProp(context, JettyConstants.HTTP_ENABLED, true); + defaultSettings.put(JettyConstants.HTTP_ENABLED, httpEnabled); + + // HTTP Port + int httpPort = Details.getIntProp(context, JettyConstants.HTTP_PORT, -1); + if (httpPort == -1) + httpPort = Details.getInt(context, ORG_OSGI_SERVICE_HTTP_PORT, 0); + defaultSettings.put(JettyConstants.HTTP_PORT, Integer.valueOf(httpPort)); + + // HTTP Host (default is 0.0.0.0) + String httpHost = Details.getStringProp(context, JettyConstants.HTTP_HOST, null); + if (httpHost != null) + defaultSettings.put(JettyConstants.HTTP_HOST, httpHost); + + // HTTPS Enabled (default is false) + Boolean httpsEnabled = Details.getBooleanProp(context, JettyConstants.HTTPS_ENABLED, false); + defaultSettings.put(JettyConstants.HTTPS_ENABLED, httpsEnabled); + + // minimum number of threads + int minThreads = Details.getIntProp(context, JettyConstants.HTTP_MINTHREADS, 8); + if (minThreads != -1) { + defaultSettings.put(JettyConstants.HTTP_MINTHREADS, Integer.valueOf(minThreads)); + } + + // maximum number of threads + int maxThreads = Details.getIntProp(context, JettyConstants.HTTP_MAXTHREADS, 200); + if (maxThreads != -1) { + defaultSettings.put(JettyConstants.HTTP_MAXTHREADS, Integer.valueOf(maxThreads)); + } + + if (httpsEnabled.booleanValue()) { + // HTTPS Port + + int httpsPort = Details.getIntProp(context, JettyConstants.HTTPS_PORT, -1); + if (httpsPort == -1) + httpsPort = Details.getInt(context, ORG_OSGI_SERVICE_HTTP_PORT_SECURE, 443); + defaultSettings.put(JettyConstants.HTTPS_PORT, Integer.valueOf(httpsPort)); + + // HTTPS Host (default is 0.0.0.0) + String httpsHost = Details.getStringProp(context, JettyConstants.HTTPS_HOST, null); + if (httpsHost != null) + defaultSettings.put(JettyConstants.HTTPS_HOST, httpsHost); + + // SSL SETTINGS + String keystore = Details.getStringProp(context, JettyConstants.SSL_KEYSTORE, null); + if (keystore != null) + defaultSettings.put(JettyConstants.SSL_KEYSTORE, keystore); + + String password = Details.getStringProp(context, JettyConstants.SSL_PASSWORD, null); + if (password != null) + defaultSettings.put(JettyConstants.SSL_PASSWORD, password); + + String keypassword = Details.getStringProp(context, JettyConstants.SSL_KEYPASSWORD, null); + if (keypassword != null) + defaultSettings.put(JettyConstants.SSL_KEYPASSWORD, keypassword); + + String needclientauth = Details.getStringProp(context, JettyConstants.SSL_NEEDCLIENTAUTH, null); + if (needclientauth != null) + defaultSettings.put(JettyConstants.SSL_NEEDCLIENTAUTH, Boolean.valueOf(needclientauth)); + + String wantclientauth = Details.getStringProp(context, JettyConstants.SSL_WANTCLIENTAUTH, null); + if (wantclientauth != null) + defaultSettings.put(JettyConstants.SSL_WANTCLIENTAUTH, Boolean.valueOf(wantclientauth)); + + String protocol = Details.getStringProp(context, JettyConstants.SSL_PROTOCOL, null); + if (protocol != null) + defaultSettings.put(JettyConstants.SSL_PROTOCOL, protocol); + + String algorithm = Details.getStringProp(context, JettyConstants.SSL_ALGORITHM, null); + if (algorithm != null) + defaultSettings.put(JettyConstants.SSL_ALGORITHM, algorithm); + + String keystoretype = Details.getStringProp(context, JettyConstants.SSL_KEYSTORETYPE, null); + if (keystoretype != null) + defaultSettings.put(JettyConstants.SSL_KEYSTORETYPE, keystoretype); + } + + // Servlet Context Path + String contextpath = Details.getStringProp(context, JettyConstants.CONTEXT_PATH, null); + if (contextpath != null) + defaultSettings.put(JettyConstants.CONTEXT_PATH, contextpath); + + // Session Inactive Interval (timeout) + String sessionInactiveInterval = Details.getStringProp(context, JettyConstants.CONTEXT_SESSIONINACTIVEINTERVAL, null); + if (sessionInactiveInterval != null) { + try { + defaultSettings.put(JettyConstants.CONTEXT_SESSIONINACTIVEINTERVAL, Integer.valueOf(sessionInactiveInterval)); + } catch (NumberFormatException e) { + //(log this) ignore + } + } + + // Other Info + String otherInfo = Details.getStringProp(context, JettyConstants.OTHER_INFO, null); + if (otherInfo != null) + defaultSettings.put(JettyConstants.OTHER_INFO, otherInfo); + + // customizer + String customizerClass = Details.getStringProp(context, JettyConstants.CUSTOMIZER_CLASS, null); + if (customizerClass != null) + defaultSettings.put(JettyConstants.CUSTOMIZER_CLASS, customizerClass); + + return defaultSettings; + } + + public synchronized static void startServer(String pid, Dictionary<String, ?> settings) throws Exception { + if (staticServerManager == null) + throw new IllegalStateException("Inactive"); //$NON-NLS-1$ + + staticServerManager.updated(pid, settings); + } + + public synchronized static void stopServer(String pid) throws Exception { + if (staticServerManager != null) + staticServerManager.deleted(pid); + } + + private synchronized static void setStaticServerManager(HttpServerManager httpServerManager) { + staticServerManager = httpServerManager; + } +} diff --git a/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/Details.java b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/Details.java new file mode 100644 index 000000000..cf3b271d8 --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/Details.java @@ -0,0 +1,139 @@ +/******************************************************************************* + * Copyright (c) 2016 Raymond Augé 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: + * Raymond Augé - initial implementation + *******************************************************************************/ +package org.eclipse.equinox.http.jetty.internal; + +import java.util.Dictionary; +import org.eclipse.equinox.http.jetty.JettyConstants; +import org.osgi.framework.BundleContext; + +public class Details { + + public static boolean getBoolean(BundleContext dictionary, String key, boolean dflt) { + String value = dictionary.getProperty(key); + if (value == null) { + return dflt; + } + return Boolean.parseBoolean(value); + } + + public static boolean getBoolean(@SuppressWarnings("rawtypes") Dictionary dictionary, String key, boolean dflt) { + Object value = dictionary.get(key); + if (value instanceof Boolean) { + return (Boolean) value; + } else if (value instanceof String) { + return Boolean.parseBoolean((String) value); + } + return dflt; + } + + public static boolean getBooleanProp(BundleContext dictionary, String key, boolean dflt) { + return getBoolean(dictionary, JettyConstants.PROPERTY_PREFIX + key, dflt); + } + + public static boolean getBooleanProp(@SuppressWarnings("rawtypes") Dictionary dictionary, String key, boolean dflt) { + return getBoolean(dictionary, JettyConstants.PROPERTY_PREFIX + key, dflt); + } + + public static int getInt(BundleContext dictionary, String key, int dflt) { + String value = dictionary.getProperty(key); + if (value == null) { + return dflt; + } + try { + return Integer.parseInt(value); + } catch (NumberFormatException e) { + return dflt; + } + } + + public static int getInt(@SuppressWarnings("rawtypes") Dictionary dictionary, String key, int dflt) { + Object value = dictionary.get(key); + if (value instanceof Integer) { + return (Integer) value; + } else if (value instanceof String) { + try { + return Integer.parseInt((String) value); + } catch (NumberFormatException e) { + return dflt; + } + } + return dflt; + } + + public static int getIntProp(BundleContext dictionary, String key, int dflt) { + return getInt(dictionary, JettyConstants.PROPERTY_PREFIX + key, dflt); + } + + public static int getIntProp(@SuppressWarnings("rawtypes") Dictionary dictionary, String key, int dflt) { + return getInt(dictionary, JettyConstants.PROPERTY_PREFIX + key, dflt); + } + + public static long getLong(BundleContext dictionary, String key, long dflt) { + String value = dictionary.getProperty(key); + if (value == null) { + return dflt; + } + try { + return Long.parseLong(value); + } catch (NumberFormatException e) { + return dflt; + } + } + + public static long getLong(@SuppressWarnings("rawtypes") Dictionary dictionary, String key, long dflt) { + Object value = dictionary.get(key); + if (value instanceof Long) { + return (Long) value; + } else if (value instanceof String) { + try { + return Long.parseLong((String) value); + } catch (NumberFormatException e) { + return dflt; + } + } + return dflt; + } + + public static long getLongProp(BundleContext dictionary, String key, long dflt) { + return getLong(dictionary, JettyConstants.PROPERTY_PREFIX + key, dflt); + } + + public static long getLongProp(@SuppressWarnings("rawtypes") Dictionary dictionary, String key, long dflt) { + return getLong(dictionary, JettyConstants.PROPERTY_PREFIX + key, dflt); + } + + public static String getString(BundleContext dictionary, String key, String dflt) { + String value = dictionary.getProperty(key); + if (value == null) { + return dflt; + } + return value; + } + + public static String getString(@SuppressWarnings("rawtypes") Dictionary dictionary, String key, String dflt) { + Object value = dictionary.get(key); + if (value == null) { + return dflt; + } else if (value instanceof String) { + return (String) value; + } + return String.valueOf(value); + } + + public static String getStringProp(BundleContext dictionary, String key, String dflt) { + return getString(dictionary, JettyConstants.PROPERTY_PREFIX + key, dflt); + } + + public static String getStringProp(@SuppressWarnings("rawtypes") Dictionary dictionary, String key, String dflt) { + return getString(dictionary, JettyConstants.PROPERTY_PREFIX + key, dflt); + } + +} diff --git a/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/EquinoxStdErrLog.java b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/EquinoxStdErrLog.java new file mode 100644 index 000000000..75a79799e --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/EquinoxStdErrLog.java @@ -0,0 +1,182 @@ +/******************************************************************************* + * Copyright (c) 2011 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.http.jetty.internal; + +import org.eclipse.jetty.util.log.*; + +// NOTE: This class simply allows us to override the StdErrLog built into jetty +public class EquinoxStdErrLog implements Logger { + + private static int DEBUG = 0; + private static int INFO = 1; + private static int WARN = 2; + private static int ERROR = 3; + private static int OFF = 4; + + private static volatile int threshold = WARN; + private static EquinoxStdErrLog root; + + private final Logger realLogger; + private final String localName; + + public static synchronized EquinoxStdErrLog getRootLogger() { + if (root != null) + return root; + + root = new EquinoxStdErrLog(null, null); + return root; + } + + public static void setThresholdLogger(String property) { + threshold = parseThresholdProperty(property); + // this is a hack to make sure the built-in jetty StdErrLog is not being used + org.eclipse.jetty.util.log.Logger rootLogger = Log.getRootLogger(); + if (rootLogger == null || (rootLogger instanceof StdErrLog)) { + // The built-in jetty StdErrLog is be used; replace with ours. + Log.setLog(getRootLogger()); + } + + } + + private static int parseThresholdProperty(String property) { + if (property == null) + return WARN; + + if (property.equals("debug")) //$NON-NLS-1$ + return DEBUG; + + if (property.equals("info")) //$NON-NLS-1$ + return INFO; + + if (property.equals("warn")) //$NON-NLS-1$ + return WARN; + + if (property.equals("error")) //$NON-NLS-1$ + return ERROR; + + if (property.equals("none")) //$NON-NLS-1$ + return OFF; + + return WARN; + } + + public EquinoxStdErrLog(String name, Logger realLogger) { + this.localName = name; + this.realLogger = realLogger == null ? new StdErrLog(name) : realLogger; + if (threshold == DEBUG) + this.realLogger.setDebugEnabled(true); + } + + public org.eclipse.jetty.util.log.Logger getLogger(String name) { + if ((name == null && this.localName == null) || (name != null && name.equals(this.localName))) + return this; + return new EquinoxStdErrLog(name, realLogger.getLogger(name)); + } + + // debugSOO = slf4j.getMethod("debug", new Class[]{String.class,Object.class,Object.class}); + public void debug(String msg, Object... arg0) { + if (threshold > DEBUG) + return; + + realLogger.debug(msg, arg0); + } + + // debugST = slf4j.getMethod("debug", new Class[]{String.class,Throwable.class}); + public void debug(String msg, Throwable th) { + if (threshold > DEBUG) + return; + + realLogger.debug(msg, th); + } + + // infoSOO = slf4j.getMethod("info", new Class[]{String.class,Object.class,Object.class}); + public void info(String msg, Object... arg0) { + if (threshold > INFO) + return; + + realLogger.info(msg, arg0); + } + + // warnSOO = slf4j.getMethod("warn", new Class[]{String.class,Object.class,Object.class}); + public void warn(String msg, Object... arg0) { + if (threshold > WARN) + return; + + realLogger.warn(msg, arg0); + } + + // warnST = slf4j.getMethod("warn", new Class[]{String.class,Throwable.class}); + public void warn(String msg, Throwable th) { + if (threshold > WARN) + return; + + // we treat RuntimeException and Error as an error + if (th instanceof RuntimeException || th instanceof Error) + realLogger.warn("ERROR: " + msg, th); //$NON-NLS-1$ + else if (threshold != ERROR) + realLogger.warn(msg, th); + } + + // errorST = slf4j.getMethod("error", new Class[]{String.class,Throwable.class}); + public void error(String msg, Throwable th) { + if (threshold > ERROR) + return; + + realLogger.warn("ERROR: " + msg, th); //$NON-NLS-1$ + } + + public String getName() { + return realLogger.getName(); + } + + public void warn(Throwable thrown) { + if (threshold > WARN) + return; + realLogger.warn(thrown); + } + + public void info(Throwable thrown) { + if (threshold > INFO) + return; + realLogger.info(thrown); + } + + public void info(String msg, Throwable thrown) { + if (threshold > INFO) + return; + realLogger.info(msg, thrown); + } + + public boolean isDebugEnabled() { + return threshold == DEBUG; + } + + public void setDebugEnabled(boolean enabled) { + threshold = DEBUG; + } + + public void debug(Throwable thrown) { + if (threshold > DEBUG) + return; + realLogger.debug(thrown); + } + + public void ignore(Throwable ignored) { + // Just post this to debug + debug(ignored); + } + + public void debug(String msg, long value) { + if (threshold > DEBUG) + return; + realLogger.debug(msg, value); + } +} diff --git a/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java new file mode 100644 index 000000000..8929003b4 --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java @@ -0,0 +1,331 @@ +/******************************************************************************* + * Copyright (c) 2007, 2016 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 + * Red Hat, Inc. - Jetty 9 adoption. + * Raymond Augé - bug fixes and enhancements + *******************************************************************************/ + +package org.eclipse.equinox.http.jetty.internal; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.*; +import javax.servlet.*; +import javax.servlet.http.HttpSessionEvent; +import javax.servlet.http.HttpSessionIdListener; +import org.eclipse.equinox.http.jetty.JettyConstants; +import org.eclipse.equinox.http.jetty.JettyCustomizer; +import org.eclipse.equinox.http.servlet.HttpServiceServlet; +import org.eclipse.jetty.server.*; +import org.eclipse.jetty.server.session.SessionHandler; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.eclipse.jetty.util.ssl.SslContextFactory; +import org.eclipse.jetty.util.thread.QueuedThreadPool; +import org.osgi.framework.Constants; +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; + +public class HttpServerManager implements ManagedServiceFactory { + + private static final int DEFAULT_IDLE_TIMEOUT = 30000; + private static final String CONTEXT_TEMPDIR = "javax.servlet.context.tempdir"; //$NON-NLS-1$ + private static final String DIR_PREFIX = "pid_"; //$NON-NLS-1$ + private static final String INTERNAL_CONTEXT_CLASSLOADER = "org.eclipse.equinox.http.jetty.internal.ContextClassLoader"; //$NON-NLS-1$ + + private Map<String, Server> servers = new HashMap<String, Server>(); + private File workDir; + + public HttpServerManager(File workDir) { + this.workDir = workDir; + } + + public synchronized void deleted(String pid) { + Server server = servers.remove(pid); + if (server != null) { + try { + server.stop(); + } catch (Exception e) { + // TODO: consider logging this, but we should still continue cleaning up + e.printStackTrace(); + } + File contextWorkDir = new File(workDir, DIR_PREFIX + pid.hashCode()); + deleteDirectory(contextWorkDir); + } + } + + public String getName() { + return this.getClass().getName(); + } + + @SuppressWarnings("unchecked") + public synchronized void updated(String pid, @SuppressWarnings("rawtypes") Dictionary dictionary) throws ConfigurationException { + deleted(pid); + Server server = new Server(new QueuedThreadPool(Details.getInt(dictionary, JettyConstants.HTTP_MAXTHREADS, 200), Details.getInt(dictionary, JettyConstants.HTTP_MINTHREADS, 8))); + + JettyCustomizer customizer = createJettyCustomizer(dictionary); + + /** + * May be modified by createHttp(s)Connector. + */ + HttpConfiguration http_config = new HttpConfiguration(); + + ServerConnector httpConnector = createHttpConnector(dictionary, server, http_config); + + ServerConnector httpsConnector = createHttpsConnector(dictionary, server, http_config); + + if (null != customizer) + httpConnector = (ServerConnector) customizer.customizeHttpConnector(httpConnector, dictionary); + + if (httpConnector != null) { + try { + httpConnector.open(); + } catch (IOException e) { + throw new ConfigurationException(pid, e.getMessage(), e); + } + server.addConnector(httpConnector); + } + + if (null != customizer) + httpsConnector = (ServerConnector) customizer.customizeHttpsConnector(httpsConnector, dictionary); + + if (httpsConnector != null) { + try { + httpsConnector.open(); + } catch (IOException e) { + throw new ConfigurationException(pid, e.getMessage(), e); + } + server.addConnector(httpsConnector); + } + + ServletHolder holder = new ServletHolder(new InternalHttpServiceServlet()); + holder.setInitOrder(0); + holder.setInitParameter(Constants.SERVICE_VENDOR, "Eclipse.org"); //$NON-NLS-1$ + holder.setInitParameter(Constants.SERVICE_DESCRIPTION, "Equinox Jetty-based Http Service"); //$NON-NLS-1$ + + String multipartServletName = "Equinox Jetty-based Http Service - Multipart Servlet"; //$NON-NLS-1$ + + holder.setInitParameter("multipart.servlet.name", multipartServletName); //$NON-NLS-1$ + + if (httpConnector != null) { + int port = httpConnector.getLocalPort(); + if (port == -1) + port = httpConnector.getPort(); + holder.setInitParameter(JettyConstants.HTTP_PORT, Integer.toString(port)); + } + if (httpsConnector != null) { + int port = httpsConnector.getLocalPort(); + if (port == -1) + port = httpsConnector.getPort(); + holder.setInitParameter(JettyConstants.HTTPS_PORT, Integer.toString(port)); + } + String otherInfo = Details.getString(dictionary, JettyConstants.OTHER_INFO, null); + if (otherInfo != null) + holder.setInitParameter(JettyConstants.OTHER_INFO, otherInfo); + + ServletContextHandler httpContext = createHttpContext(dictionary); + httpContext.addServlet(holder, "/*"); //$NON-NLS-1$ + server.setHandler(httpContext); + + if (null != customizer) + httpContext = (ServletContextHandler) customizer.customizeContext(httpContext, dictionary); + + SessionHandler sessionManager = httpContext.getSessionHandler(); + try { + sessionManager.addEventListener((HttpSessionIdListener) holder.getServlet()); + } catch (ServletException e) { + throw new ConfigurationException(pid, e.getMessage(), e); + } + + try { + server.start(); + } catch (Exception e) { + throw new ConfigurationException(pid, e.getMessage(), e); + } + servers.put(pid, server); + } + + private ServerConnector createHttpsConnector(@SuppressWarnings("rawtypes") Dictionary dictionary, Server server, HttpConfiguration http_config) { + ServerConnector httpsConnector = null; + if (Details.getBoolean(dictionary, JettyConstants.HTTPS_ENABLED, false)) { + // SSL Context Factory for HTTPS and SPDY + SslContextFactory sslContextFactory = new SslContextFactory(); + //sslContextFactory.setKeyStore(KeyS) + + //Not sure if the next tree are properly migrated from jetty 8... + sslContextFactory.setKeyStorePath(Details.getString(dictionary, JettyConstants.SSL_KEYSTORE, null)); + sslContextFactory.setKeyStorePassword(Details.getString(dictionary, JettyConstants.SSL_PASSWORD, null)); + sslContextFactory.setKeyManagerPassword(Details.getString(dictionary, JettyConstants.SSL_KEYPASSWORD, null)); + sslContextFactory.setKeyStoreType(Details.getString(dictionary, JettyConstants.SSL_KEYSTORETYPE, "JKS")); //$NON-NLS-1$ + sslContextFactory.setProtocol(Details.getString(dictionary, JettyConstants.SSL_PROTOCOL, "TLS")); //$NON-NLS-1$ + sslContextFactory.setWantClientAuth(Details.getBoolean(dictionary, JettyConstants.SSL_WANTCLIENTAUTH, false)); + sslContextFactory.setNeedClientAuth(Details.getBoolean(dictionary, JettyConstants.SSL_NEEDCLIENTAUTH, false)); + + // HTTPS Configuration + HttpConfiguration https_config = new HttpConfiguration(http_config); + https_config.addCustomizer(new SecureRequestCustomizer()); + + // HTTPS connector + httpsConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(https_config)); //$NON-NLS-1$ + httpsConnector.setPort(Details.getInt(dictionary, JettyConstants.HTTPS_PORT, 443)); + } + return httpsConnector; + } + + private ServerConnector createHttpConnector(@SuppressWarnings("rawtypes") Dictionary dictionary, Server server, HttpConfiguration http_config) { + ServerConnector httpConnector = null; + if (Details.getBoolean(dictionary, JettyConstants.HTTP_ENABLED, true)) { + // HTTP Configuration + if (Details.getBoolean(dictionary, JettyConstants.HTTPS_ENABLED, false)) { + http_config.setSecureScheme("https"); //$NON-NLS-1$ + http_config.setSecurePort(Details.getInt(dictionary, JettyConstants.HTTPS_PORT, 443)); + } + // HTTP connector + httpConnector = new ServerConnector(server, new HttpConnectionFactory(http_config)); + httpConnector.setPort(Details.getInt(dictionary, JettyConstants.HTTP_PORT, 80)); + httpConnector.setHost(Details.getString(dictionary, JettyConstants.HTTP_HOST, null)); + httpConnector.setIdleTimeout(DEFAULT_IDLE_TIMEOUT); + } + return httpConnector; + } + + public synchronized void shutdown() throws Exception { + for (Iterator<Server> it = servers.values().iterator(); it.hasNext();) { + Server server = it.next(); + server.stop(); + } + servers.clear(); + } + + private ServletContextHandler createHttpContext(@SuppressWarnings("rawtypes") Dictionary dictionary) { + ServletContextHandler httpContext = new ServletContextHandler(); + // hack in the mime type for xsd until jetty fixes it (bug 393218) + httpContext.getMimeTypes().addMimeMapping("xsd", "application/xml"); //$NON-NLS-1$ //$NON-NLS-2$ + httpContext.setAttribute(INTERNAL_CONTEXT_CLASSLOADER, Thread.currentThread().getContextClassLoader()); + httpContext.setClassLoader(this.getClass().getClassLoader()); + httpContext.setContextPath(Details.getString(dictionary, JettyConstants.CONTEXT_PATH, "/")); //$NON-NLS-1$ + + File contextWorkDir = new File(workDir, DIR_PREFIX + dictionary.get(Constants.SERVICE_PID).hashCode()); + contextWorkDir.mkdir(); + httpContext.setAttribute(CONTEXT_TEMPDIR, contextWorkDir); + SessionHandler handler = new SessionHandler(); + handler.setMaxInactiveInterval(Details.getInt(dictionary, JettyConstants.CONTEXT_SESSIONINACTIVEINTERVAL, -1)); + httpContext.setSessionHandler(handler); + + return httpContext; + } + + private JettyCustomizer createJettyCustomizer(@SuppressWarnings("rawtypes") Dictionary dictionary) { + String customizerClass = (String) dictionary.get(JettyConstants.CUSTOMIZER_CLASS); + if (null == customizerClass) + return null; + + try { + return (JettyCustomizer) Class.forName(customizerClass).newInstance(); + } catch (Exception e) { + // TODO: consider logging this, but we should still continue + e.printStackTrace(); + return null; + } + } + + public static class InternalHttpServiceServlet implements HttpSessionIdListener, Servlet { + // private static final long serialVersionUID = 7477982882399972088L; + private Servlet httpServiceServlet = new HttpServiceServlet(); + private ClassLoader contextLoader; + private Method method; + + public void init(ServletConfig config) throws ServletException { + ServletContext context = config.getServletContext(); + contextLoader = (ClassLoader) context.getAttribute(INTERNAL_CONTEXT_CLASSLOADER); + + Class<?> clazz = httpServiceServlet.getClass(); + try { + method = clazz.getMethod("sessionIdChanged", new Class<?>[] {String.class}); //$NON-NLS-1$ + } catch (Exception e) { + throw new ServletException(e); + } + + Thread thread = Thread.currentThread(); + ClassLoader current = thread.getContextClassLoader(); + thread.setContextClassLoader(contextLoader); + try { + httpServiceServlet.init(config); + } finally { + thread.setContextClassLoader(current); + } + } + + public void destroy() { + Thread thread = Thread.currentThread(); + ClassLoader current = thread.getContextClassLoader(); + thread.setContextClassLoader(contextLoader); + try { + httpServiceServlet.destroy(); + } finally { + thread.setContextClassLoader(current); + } + contextLoader = null; + } + + public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { + Thread thread = Thread.currentThread(); + ClassLoader current = thread.getContextClassLoader(); + thread.setContextClassLoader(contextLoader); + try { + httpServiceServlet.service(req, res); + } finally { + thread.setContextClassLoader(current); + } + } + + public ServletConfig getServletConfig() { + return httpServiceServlet.getServletConfig(); + } + + public String getServletInfo() { + return httpServiceServlet.getServletInfo(); + } + + public void sessionIdChanged(HttpSessionEvent event, String oldSessionId) { + Thread thread = Thread.currentThread(); + ClassLoader current = thread.getContextClassLoader(); + thread.setContextClassLoader(contextLoader); + try { + method.invoke(httpServiceServlet, oldSessionId); + } catch (IllegalAccessException e) { + // not likely + } catch (IllegalArgumentException e) { + // not likely + } catch (InvocationTargetException e) { + throw new RuntimeException(e.getCause()); + } finally { + thread.setContextClassLoader(current); + } + } + } + + // deleteDirectory is a convenience method to recursively delete a directory + private static boolean deleteDirectory(File directory) { + if (directory.exists() && directory.isDirectory()) { + File[] files = directory.listFiles(); + for (int i = 0; i < files.length; i++) { + if (files[i].isDirectory()) { + deleteDirectory(files[i]); + } else { + files[i].delete(); + } + } + } + return directory.delete(); + } + +} diff --git a/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/package.html b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/package.html new file mode 100644 index 000000000..e3ea751dc --- /dev/null +++ b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/package.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <title>Package-level Javadoc</title> +</head> +<body> +Provides core support for the Jetty-based Http Service. +<h2> +Package Specification</h2> +<p> +This package specifies API for configuring an instance of the Jetty-based Http Service. +<p> +@since 1.0 +<p> +</body> +</html> |