fix merge conflict from master
This commit is contained in:
@@ -13,10 +13,12 @@
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf" readonly="true"/>
|
||||
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf" readonly="true"/>
|
||||
<library name="default_nino" location="..\..\library\server\wsf\default\nino-safe.ecf" readonly="true"/>
|
||||
<library name="http" location="../../library/network/protocol/http/http-safe.ecf" readonly="true"/>
|
||||
<library name="json" location="..\..\contrib\library\text\parser\json\library\json-safe.ecf" readonly="true"/>
|
||||
<library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf" readonly="true"/>
|
||||
<library name="wsf_router_context" location="..\..\library\server\wsf\wsf_router_context-safe.ecf" readonly="true"/>
|
||||
<library name="wsf_extension" location="..\..\library\server\wsf\wsf_extension-safe.ecf" readonly="true"/>
|
||||
<library name="http_authorization" location="..\..\library\server\authentication\http_authorization\http_authorization-safe.ecf" readonly="true"/>
|
||||
<cluster name="src" location="src\" recursive="true"/>
|
||||
|
||||
@@ -10,12 +10,22 @@ class
|
||||
inherit
|
||||
ANY
|
||||
|
||||
WSF_FILTERED_SERVICE
|
||||
|
||||
WSF_HANDLER_HELPER
|
||||
|
||||
WSF_DEFAULT_SERVICE
|
||||
|
||||
WSF_ROUTED_SERVICE
|
||||
rename
|
||||
execute as execute_router
|
||||
end
|
||||
|
||||
WSF_FILTERED_SERVICE
|
||||
|
||||
WSF_FILTER
|
||||
rename
|
||||
execute as execute_router
|
||||
end
|
||||
|
||||
SHARED_EJSON
|
||||
|
||||
create
|
||||
@@ -24,29 +34,29 @@ create
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
local
|
||||
l_message: STRING
|
||||
l_factory: INET_ADDRESS_FACTORY
|
||||
do
|
||||
initialize_router
|
||||
initialize_filter
|
||||
initialize_json
|
||||
set_service_option ("port", 9090)
|
||||
set_service_option ("port", port)
|
||||
create l_message.make_empty
|
||||
l_message.append_string ("Launching filter server at ")
|
||||
create l_factory
|
||||
l_message.append_string (l_factory.create_localhost.host_name)
|
||||
l_message.append_string (" port ")
|
||||
l_message.append_integer (port)
|
||||
io.put_string (l_message)
|
||||
io.put_new_line
|
||||
make_and_launch
|
||||
end
|
||||
|
||||
create_filter
|
||||
-- Create `filter'
|
||||
local
|
||||
l_authentication_filter_hdl: AUTHENTICATION_FILTER
|
||||
l_user_filter: USER_HANDLER
|
||||
l_routing_filter: WSF_ROUTING_FILTER
|
||||
do
|
||||
create router.make (1)
|
||||
create l_authentication_filter_hdl
|
||||
create l_user_filter
|
||||
l_authentication_filter_hdl.set_next (l_user_filter)
|
||||
|
||||
router.handle_with_request_methods ("/user/{userid}", l_authentication_filter_hdl, router.methods_get)
|
||||
create l_routing_filter.make (router)
|
||||
l_routing_filter.set_execute_default_action (agent execute_default)
|
||||
filter := l_routing_filter
|
||||
create {WSF_CORS_FILTER} filter
|
||||
end
|
||||
|
||||
setup_filter
|
||||
@@ -56,6 +66,28 @@ feature {NONE} -- Initialization
|
||||
do
|
||||
create l_logging_filter
|
||||
filter.set_next (l_logging_filter)
|
||||
l_logging_filter.set_next (Current)
|
||||
end
|
||||
|
||||
setup_router
|
||||
-- Setup `router'
|
||||
local
|
||||
l_options_filter: WSF_CORS_OPTIONS_FILTER
|
||||
l_authentication_filter: AUTHENTICATION_FILTER
|
||||
l_user_filter: USER_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
do
|
||||
create l_options_filter.make (router)
|
||||
create l_authentication_filter
|
||||
create l_user_filter
|
||||
|
||||
l_options_filter.set_next (l_authentication_filter)
|
||||
l_authentication_filter.set_next (l_user_filter)
|
||||
|
||||
create l_methods
|
||||
l_methods.enable_options
|
||||
l_methods.enable_get
|
||||
router.handle_with_request_methods ("/user/{userid}", create {WSF_URI_TEMPLATE_AGENT_HANDLER}.make (agent l_options_filter.execute), l_methods)
|
||||
end
|
||||
|
||||
initialize_json
|
||||
@@ -64,26 +96,10 @@ feature {NONE} -- Initialization
|
||||
json.add_converter (create {JSON_USER_CONVERTER}.make)
|
||||
end
|
||||
|
||||
feature -- Basic operations
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
filter.execute (req, res)
|
||||
end
|
||||
|
||||
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
l_message: WSF_DEFAULT_ROUTER_RESPONSE
|
||||
do
|
||||
create l_message.make_with_router (req, router)
|
||||
l_message.set_documentation_included (True)
|
||||
res.send (l_message)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
router: WSF_ROUTER;
|
||||
-- Router
|
||||
port: INTEGER = 9090
|
||||
-- Port number
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Olivier Ligot, Jocelyn Fiat and others"
|
||||
|
||||
Reference in New Issue
Block a user