Step in 0.11 refactoring.

This commit is contained in:
Christian P. MOMON 2021-07-10 19:46:31 +02:00
parent 99bf85794b
commit c50aca1771
32 changed files with 1028 additions and 426 deletions

View file

@ -18,7 +18,7 @@
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11-sources.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_45">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>

View file

@ -9,33 +9,64 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false
org.eclipse.jdt.core.formatter.align_with_spaces=false
org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant=0
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field=49
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=49
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method=49
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package=49
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=0
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type=49
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
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_assertion_message=0
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_bitwise_operator=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
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_record_components=16
org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0
org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=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_record_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.alignment_for_type_annotations=0
org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=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
@ -44,6 +75,7 @@ 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_statement_group_in_switch=0
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
@ -53,11 +85,17 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_record_constructor=next_line
org.eclipse.jdt.core.formatter.brace_position_for_record_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=false
org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
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.count_line_length_from_starting_position=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
@ -66,7 +104,9 @@ org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.indent_tag_description=false
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
@ -82,6 +122,7 @@ org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
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_record_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=false
org.eclipse.jdt.core.formatter.indent_empty_lines=false
@ -90,6 +131,7 @@ 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_on_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
@ -98,6 +140,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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_after_type_annotation=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=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@ -111,11 +154,15 @@ 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_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=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_bitwise_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
@ -141,10 +188,16 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arg
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_record_components=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=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_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not 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
@ -161,6 +214,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not ins
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_record_declaration=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_try=do not insert
@ -169,13 +223,20 @@ 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_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert
org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=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_bitwise_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
@ -192,6 +253,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not in
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_record_declaration=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_try=do not insert
@ -218,10 +280,15 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_ar
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_record_components=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_switch_case_expressions=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_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=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
@ -233,6 +300,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_
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_record_constructor=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_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
@ -248,6 +317,7 @@ 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_record_declaration=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_try=insert
@ -258,9 +328,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
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_relational_operator=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_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=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
@ -272,20 +345,64 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_decla
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never
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_enum_constant_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false
org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=200
org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.lineSplit=150
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_after_code_block=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.text_block_indentation=0
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator=true
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true
org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true
org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter

View file

@ -1,3 +1,4 @@
cleanup.add_all=false
cleanup.add_default_serial_version_id=false
cleanup.add_generated_serial_version_id=true
cleanup.add_missing_annotations=true
@ -11,27 +12,79 @@ cleanup.always_use_blocks=true
cleanup.always_use_parentheses_in_expressions=false
cleanup.always_use_this_for_non_static_field_access=true
cleanup.always_use_this_for_non_static_method_access=false
cleanup.array_with_curly=false
cleanup.arrays_fill=false
cleanup.bitwise_conditional_expression=false
cleanup.boolean_literal=false
cleanup.boolean_value_rather_than_comparison=true
cleanup.break_loop=false
cleanup.collection_cloning=false
cleanup.comparing_on_criteria=false
cleanup.comparison_statement=false
cleanup.controlflow_merge=false
cleanup.convert_functional_interfaces=false
cleanup.convert_to_enhanced_for_loop=false
cleanup.convert_to_enhanced_for_loop_if_loop_var_used=true
cleanup.convert_to_switch_expressions=false
cleanup.correct_indentation=false
cleanup.double_negation=false
cleanup.else_if=false
cleanup.embedded_if=false
cleanup.evaluate_nullable=false
cleanup.extract_increment=false
cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false
cleanup.hash=false
cleanup.if_condition=false
cleanup.insert_inferred_type_arguments=false
cleanup.instanceof=false
cleanup.instanceof_keyword=false
cleanup.invert_equals=false
cleanup.join=false
cleanup.lazy_logical_operator=false
cleanup.make_local_variable_final=false
cleanup.make_parameters_final=true
cleanup.make_private_fields_final=false
cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=true
cleanup.map_cloning=false
cleanup.merge_conditional_blocks=false
cleanup.multi_catch=false
cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=true
cleanup.no_string_creation=false
cleanup.no_super=false
cleanup.number_suffix=false
cleanup.objects_equals=false
cleanup.one_if_rather_than_duplicate_blocks_that_fall_through=true
cleanup.operand_factorization=false
cleanup.organize_imports=false
cleanup.overridden_assignment=false
cleanup.plain_replacement=false
cleanup.precompile_regex=false
cleanup.primitive_comparison=false
cleanup.primitive_parsing=false
cleanup.primitive_rather_than_wrapper=true
cleanup.primitive_serialization=false
cleanup.pull_out_if_from_if_else=false
cleanup.pull_up_assignment=false
cleanup.push_down_negation=false
cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.reduce_indentation=false
cleanup.redundant_comparator=false
cleanup.redundant_falling_through_block_end=false
cleanup.remove_private_constructors=true
cleanup.remove_redundant_modifiers=false
cleanup.remove_redundant_semicolons=true
cleanup.remove_redundant_type_arguments=true
cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false
cleanup.remove_unnecessary_array_creation=false
cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true
@ -40,21 +93,53 @@ cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true
cleanup.return_expression=false
cleanup.simplify_lambda_expression_and_method_ref=false
cleanup.single_used_field=false
cleanup.sort_members=true
cleanup.sort_members_all=false
cleanup.standard_comparison=false
cleanup.static_inner_class=false
cleanup.strictly_equal_or_different=false
cleanup.stringbuilder=false
cleanup.substring=false
cleanup.switch=false
cleanup.system_property=false
cleanup.system_property_boolean=false
cleanup.system_property_file_encoding=false
cleanup.system_property_file_separator=false
cleanup.system_property_line_separator=false
cleanup.system_property_path_separator=false
cleanup.ternary_operator=false
cleanup.try_with_resource=false
cleanup.unlooped_while=false
cleanup.unreachable_block=false
cleanup.use_anonymous_class_creation=false
cleanup.use_autoboxing=false
cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_directly_map_method=false
cleanup.use_lambda=true
cleanup.use_parentheses_in_expressions=false
cleanup.use_string_is_blank=false
cleanup.use_this_for_non_static_field_access=true
cleanup.use_this_for_non_static_field_access_only_if_necessary=false
cleanup.use_this_for_non_static_method_access=false
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup.use_unboxing=false
cleanup.use_var=false
cleanup.useless_continue=false
cleanup.useless_return=false
cleanup.valueof_rather_than_instantiation=false
cleanup_profile=_Kiss4web
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Kiss4web
formatter_settings_version=12
formatter_settings_version=21
jautodoc.cleanup.add_header=false
jautodoc.cleanup.javadoc=false
jautodoc.cleanup.replace_header=false
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v7.0"/>
<fixed facet="java"/>
<fixed facet="jst.utility"/>
<installed facet="java" version="1.6"/>

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2013-2016 Christian Pierre MOMON
* Copyright (C) 2013-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -26,9 +26,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
*
* @author Christian P. Momon
* The Class BuildInformation.
*/
public class BuildInformation
{
@ -43,7 +41,7 @@ public class BuildInformation
private String author;
/**
*
* Instantiates a new builds the information.
*/
public BuildInformation()
{
@ -124,7 +122,8 @@ public class BuildInformation
{
String result;
result = String.format("%s %s.%s.%s built on %s by %s", this.productName, this.majorRevision, this.minorRevision, this.buildNumber, this.buildDate, this.author);
result = String.format("%s %s.%s.%s built on %s by %s", this.productName, this.majorRevision, this.minorRevision, this.buildNumber,
this.buildDate, this.author);
//
return result;

View file

@ -1,6 +1,5 @@
/**
* Copyright (C) 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2010 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -29,20 +28,28 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* The Class CookieHelper.
*/
public class CookieHelper
{
private static final Logger logger = LoggerFactory.getLogger(CookieHelper.class);
public enum Scope
{
HTTP_AND_HTTPS,
HTTPS_ONLY
}
private static final Logger logger = LoggerFactory.getLogger(CookieHelper.class);
/**
* Builds the cookie.
*
* @param name
* the name
* @param value
* the value
* @param duration
* the duration
* @return the cookie
*/
public static Cookie buildCookie(final String name, final String value, final int duration)
{
@ -55,7 +62,17 @@ public class CookieHelper
}
/**
* Warning: value is UTF-8 URLEncoded!
* Warning: value is UTF-8 URLEncoded!.
*
* @param name
* the name
* @param value
* the value
* @param duration
* the duration
* @param secure
* the secure
* @return the cookie
*/
public static Cookie buildCookie(final String name, final String value, final int duration, final Scope secure)
{
@ -89,7 +106,13 @@ public class CookieHelper
}
/**
* Exists.
*
* @param request
* the request
* @param key
* the key
* @return true, if successful
*/
public static boolean exists(final HttpServletRequest request, final String key)
{
@ -109,7 +132,13 @@ public class CookieHelper
}
/**
* Gets the cookie.
*
* @param cookies
* the cookies
* @param key
* the key
* @return the cookie
*/
public static Cookie getCookie(final Cookie[] cookies, final String key)
{
@ -150,7 +179,13 @@ public class CookieHelper
}
/**
* Gets the cookie.
*
* @param request
* the request
* @param key
* the key
* @return the cookie
*/
public static Cookie getCookie(final HttpServletRequest request, final String key)
{
@ -164,6 +199,12 @@ public class CookieHelper
/**
* Note: value is UTF-8 decoded.
*
* @param cookies
* the cookies
* @param key
* the key
* @return the cookie value
*/
public static Object getCookieValue(final Cookie[] cookies, final String key)
{
@ -193,7 +234,13 @@ public class CookieHelper
}
/**
* Gets the cookie value.
*
* @param request
* the request
* @param key
* the key
* @return the cookie value
*/
public static Object getCookieValue(final HttpServletRequest request, final String key)
{
@ -206,7 +253,12 @@ public class CookieHelper
}
/**
* Reset.
*
* @param response
* the response
* @param key
* the key
*/
public static void reset(final HttpServletResponse response, final String key)
{
@ -214,7 +266,16 @@ public class CookieHelper
}
/**
* Sets the.
*
* @param response
* the response
* @param name
* the name
* @param value
* the value
* @param duration
* the duration
*/
public static void set(final HttpServletResponse response, final String name, final String value, final int duration)
{

View file

@ -1,5 +1,5 @@
/**
* Copyright 2013-2015 Christian Pierre MOMON, DEVINSY, UMR 7186 LESC.
* Copyright 2013-2021 Christian Pierre MOMON, DEVINSY, UMR 7186 LESC.
*
* christian.momon@devinsy.fr
*
@ -45,9 +45,7 @@ import org.slf4j.LoggerFactory;
import fr.devinsy.util.strings.StringListUtils;
/**
*
*
* @author Christian P. Momon
* The Class EnvironmentInformation.
*/
public class EnvironmentInformation
{
@ -59,8 +57,10 @@ public class EnvironmentInformation
private String log4jFilePathname;
/**
* @throws ConfigurationException
* Instantiates a new environment information.
*
* @throws ConfigurationException
* the configuration exception
*/
public EnvironmentInformation() throws ConfigurationException
{

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2013-2016 Christian Pierre MOMON
* Copyright (C) 2013-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -24,12 +24,12 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
/**
*
*
* @author Christian P. Momon
* The Class Kiss4web.
*/
public class Kiss4web
{
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Kiss4web.class);
private static class SingletonHolder
{
private static final Kiss4web instance = new Kiss4web();
@ -42,14 +42,11 @@ public class Kiss4web
MAINTENANCE
}
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Kiss4web.class);
private BuildInformation buildInformation;
private Status status;
/**
* @throws Exception
*
* Instantiates a new kiss 4 web.
*/
private Kiss4web()
{
@ -94,14 +91,20 @@ public class Kiss4web
}
}
/**
* Builds the information.
*
* @return the builds the information
*/
public BuildInformation buildInformation()
{
return this.buildInformation;
}
/**
* Gets the status.
*
* @return
* @return the status
*/
public Kiss4web.Status getStatus()
{
@ -109,8 +112,10 @@ public class Kiss4web
}
/**
* Sets the status.
*
* @param status
* the new status
*/
public void setStatus(final Status status)
{
@ -118,8 +123,9 @@ public class Kiss4web
}
/**
* Instance.
*
* @return
* @return the kiss 4 web
*/
public static Kiss4web instance()
{
@ -127,9 +133,12 @@ public class Kiss4web
}
/**
* Log init.
*
* @param currentLogItem
* the current log item
* @param status
* the status
*/
private static void logInit(final String currentLogItem, final String status)
{

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -19,8 +19,7 @@
package fr.devinsy.kiss4web;
/**
*
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
* The Class Kiss4webUtils.
*/
public class Kiss4webUtils
{

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2010, 2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -24,10 +24,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* The Class Redirector.
*/
public class Redirector
{
private static final Logger logger = LoggerFactory.getLogger(Redirector.class);
public enum Type
{
MOVED_PERMANENTLY(HttpServletResponse.SC_MOVED_PERMANENTLY),
@ -51,10 +53,13 @@ public class Redirector
}
}
private static final Logger logger = LoggerFactory.getLogger(Redirector.class);
/**
* Redirect.
*
* @param response
* the response
* @param destination
* the destination
*/
public static void redirect(final HttpServletResponse response, final String destination)
{
@ -64,11 +69,14 @@ public class Redirector
}
/**
* Redirect.
*
* @param response
* the response
* @param destination
* if null then use the "/" value.
* @param type
* the type
*/
public static void redirect(final HttpServletResponse response, final String destination, final Type type)
{
@ -94,5 +102,3 @@ public class Redirector
}
}
}
// ////////////////////////////////////////////////////////////////////////

View file

@ -0,0 +1,41 @@
/**
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
* Kiss4web is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Kiss4web is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.dispatcher;
import java.util.HashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class KissClassCache.
*/
public class KissClassCache extends HashMap<String, String>
{
private static final long serialVersionUID = 2058060444094070931L;
private static Logger logger = LoggerFactory.getLogger(KissClassCache.class);
/**
* Instantiates a new kiss class cache.
*/
public KissClassCache()
{
super();
}
}

View file

@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web;
package fr.devinsy.kiss4web.dispatcher;
import java.io.IOException;
import java.util.Date;
@ -31,16 +31,17 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.hooks.BlankHook;
import fr.devinsy.kiss4web.hooks.FolderHook;
import fr.devinsy.kiss4web.hooks.Hook;
import fr.devinsy.kiss4web.hooks.HookRegister;
import fr.devinsy.kiss4web.hooks.LongURLHook;
import fr.devinsy.kiss4web.hooks.RootHook;
import fr.devinsy.kiss4web.hooks.ShortURLHook;
import fr.devinsy.kiss4web.hooks.WebContentHook;
import fr.devinsy.kiss4web.hooks.WebInfHook;
import fr.devinsy.kiss4web.hooks.XHTMLHook;
import fr.devinsy.kiss4web.EnvironmentInformation;
import fr.devinsy.kiss4web.dispatcher.hooks.BlankHook;
import fr.devinsy.kiss4web.dispatcher.hooks.FolderHook;
import fr.devinsy.kiss4web.dispatcher.hooks.Hook;
import fr.devinsy.kiss4web.dispatcher.hooks.HookRegister;
import fr.devinsy.kiss4web.dispatcher.hooks.LongURLHook;
import fr.devinsy.kiss4web.dispatcher.hooks.RootHook;
import fr.devinsy.kiss4web.dispatcher.hooks.ShortURLHook;
import fr.devinsy.kiss4web.dispatcher.hooks.WebContentHook;
import fr.devinsy.kiss4web.dispatcher.hooks.WebInfHook;
import fr.devinsy.kiss4web.dispatcher.hooks.XHTMLHook;
/**
*

View file

@ -0,0 +1,262 @@
/**
* Copyright (C) 2006-2010, 2013-2018 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
* Kiss4web is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Kiss4web is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.dispatcher;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iterator;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.kernel.Kiss4web;
import fr.devinsy.kiss4web.kernel.KissModule;
import fr.devinsy.kiss4web.kernel.dispatcher.hooks.HookRegister;
import fr.devinsy.strings.StringList;
/**
* A factory for creating KissDispatcher objects.
*/
public class KissDispatcherFactory extends HashMap<String, String>
{
private static final long serialVersionUID = 8711189110156064068L;
private static Logger logger = LoggerFactory.getLogger(KissDispatcherFactory.class);
private static class SingletonHolder
{
private static final KissDispatcherFactory instance = new KissDispatcherFactory();
}
private KissClassCache cache;
private HookRegister catchers;
/**
* Instantiates a new kiss dispatcher factory.
*/
private KissDispatcherFactory()
{
this.cache = new KissClassCache();
this.catchers = new HookRegister();
}
/**
* Catchers.
*
* @return the hook register
*/
public HookRegister catchers()
{
return this.catchers;
}
/**
* Dispatch to servlet.
*
* @param servletConfig
* the servlet config
* @param request
* the request
* @param response
* the response
* @param urlPath
* the url path
* @throws IOException
* Signals that an I/O exception has occurred.
* @throws ServletException
* the servlet exception
*/
public void dispatchToServlet(final ServletConfig servletConfig, final HttpServletRequest request, final HttpServletResponse response,
final String urlPath) throws IOException, ServletException
{
// Get the servlet.
HttpServlet servlet;
String className = this.cache.get(urlPath);
if (className == null)
{
className = translateToClassName(urlPath);
logger.info("className=[" + className + "]");
// servlet = instanciateServletSearching("/website/" + className);
servlet = KissDispatcherUtils.instanciateServlet("/website/" + className);
if (servlet != null)
{
this.cache.put(urlPath, className);
}
}
else
{
servlet = KissDispatcherUtils.instanciateServlet(className);
}
// Serve the servlet.
if (servlet == null)
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><head></head><body>");
out.println("Unknown page.");
out.println("</body></html>");
out.close();
}
else
{
servlet.init(servletConfig);
servlet.service(request, response);
}
}
/**
* Instanciate servlet searching.
*
* @param className
* the class name
* @return the http servlet
*/
public HttpServlet instanciateServletSearching(final String className)
{
HttpServlet result;
if (className == null)
{
result = null;
}
else
{
boolean ended = false;
Iterator<KissModule> iterator = Kiss4web.instance().modules().iterator();
result = null;
while (!ended)
{
if (iterator.hasNext())
{
KissModule module = iterator.next();
String currentClassName = KissDispatcherUtils.concatenatePackage(module.websiteRootPackage(), className);
HttpServlet servlet = KissDispatcherUtils.instanciateServlet(currentClassName);
if (servlet != null)
{
ended = true;
result = servlet;
}
}
else
{
ended = true;
result = null;
}
}
}
//
return result;
}
/**
* Instance.
*
* @return the kiss dispatcher factory
*/
public static KissDispatcherFactory instance()
{
return SingletonHolder.instance;
}
/**
* Translate to class name.
*
* <pre>
* "/" => "Index_xhtml"
* "/good/" => "good.Index_xhtml"
* "/good/morning.xhtml" => "good.Morning_xhtml"
* "/good/morning_girl.xhtml" => "good.Morning_girl_xhtml"
* </pre>
*
* @param urlPath
* the url path
* @return the string
*/
public static String translateToClassName(final String urlPath)
{
String result;
if (urlPath == null)
{
result = null;
}
else
{
String[] tokens = urlPath.split("/");
if (tokens.length == 1)
{
result = "Index_xhtml";
}
else if (urlPath.endsWith("/"))
{
StringList buffer = new StringList();
// Note: as pathInfo starts always with a '/', the first
// good token index is 1.
for (int tokenCounter = 1; tokenCounter <= tokens.length - 1; tokenCounter++)
{
buffer.append(tokens[tokenCounter]);
buffer.append('.');
}
// String lastToken = tokens[tokens.length - 1];
// buffer.append(StringUtils.capitalize(lastToken)).append("_xhtml");
buffer.append("Index_xhtml");
result = buffer.toString();
}
else
{
StringList buffer = new StringList();
// Note: as pathInfo starts always with a '/', the first
// good token index is 1.
for (int tokenCounter = 1; tokenCounter < tokens.length - 1; tokenCounter++)
{
buffer.append(tokens[tokenCounter]);
buffer.append('.');
}
String lastToken = tokens[tokens.length - 1];
buffer.append(StringUtils.capitalize(lastToken).replace('.', '_'));
result = buffer.toString();
}
}
//
return result;
}
}

View file

@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web;
package fr.devinsy.kiss4web.dispatcher;
import java.io.File;
import java.io.FileInputStream;

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
import java.io.IOException;
import java.io.PrintWriter;
@ -30,44 +30,22 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* The Class BlankHook.
*/
public class BlankHook extends HookCore
{
private static Logger logger = LoggerFactory.getLogger(BlankHook.class);
/**
*
* Instantiates a new blank hook.
*/
public BlankHook()
{
super();
}
/**
* @throws IOException
*
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException
{
logger.debug("Doing catch.");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><head></head><body>");
out.println("Null path.");
out.println("</body></html>");
out.close();
}
/**
*
* @param urlPath
* @return
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#matches(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest)
*/
@Override
public boolean matches(final ServletContext servletContext, final HttpServletRequest request)
@ -88,4 +66,23 @@ public class BlankHook extends HookCore
//
return result;
}
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#process(javax.servlet.ServletConfig, javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException
{
logger.debug("Doing catch.");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><head></head><body>");
out.println("Null path.");
out.println("</body></html>");
out.close();
}
}

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
import java.io.IOException;
@ -29,42 +29,25 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.KissDispatcherUtils;
import fr.devinsy.kiss4web.dispatcher.KissDispatcherUtils;
/**
*
* The Class FolderHook.
*/
public class FolderHook extends HookCore
{
private static Logger logger = LoggerFactory.getLogger(FolderHook.class);
/**
*
* Instantiates a new folder hook.
*/
public FolderHook()
{
super();
}
/**
* @throws IOException
* @throws ServletException
*
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String urlPath = request.getPathInfo();
KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, urlPath);
}
/**
*
* @param urlPath
* @return
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#matches(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest)
*/
@Override
public boolean matches(final ServletContext servletContext, final HttpServletRequest request)
@ -86,4 +69,16 @@ public class FolderHook extends HookCore
return result;
}
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#process(javax.servlet.ServletConfig, javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String urlPath = request.getPathInfo();
KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, urlPath);
}
}

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
import java.io.IOException;
@ -27,30 +27,45 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* The Interface Hook.
*/
public interface Hook
{
/**
*
* @param request
* @param response
* @throws Exception
*/
void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException;
/**
*
* @param source
* @return
*/
boolean matches(final ServletContext servletContext, final HttpServletRequest request);
/**
*
* Checks if is terminal.
*
* @return true if it is a final hook, false otherwise.
*/
boolean isTerminal();
/**
* Matches.
*
* @param servletContext
* the servlet context
* @param request
* the request
* @return true, if successful
*/
boolean matches(final ServletContext servletContext, final HttpServletRequest request);
/**
* Process.
*
* @param servletConfig
* the servlet config
* @param servletContext
* the servlet context
* @param request
* the request
* @param response
* the response
* @throws IOException
* Signals that an I/O exception has occurred.
* @throws ServletException
* the servlet exception
*/
void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException;
}

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,22 +16,17 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
/**
*
* The Class HookCore.
*/
public abstract class HookCore implements Hook
{
private boolean terminal;
public void setTerminal(boolean terminal)
{
this.terminal = terminal;
}
/**
*
* Instantiates a new hook core.
*/
public HookCore()
{
@ -40,11 +35,23 @@ public abstract class HookCore implements Hook
this.terminal = true;
}
/**
*
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#isTerminal()
*/
@Override
public boolean isTerminal()
{
return this.terminal;
}
/**
* Sets the terminal.
*
* @param terminal
* the new terminal
*/
public void setTerminal(final boolean terminal)
{
this.terminal = terminal;
}
}

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
import java.util.ArrayList;
import java.util.Iterator;
@ -26,14 +26,14 @@ import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
/**
*
* The Class HookRegister.
*/
public class HookRegister
{
List<Hook> hooks;
/**
*
* Instantiates a new hook register.
*/
public HookRegister()
{
@ -43,28 +43,13 @@ public class HookRegister
}
/**
*
* @return
*/
public List<Hook> hooks()
{
return hooks;
}
/**
*
* @param hook
*/
public void register(Hook hook)
{
hooks.add(hook);
}
/**
* Gets the matching.
*
* @param servletContext
* the servlet context
* @param request
* @return
* the request
* @return the matching
*/
public Hook getMatching(final ServletContext servletContext, final HttpServletRequest request)
{
@ -95,4 +80,25 @@ public class HookRegister
//
return result;
}
/**
* Hooks.
*
* @return the list
*/
public List<Hook> hooks()
{
return this.hooks;
}
/**
* Register.
*
* @param hook
* the hook
*/
public void register(final Hook hook)
{
this.hooks.add(hook);
}
}

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
import java.io.IOException;
@ -29,45 +29,25 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.KissDispatcherUtils;
import fr.devinsy.kiss4web.dispatcher.KissDispatcherUtils;
/**
*
* The Class LongURLHook.
*/
public class LongURLHook extends HookCore
{
private static Logger logger = LoggerFactory.getLogger(LongURLHook.class);
/**
*
* Instantiates a new long URL hook.
*/
public LongURLHook()
{
super();
}
/**
* @throws IOException
* @throws ServletException
*
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String urlPath = request.getPathInfo();
String rewritedURLPath = LongURLRewriter.unrewrite(urlPath);
KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, rewritedURLPath);
}
/**
*
* @param urlPath
* @return
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#matches(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest)
*/
@Override
public boolean matches(final ServletContext servletContext, final HttpServletRequest request)
@ -81,4 +61,20 @@ public class LongURLHook extends HookCore
//
return result;
}
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#process(javax.servlet.ServletConfig, javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String urlPath = request.getPathInfo();
String rewritedURLPath = LongURLRewriter.unrewrite(urlPath);
KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, rewritedURLPath);
}
}

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
import fr.devinsy.util.strings.StringList;
/**
*
* The Class LongURLRewriter.
*/
public class LongURLRewriter
{
@ -41,9 +41,11 @@ public class LongURLRewriter
private static final Pattern REWRITE_PARAMETER = Pattern.compile("[^%\\w\\d]");
/**
* Matches.
*
* @param urlPath
* @return
* the url path
* @return true, if successful
*/
public static boolean matches(final String urlPath)
{
@ -57,19 +59,6 @@ public class LongURLRewriter
return result;
}
/**
*
*/
public static String[] unrewriteParameters(final HttpServletRequest request)
{
String[] result;
result = unrewriteParameters(request.getRequestURI());
//
return result;
}
/**
* This method gives a way for a long rewriting URL format. Long as in REST.
*
@ -113,12 +102,11 @@ public class LongURLRewriter
}
/**
*
* /catalog/article-/123/2016/12/14/resume.xhtml -> /catalog/article.xhtml
*
* @param source
* an URL path.
* @return
* @return the string
*/
public static String unrewrite(final String source)
{
@ -141,6 +129,23 @@ public class LongURLRewriter
return result;
}
/**
* Unrewrite parameters.
*
* @param request
* the request
* @return the string[]
*/
public static String[] unrewriteParameters(final HttpServletRequest request)
{
String[] result;
result = unrewriteParameters(request.getRequestURI());
//
return result;
}
/**
* Extract values from a path.
*
@ -153,7 +158,7 @@ public class LongURLRewriter
*
* @param source
* an URL path.
* @return
* @return the string[]
*/
public static String[] unrewriteParameters(final String source)
{

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
import java.io.IOException;
@ -29,43 +29,25 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.KissDispatcherUtils;
import fr.devinsy.kiss4web.dispatcher.KissDispatcherUtils;
/**
*
* The Class RootHook.
*/
public class RootHook extends HookCore
{
private static Logger logger = LoggerFactory.getLogger(RootHook.class);
/**
*
* Instantiates a new root hook.
*/
public RootHook()
{
super();
}
/**
* @throws IOException
* @throws ServletException
*
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String className = "index.xhtml";
KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, className);
}
/**
*
* @param urlPath
* @return
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#matches(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest)
*/
@Override
public boolean matches(final ServletContext servletContext, final HttpServletRequest request)
@ -86,4 +68,18 @@ public class RootHook extends HookCore
//
return result;
}
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#process(javax.servlet.ServletConfig, javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String className = "index.xhtml";
KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, className);
}
}

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
import java.io.IOException;
@ -29,45 +29,25 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.KissDispatcherUtils;
import fr.devinsy.kiss4web.dispatcher.KissDispatcherUtils;
/**
*
* The Class ShortURLHook.
*/
public class ShortURLHook extends HookCore
{
private static Logger logger = LoggerFactory.getLogger(ShortURLHook.class);
/**
*
* Instantiates a new short URL hook.
*/
public ShortURLHook()
{
super();
}
/**
* @throws IOException
* @throws ServletException
*
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String urlPath = request.getPathInfo();
String rewritedURLPath = ShortURLRewriter.unrewrite(urlPath);
KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, rewritedURLPath);
}
/**
*
* @param urlPath
* @return
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#matches(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest)
*/
@Override
public boolean matches(final ServletContext servletContext, final HttpServletRequest request)
@ -81,4 +61,20 @@ public class ShortURLHook extends HookCore
//
return result;
}
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#process(javax.servlet.ServletConfig, javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String urlPath = request.getPathInfo();
String rewritedURLPath = ShortURLRewriter.unrewrite(urlPath);
KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, rewritedURLPath);
}
}

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
import fr.devinsy.util.strings.StringList;
/**
*
* The Class ShortURLRewriter.
*/
public class ShortURLRewriter
{
@ -48,28 +48,27 @@ public class ShortURLRewriter
*/
private static char NONE = (char) 0;
private static int[] rewritingParameterMapping = {
/* 00 */NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
/* 10 */NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
/* 20 */'-', NONE, NONE, '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-',
/* 30 */'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '-', '-', '-', '-', '-',
/* 40 */'\u0040', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
/* 50 */'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '-', '-', '-', '-', '-',
/* 60 */'-', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E', '\u006F',
/* 70 */'\u0070', '\u0071', '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D', '-', '-',
/* 80 */NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
/* 90 */NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
/* A0 */'\u00A0', '\u00A1', '\u00A2', '\u00A3', '\u00A4', '\u00A5', '\u00A6', '\u00A7', '\u00A8', '\u00A9', '\u00AA', '\u00AB', '\u00AC', '\u00AD', '\u00AE', '\u00AF',
/* B0 */'-', '\u00B1', '\u00B2', '\u00B3', '\u00B4', '\u00B5', '\u00B6', '\u00B7', '\u00B8', '\u00B9', '\u00BA', '\u00BB', '\u00BC', '\u00BD', '\u00BE', '\u00BF',
/* C0 */'a', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i',
/* D0 */'\u00D0', '\u00D1', 'o', 'o', 'o', 'o', 'o', 'o', '\u00D8', 'u', 'u', 'u', 'u', 'y', '\u00DE', '\u00DF',
/* E0 */'a', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i',
/* F0 */'o', 'n', 'o', 'o', 'o', 'o', 'o', '\u00F7', '-', 'u', 'u', 'u', 'u', 'y', '-', 'y' };
private static int[] rewritingParameterMapping = { /* 00 */NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
NONE, NONE, /* 10 */NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, /* 20 */'-', NONE,
NONE, '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', /* 30 */'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '-',
'-', '-', '-', '-', /* 40 */'\u0040', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', /* 50 */'p', 'q', 'r',
's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '-', '-', '-', '-', '-', /* 60 */'-', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065', '\u0066',
'\u0067', '\u0068', '\u0069', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E', '\u006F', /* 70 */'\u0070', '\u0071', '\u0072', '\u0073',
'\u0074', '\u0075', '\u0076', '\u0077', '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D', '-', '-', /* 80 */NONE, NONE, NONE,
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, /* 90 */NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, /* A0 */'\u00A0', '\u00A1', '\u00A2', '\u00A3', '\u00A4', '\u00A5', '\u00A6', '\u00A7',
'\u00A8', '\u00A9', '\u00AA', '\u00AB', '\u00AC', '\u00AD', '\u00AE', '\u00AF', /* B0 */'-', '\u00B1', '\u00B2', '\u00B3', '\u00B4',
'\u00B5', '\u00B6', '\u00B7', '\u00B8', '\u00B9', '\u00BA', '\u00BB', '\u00BC', '\u00BD', '\u00BE', '\u00BF', /* C0 */'a', 'a', 'a', 'a',
'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', /* D0 */'\u00D0', '\u00D1', 'o', 'o', 'o', 'o', 'o', 'o', '\u00D8', 'u', 'u',
'u', 'u', 'y', '\u00DE', '\u00DF', /* E0 */'a', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', /* F0 */'o',
'n', 'o', 'o', 'o', 'o', 'o', '\u00F7', '-', 'u', 'u', 'u', 'u', 'y', '-', 'y' };
/**
* Matches.
*
* @param url
* @return
* the url
* @return true, if successful
*/
public static boolean matches(final String url)
{
@ -96,6 +95,14 @@ public class ShortURLRewriter
* => rewriteShorturl("/good/article", "xhtml", "123", "Story's aboute me");
* => "/good/article-123-today-story-s-about-me.xhtml"
* </pre>
*
* @param uri
* the uri
* @param extension
* the extension
* @param parameters
* the parameters
* @return the string
*/
public static String rewrite(final String uri, final String extension, final String... parameters)
{
@ -125,9 +132,11 @@ public class ShortURLRewriter
}
/**
* Rewrite parameter.
*
* @param parameter
* @return
* the parameter
* @return the string
*/
public static String rewriteParameter(final String parameter)
{
@ -175,11 +184,11 @@ public class ShortURLRewriter
}
/**
*
* article.xhtm?id=123 -> article.xhtml
*
* @param source
* @return
* the source
* @return the string
*/
public static String unrewrite(final String source)
{
@ -203,7 +212,11 @@ public class ShortURLRewriter
}
/**
* Unrewrite parameter.
*
* @param request
* the request
* @return the string
*/
public static String unrewriteParameter(final HttpServletRequest request)
{
@ -217,6 +230,10 @@ public class ShortURLRewriter
/**
* Return value of the first parameter.
*
* @param path
* the path
* @return the string
*/
public static String unrewriteParameter(final String path)
{
@ -238,7 +255,11 @@ public class ShortURLRewriter
}
/**
* Unrewrite parameters.
*
* @param request
* the request
* @return the string[]
*/
public static String[] unrewriteParameters(final HttpServletRequest request)
{
@ -252,6 +273,10 @@ public class ShortURLRewriter
/**
* Extract value from a path. Example: "/article-123.xhtml" => "123".
*
* @param path
* the path
* @return the string[]
*/
public static String[] unrewriteParameters(final String path)
{

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
import java.io.IOException;
@ -29,14 +29,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* The Class StatisticsHook.
*/
public class StatisticsHook extends HookCore
{
private static Logger logger = LoggerFactory.getLogger(StatisticsHook.class);
/**
*
* Instantiates a new statistics hook.
*/
public StatisticsHook()
{
@ -45,23 +45,8 @@ public class StatisticsHook extends HookCore
setTerminal(false);
}
/**
* @throws IOException
*
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException
{
logger.debug("Doing catch.");
// TODO store statistics.
}
/**
*
* @param urlPath
* @return
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#matches(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest)
*/
@Override
public boolean matches(final ServletContext servletContext, final HttpServletRequest request)
@ -73,4 +58,16 @@ public class StatisticsHook extends HookCore
//
return result;
}
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#process(javax.servlet.ServletConfig, javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException
{
logger.debug("Doing catch.");
// TODO store statistics.
}
}

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
import java.io.File;
import java.io.IOException;
@ -30,47 +30,25 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.KissDispatcherUtils;
import fr.devinsy.kiss4web.dispatcher.KissDispatcherUtils;
/**
*
* The Class WebContentHook.
*/
public class WebContentHook extends HookCore
{
private static Logger logger = LoggerFactory.getLogger(WebContentHook.class);
/**
*
* Instantiates a new web content hook.
*/
public WebContentHook()
{
super();
}
/**
* @throws IOException
* @throws ServletException
*
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String path = servletContext.getRealPath("/") + request.getPathInfo();
logger.info("path=[{}]", path);
String mimeType = servletContext.getMimeType(path);
KissDispatcherUtils.returnInlineFile(response, new File(path), mimeType);
logger.info("File returned directly [{}] with mimetype [{}].", path, servletContext.getMimeType(path));
}
/**
*
* @param urlPath
* @return
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#matches(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest)
*/
@Override
public boolean matches(final ServletContext servletContext, final HttpServletRequest request)
@ -89,4 +67,22 @@ public class WebContentHook extends HookCore
//
return result;
}
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#process(javax.servlet.ServletConfig, javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String path = servletContext.getRealPath("/") + request.getPathInfo();
logger.info("path=[{}]", path);
String mimeType = servletContext.getMimeType(path);
KissDispatcherUtils.returnInlineFile(response, new File(path), mimeType);
logger.info("File returned directly [{}] with mimetype [{}].", path, servletContext.getMimeType(path));
}
}

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
import java.io.File;
import java.io.IOException;
@ -30,48 +30,25 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.KissDispatcherUtils;
import fr.devinsy.kiss4web.dispatcher.KissDispatcherUtils;
/**
*
* The Class WebInfHook.
*/
public class WebInfHook extends HookCore
{
private static Logger logger = LoggerFactory.getLogger(WebInfHook.class);
/**
*
* Instantiates a new web inf hook.
*/
public WebInfHook()
{
super();
}
/**
* @throws IOException
* @throws ServletException
*
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String path = servletContext.getRealPath("/") + "WEB-INF/classes/website" + request.getPathInfo();
logger.info("path=[{}]", path);
String mimeType = servletContext.getMimeType(path);
KissDispatcherUtils.returnInlineFile(response, new File(path), mimeType);
logger.info("File returned directly [{}] with mimetype [{}].", path, servletContext.getMimeType(path));
}
/**
*
* @param urlPath
* @return
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#matches(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest)
*/
@Override
public boolean matches(final ServletContext servletContext, final HttpServletRequest request)
@ -90,4 +67,23 @@ public class WebInfHook extends HookCore
//
return result;
}
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#process(javax.servlet.ServletConfig, javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String path = servletContext.getRealPath("/") + "WEB-INF/classes/website" + request.getPathInfo();
logger.info("path=[{}]", path);
String mimeType = servletContext.getMimeType(path);
KissDispatcherUtils.returnInlineFile(response, new File(path), mimeType);
logger.info("File returned directly [{}] with mimetype [{}].", path, servletContext.getMimeType(path));
}
}

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
* Copyright (C) 2006-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.hooks;
package fr.devinsy.kiss4web.dispatcher.hooks;
import java.io.IOException;
@ -29,42 +29,25 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.KissDispatcherUtils;
import fr.devinsy.kiss4web.dispatcher.KissDispatcherUtils;
/**
*
* The Class XHTMLHook.
*/
public class XHTMLHook extends HookCore
{
private static Logger logger = LoggerFactory.getLogger(XHTMLHook.class);
/**
*
* Instantiates a new XHTML hook.
*/
public XHTMLHook()
{
super();
}
/**
* @throws IOException
* @throws ServletException
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String urlPath = request.getPathInfo();
KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, urlPath);
}
/**
*
* @param urlPath
* @return
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#matches(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest)
*/
@Override
public boolean matches(final ServletContext servletContext, final HttpServletRequest request)
@ -86,4 +69,17 @@ public class XHTMLHook extends HookCore
return result;
}
/* (non-Javadoc)
* @see fr.devinsy.kiss4web.hooks.Hook#process(javax.servlet.ServletConfig, javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void process(final ServletConfig servletConfig, final ServletContext servletContext, final HttpServletRequest request,
final HttpServletResponse response) throws IOException, ServletException
{
logger.debug("Doing catch.");
String urlPath = request.getPathInfo();
KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, urlPath);
}
}

View file

@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
import fr.devinsy.kiss4web.KissDispatcherUtils;
import fr.devinsy.kiss4web.dispatcher.KissDispatcherUtils;
/**
* Kiss4Web tests.

View file

@ -23,8 +23,8 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.hooks.BlankHook;
import fr.devinsy.kiss4web.hooks.ShortURLHook;
import fr.devinsy.kiss4web.dispatcher.hooks.BlankHook;
import fr.devinsy.kiss4web.dispatcher.hooks.ShortURLHook;
import fr.devinsy.kiss4web.mocks.HttpServletRequestMock;
/**

View file

@ -23,8 +23,8 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.hooks.RootHook;
import fr.devinsy.kiss4web.hooks.ShortURLHook;
import fr.devinsy.kiss4web.dispatcher.hooks.RootHook;
import fr.devinsy.kiss4web.dispatcher.hooks.ShortURLHook;
import fr.devinsy.kiss4web.mocks.HttpServletRequestMock;
/**

View file

@ -44,7 +44,7 @@ import javax.servlet.http.Part;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.hooks.ShortURLHook;
import fr.devinsy.kiss4web.dispatcher.hooks.ShortURLHook;
/**
*