diff --git a/library/server/wsf/extension/filter/wsf_debug_filter.e b/library/server/wsf/extension/filter/wsf_debug_filter.e new file mode 100644 index 00000000..6563f425 --- /dev/null +++ b/library/server/wsf/extension/filter/wsf_debug_filter.e @@ -0,0 +1,117 @@ +note + description: "Summary description for {WSF_DEBUG_FILTER}." + date: "$Date: 2013-05-23 21:54:29 +0200 (jeu., 23 mai 2013) $" + revision: "$Revision: 92585 $" + +class + WSF_DEBUG_FILTER + +inherit + WSF_FILTER + +create + default_create, + make + +feature {NONE} -- Initialization + + make (a_output: FILE) + do + output := a_output + end + + output: detachable FILE + +feature -- Basic operations + + execute (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Execute the filter + local + s: STRING_8 + do + create s.make (2048) + if attached req.content_type as l_type then + s.append ("[length=") + s.append_natural_64 (req.content_length_value) + s.append_character (']') + s.append_character (' ') + s.append (l_type.debug_output) + s.append_character ('%N') + end + + append_iterable_to ("Path parameters", req.path_parameters, s) + append_iterable_to ("Query parameters", req.query_parameters, s) + append_iterable_to ("Form parameters", req.form_parameters, s) + + if not s.is_empty then + s.prepend ("**DEBUG**%N") + if attached output as o then + o.put_string (s) + else + res.put_error (s) + end + end + execute_next (req, res) + end + + append_iterable_to (a_title: READABLE_STRING_8; it: detachable ITERABLE [WSF_VALUE]; s: STRING_8) + local + n: INTEGER + do + if it /= Void then + across it as c loop + n := n + 1 + end + if n > 0 then + s.append (a_title) + s.append_character (':') + s.append_character ('%N') + across + it as c + loop + s.append (" - ") + s.append (c.item.url_encoded_name) + s.append_character (' ') + s.append_character ('{') + s.append (c.item.generating_type) + s.append_character ('}') + s.append_character ('=') + s.append (c.item.debug_output.as_string_8) + s.append_character ('%N') + end + end + end + end + +note + copyright: "Copyright (c) 1984-2013, Eiffel Software" + license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)" + licensing_options: "http://www.eiffel.com/licensing" + copying: "[ + This file is part of Eiffel Software's Eiffel Development Environment. + + Eiffel Software's Eiffel Development Environment is free + software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published + by the Free Software Foundation, version 2 of the License + (available at the URL listed under "license" above). + + Eiffel Software's Eiffel Development Environment 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 General Public License for more details. + + You should have received a copy of the GNU General Public + License along with Eiffel Software's Eiffel Development + Environment; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + ]" + source: "[ + Eiffel Software + 5949 Hollister Ave., Goleta, CA 93117 USA + Telephone 805-685-1006, Fax 805-685-6869 + Website http://www.eiffel.com + Customer support http://support.eiffel.com + ]" +end diff --git a/library/server/wsf/extension/handler/wsf_debug_handler.e b/library/server/wsf/extension/handler/wsf_debug_handler.e new file mode 100644 index 00000000..196a3aff --- /dev/null +++ b/library/server/wsf/extension/handler/wsf_debug_handler.e @@ -0,0 +1,174 @@ +note + description: "Summary description for {WSF_DEBUG_HANDLER}." + author: "" + date: "$Date: 2013-06-28 16:14:02 +0200 (ven., 28 juin 2013) $" + revision: "$Revision: 92754 $" + +class + WSF_DEBUG_HANDLER + +inherit + WSF_STARTS_WITH_HANDLER + rename + execute as execute_starts_with + end + + WSF_SELF_DOCUMENTED_HANDLER + + SHARED_HTML_ENCODER + + SHARED_WSF_PERCENT_ENCODER + rename + percent_encoder as url_encoder + export + {NONE} all + end + + SHARED_EXECUTION_ENVIRONMENT + export + {NONE} all + end + +create + make, + make_hidden + +feature {NONE} -- Initialization + + make + do + end + + make_hidden + do + make + is_hidden := True + end + + is_hidden: BOOLEAN + -- Current mapped handler should be hidden from self documentation + +feature -- Documentation + + mapping_documentation (m: WSF_ROUTER_MAPPING; a_request_methods: detachable WSF_REQUEST_METHODS): WSF_ROUTER_MAPPING_DOCUMENTATION + -- + do + create Result.make (m) + Result.set_is_hidden (is_hidden) + Result.add_description ("Debug handler (mainly to return request information)") + end + +feature -- Access + + execute_starts_with (a_path: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE) + local + s: STRING_8 + p: WSF_PAGE_RESPONSE + v: STRING_8 + do + if (create {RT_DEBUGGER}).rt_workbench_wait_for_debugger (1050) then + end + create s.make (2048) + s.append ("**DEBUG**%N") + req.set_raw_input_data_recorded (True) + + append_iterable_to ("Meta variables:", req.meta_variables, s) + s.append_character ('%N') + + append_iterable_to ("Path parameters", req.path_parameters, s) + s.append_character ('%N') + + append_iterable_to ("Query parameters", req.query_parameters, s) + s.append_character ('%N') + + append_iterable_to ("Form parameters", req.form_parameters, s) + s.append_character ('%N') + + if attached req.content_type as l_type then + s.append ("Content: type=" + l_type.debug_output) + s.append (" length=") + s.append_natural_64 (req.content_length_value) + s.append_character ('%N') + create v.make (req.content_length_value.to_integer_32) + req.read_input_data_into (v) + across + v.split ('%N') as v_cursor + loop + s.append (" |") + s.append (v_cursor.item) + s.append_character ('%N') + end + end + + create p.make_with_body (s) + p.header.put_content_type_text_plain + res.send (p) + + end + +feature {NONE} -- Implementation + + append_iterable_to (a_title: READABLE_STRING_8; it: detachable ITERABLE [WSF_VALUE]; s: STRING_8) + local + n: INTEGER + t: READABLE_STRING_8 + v: READABLE_STRING_8 + do + s.append (a_title) + s.append_character (':') + if it /= Void then + across it as c loop + n := n + 1 + end + if n = 0 then + s.append (" empty") + s.append_character ('%N') + else + s.append_character ('%N') + across + it as c + loop + s.append (" - ") + s.append (c.item.url_encoded_name) + t := c.item.generating_type + if t.same_string ("WSF_STRING") then + else + s.append_character (' ') + s.append_character ('{') + s.append (t) + s.append_character ('}') + end + s.append_character ('=') + v := c.item.string_representation.as_string_8 + if v.has ('%N') then + s.append_character ('%N') + across + v.split ('%N') as v_cursor + loop + s.append (" |") + s.append (v_cursor.item) + s.append_character ('%N') + end + else + s.append (v) + s.append_character ('%N') + end + end + end + else + s.append (" none") + s.append_character ('%N') + end + end + +note + copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" + license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" + source: "[ + Eiffel Software + 5949 Hollister Ave., Goleta, CA 93117 USA + Telephone 805-685-1006, Fax 805-685-6869 + Website http://www.eiffel.com + Customer support http://support.eiffel.com + ]" +end diff --git a/library/server/wsf/extension/wsf_handler_helper.e b/library/server/wsf/extension/handler/wsf_handler_helper.e similarity index 100% rename from library/server/wsf/extension/wsf_handler_helper.e rename to library/server/wsf/extension/handler/wsf_handler_helper.e diff --git a/library/server/wsf/extension/wsf_handler_routes_recorder.e b/library/server/wsf/extension/handler/wsf_handler_routes_recorder.e similarity index 100% rename from library/server/wsf/extension/wsf_handler_routes_recorder.e rename to library/server/wsf/extension/handler/wsf_handler_routes_recorder.e diff --git a/library/server/wsf/extension/wsf_method_handler.e b/library/server/wsf/extension/handler/wsf_method_handler.e similarity index 100% rename from library/server/wsf/extension/wsf_method_handler.e rename to library/server/wsf/extension/handler/wsf_method_handler.e diff --git a/library/server/wsf/extension/wsf_method_handlers.e b/library/server/wsf/extension/handler/wsf_method_handlers.e similarity index 100% rename from library/server/wsf/extension/wsf_method_handlers.e rename to library/server/wsf/extension/handler/wsf_method_handlers.e diff --git a/library/server/wsf/extension/wsf_resource_context_handler_helper.e b/library/server/wsf/extension/handler/wsf_resource_context_handler_helper.e similarity index 100% rename from library/server/wsf/extension/wsf_resource_context_handler_helper.e rename to library/server/wsf/extension/handler/wsf_resource_context_handler_helper.e diff --git a/library/server/wsf/extension/wsf_resource_handler_helper.e b/library/server/wsf/extension/handler/wsf_resource_handler_helper.e similarity index 100% rename from library/server/wsf/extension/wsf_resource_handler_helper.e rename to library/server/wsf/extension/handler/wsf_resource_handler_helper.e diff --git a/library/server/wsf/router/filter/wsf_custom_header_filter.e b/library/server/wsf/router/filter/wsf_custom_header_filter.e new file mode 100644 index 00000000..57933ade --- /dev/null +++ b/library/server/wsf/router/filter/wsf_custom_header_filter.e @@ -0,0 +1,66 @@ +note + description: "Summary description for {WSF_CUSTOM_HEADER_FILTER}." + date: "$Date: 2013-05-23 21:54:29 +0200 (jeu., 23 mai 2013) $" + revision: "$Revision: 92585 $" + +class + WSF_CUSTOM_HEADER_FILTER + +inherit + WSF_FILTER + +create + make + +feature {NONE} -- Initialization + + make (n: INTEGER) + do + create custom_header.make_with_count (n) + end + +feature -- Access + + custom_header: HTTP_HEADER + +feature -- Basic operations + + execute (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Execute the filter + do + res.put_header_lines (custom_header) + execute_next (req, res) + end + +note + copyright: "Copyright (c) 1984-2013, Eiffel Software" + license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)" + licensing_options: "http://www.eiffel.com/licensing" + copying: "[ + This file is part of Eiffel Software's Eiffel Development Environment. + + Eiffel Software's Eiffel Development Environment is free + software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published + by the Free Software Foundation, version 2 of the License + (available at the URL listed under "license" above). + + Eiffel Software's Eiffel Development Environment 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 General Public License for more details. + + You should have received a copy of the GNU General Public + License along with Eiffel Software's Eiffel Development + Environment; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + ]" + source: "[ + Eiffel Software + 5949 Hollister Ave., Goleta, CA 93117 USA + Telephone 805-685-1006, Fax 805-685-6869 + Website http://www.eiffel.com + Customer support http://support.eiffel.com + ]" +end