Added HTTP_FILE_EXTENSION_MIME_MAPPING
Added REQUEST_FILE_SYSTEM_HANDLER to the router library Added file system handler in "hello_routed_world" example
This commit is contained in:
9
examples/hello_routed_world/htdocs/dft/index.html
Normal file
9
examples/hello_routed_world/htdocs/dft/index.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Hello Eiffel::default</title>
|
||||
<link rel="stylesheet" href="../style.css" type="text/css" media="all" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello Eiffel Default World</h1>
|
||||
</body>
|
||||
</html>
|
||||
9
examples/hello_routed_world/htdocs/home.html
Normal file
9
examples/hello_routed_world/htdocs/home.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Hello Eiffel</title>
|
||||
<link rel="stylesheet" href="style.css" type="text/css" media="all" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello Eiffel World :D</h1>
|
||||
</body>
|
||||
</html>
|
||||
BIN
examples/hello_routed_world/htdocs/htdocs.zip
Normal file
BIN
examples/hello_routed_world/htdocs/htdocs.zip
Normal file
Binary file not shown.
1
examples/hello_routed_world/htdocs/style.css
Normal file
1
examples/hello_routed_world/htdocs/style.css
Normal file
@@ -0,0 +1 @@
|
||||
h1 { border: solid 1px #00f; margin: 5px; padding: 5px; }
|
||||
1479
examples/hello_routed_world/mime.types
Normal file
1479
examples/hello_routed_world/mime.types
Normal file
File diff suppressed because it is too large
Load Diff
@@ -37,8 +37,13 @@ feature {NONE} -- Initialization
|
||||
local
|
||||
ra: REQUEST_AGENT_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
|
||||
hello: REQUEST_URI_TEMPLATE_ROUTING_HANDLER
|
||||
www: REQUEST_FILE_SYSTEM_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
|
||||
do
|
||||
router.map_agent ("/home", agent execute_home)
|
||||
create www.make (document_root)
|
||||
www.set_directory_index (<<"index.html">>)
|
||||
|
||||
router.map ("/www{/path}{?query}", www)
|
||||
|
||||
--| Map all "/hello*" using a ROUTING_HANDLER
|
||||
create hello.make (3)
|
||||
@@ -60,6 +65,21 @@ feature {NONE} -- Initialization
|
||||
router.map_agent_with_request_methods ("/method/custom", agent handle_method_post, <<"POST">>)
|
||||
end
|
||||
|
||||
|
||||
document_root: READABLE_STRING_8
|
||||
local
|
||||
e: EXECUTION_ENVIRONMENT
|
||||
dn: DIRECTORY_NAME
|
||||
once
|
||||
create e
|
||||
create dn.make_from_string (e.current_working_directory)
|
||||
dn.extend ("htdocs")
|
||||
Result := dn.string
|
||||
if Result[Result.count] = Operating_environment.directory_separator then
|
||||
Result := Result.substring (1, Result.count - 1)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute_default (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
|
||||
Reference in New Issue
Block a user