Permalink
Browse files

added missing wsf_routing_filter

  • Loading branch information...
1 parent 28186ef commit 94a91fa4aa69eb3ceb6985f7de7ab443c7f5d851 @jocelyn jocelyn committed Sep 26, 2012
Showing with 75 additions and 0 deletions.
  1. +75 −0 library/server/wsf/src/filter/wsf_routing_filter.e
@@ -0,0 +1,75 @@
+note
+ description: "Routing filter."
+ author: "Olivier Ligot"
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ WSF_ROUTING_FILTER
+
+inherit
+ WSF_FILTER
+
+create
+ make
+
+feature {NONE} -- Initialization
+
+ make (a_router: WSF_ROUTER)
+ do
+ router := a_router
+ ensure
+ router_set: router = a_router
+ end
+
+feature -- Access
+
+ router: WSF_ROUTER
+ -- Router
+
+ execute_default_action: detachable PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]
+ -- `execute_default' action
+
+feature -- Element change
+
+ set_execute_default_action (an_action: like execute_default_action)
+ -- Set `execute_default_action' to `an_action'
+ do
+ execute_default_action := an_action
+ ensure
+ execute_default_action_set: execute_default_action = an_action
+ end
+
+feature -- Basic operations
+
+ execute (req: WSF_REQUEST; res: WSF_RESPONSE)
+ -- Execute the filter
+ do
+ if attached router.dispatch_and_return_handler (req, res) then
+ check router.is_dispatched end
+ else
+ execute_default (req, res)
+ end
+ execute_next (req, res)
+ end
+
+ execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
+ do
+ if attached execute_default_action as action then
+ action.call ([req, res])
+ else
+ do_nothing
+ end
+ end
+
+note
+ copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

0 comments on commit 94a91fa

Please sign in to comment.