Introduce WSF_COMPRESSION and applied to WSF_*_WITH_COMPRESSION classes.

Modified the example to send the file with or without compression.
This commit is contained in:
Jocelyn Fiat
2017-09-01 18:59:18 +02:00
parent 267655d7bc
commit a7d0398ec6
6 changed files with 344 additions and 270 deletions

View File

@@ -28,17 +28,26 @@ feature {NONE} -- Initialization
setup_router
local
fhdl: WSF_FILE_SYSTEM_HANDLER_WITH_COMPRESSION
fhdl_with_compression: WSF_FILE_SYSTEM_HANDLER_WITH_COMPRESSION
fhdl: WSF_FILE_SYSTEM_HANDLER
do
create fhdl_with_compression.make_hidden ("www")
fhdl_with_compression.set_directory_index (<<"index.html">>)
fhdl_with_compression.compression.set_default_compression_format
fhdl_with_compression.compression.enable_compression_for_media_type ({HTTP_MIME_TYPES}.image_jpg)
fhdl_with_compression.set_not_found_handler (agent (ia_uri: READABLE_STRING_8; ia_req: WSF_REQUEST; ia_res: WSF_RESPONSE)
do
execute_default (ia_req, ia_res)
end)
router.handle ("/compressed/", fhdl_with_compression, router.methods_GET)
create fhdl.make_hidden ("www")
fhdl.set_directory_index (<<"index.html">>)
fhdl.set_default_compression_format
fhdl.enable_compression_for_media_type ({HTTP_MIME_TYPES}.image_jpg)
fhdl.set_not_found_handler (agent (ia_uri: READABLE_STRING_8; ia_req: WSF_REQUEST; ia_res: WSF_RESPONSE)
do
execute_default (ia_req, ia_res)
end)
router.handle_with_request_methods ("/", fhdl, router.methods_GET)
router.handle ("/", fhdl, router.methods_GET)
end