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:
Jocelyn Fiat
2011-10-14 14:13:40 +02:00
parent 4c36d75ef3
commit 1453873b6c
13 changed files with 2150 additions and 11 deletions

View 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>

View 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>

Binary file not shown.

View File

@@ -0,0 +1 @@
h1 { border: solid 1px #00f; margin: 5px; padding: 5px; }

File diff suppressed because it is too large Load Diff

View File

@@ -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)