Improved the simple_file example with image, and not found message.
Use standalone connector in SCOOP concurrency mode.
This commit is contained in:
12
examples/simple_file/404.html
Normal file
12
examples/simple_file/404.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>404 not found!</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>404 not found!</h1>
|
||||
This is a static html file served by EWF.
|
||||
<img src="ewf.png"/>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
BIN
examples/simple_file/ewf.png
Normal file
BIN
examples/simple_file/ewf.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -5,7 +5,9 @@
|
||||
|
||||
<body>
|
||||
<h1>EWF simple_file example</h1>
|
||||
This is a static html file served by EWF.
|
||||
<p>This is a static html file served by EWF.</p>
|
||||
<p>Try to <a href="nowhere.html">get lost</a>.</p>
|
||||
<a href="ewf.png"><img src="ewf.png"/></a>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-9-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-9-0 http://www.eiffel.com/developers/xml/configuration-1-9-0.xsd" name="service_file" uuid="C28C4F53-9963-46C0-A080-8F13E94E7486">
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="service_file" uuid="C28C4F53-9963-46C0-A080-8F13E94E7486">
|
||||
<target name="service_file">
|
||||
<root class="SERVICE_FILE" feature="make_and_launch"/>
|
||||
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="transitional" syntax="transitional">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="concurrency" value="scoop"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="connector_standalone" location="..\..\library\server\ewsgi\connectors\standalone\standalone-safe.ecf"/>
|
||||
<library name="default_standalone" location="..\..\library\server\wsf\default\standalone-safe.ecf"/>
|
||||
<library name="http" location="../../library/network/protocol/http/http-safe.ecf"/>
|
||||
<library name="http" location="..\..\library\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf"/>
|
||||
<cluster name="service_file" location=".\" recursive="true">
|
||||
<file_rule>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {SERVICE_FILE_EXECUTION}."
|
||||
author: ""
|
||||
description: "Simple file execution, serving home.html, ewf.png and 404.html"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -17,10 +16,20 @@ feature {NONE} -- Initialization
|
||||
|
||||
execute
|
||||
local
|
||||
f: WSF_FILE_RESPONSE
|
||||
mesg: WSF_RESPONSE_MESSAGE
|
||||
not_found: WSF_NOT_FOUND_RESPONSE
|
||||
do
|
||||
create f.make_html ("home.html")
|
||||
response.send (f)
|
||||
if request.path_info.is_case_insensitive_equal_general ("/") then
|
||||
create {WSF_FILE_RESPONSE} mesg.make_html ("home.html")
|
||||
elseif request.path_info.is_case_insensitive_equal_general ("/ewf.png") then
|
||||
create {WSF_FILE_RESPONSE} mesg.make_with_content_type ({HTTP_MIME_TYPES}.image_png ,"ewf.png")
|
||||
else
|
||||
create not_found.make (request)
|
||||
not_found.add_suggested_location (request.absolute_script_url (""), "Home", "Back to home page")
|
||||
|
||||
mesg := not_found
|
||||
end
|
||||
response.send (mesg)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user