Gave symbolic names to execution variables used by the framework

This commit is contained in:
Colin Adams
2013-08-13 15:47:59 +01:00
parent b074570e99
commit c93e50a7e2
2 changed files with 28 additions and 8 deletions

View File

@@ -204,7 +204,7 @@ feature -- Content negotiation
else else
if attached l_lang.language_type as l_language_type then if attached l_lang.language_type as l_language_type then
h.put_content_language (l_language_type) h.put_content_language (l_language_type)
req.set_execution_variable ("NEGOTIATED_LANGUAGE", l_language_type) req.set_execution_variable (a_handler.Negotiated_language_execution_variable, l_language_type)
end end
l_charsets := a_handler.charsets_supported (req) l_charsets := a_handler.charsets_supported (req)
l_charset := l_conneg.charset_preference (l_charsets, req.http_accept_charset) l_charset := l_conneg.charset_preference (l_charsets, req.http_accept_charset)
@@ -217,11 +217,11 @@ feature -- Content negotiation
if attached l_media.media_type as l_media_type then if attached l_media.media_type as l_media_type then
if attached l_charset.character_type as l_character_type then if attached l_charset.character_type as l_character_type then
h.put_content_type (l_media_type + "; charset=" + l_character_type) h.put_content_type (l_media_type + "; charset=" + l_character_type)
req.set_execution_variable ("NEGOTIATED_CHARSET", l_charset) req.set_execution_variable (a_handler.Negotiated_charset_execution_variable, l_charset)
else else
h.put_content_type (l_media_type) h.put_content_type (l_media_type)
end end
req.set_execution_variable ("NEGOTIATED_MEDIA_TYPE", l_media_type) req.set_execution_variable (a_handler.Negotiated_media_type_execution_variable, l_media_type)
end end
l_encodings := a_handler.encodings_supported (req) l_encodings := a_handler.encodings_supported (req)
l_encoding := l_conneg.encoding_preference (l_encodings, req.http_accept_encoding) l_encoding := l_conneg.encoding_preference (l_encodings, req.http_accept_encoding)
@@ -233,15 +233,15 @@ feature -- Content negotiation
else else
if attached l_encoding.compression_type as l_compression_type then if attached l_encoding.compression_type as l_compression_type then
h.put_content_encoding (l_compression_type) h.put_content_encoding (l_compression_type)
req.set_execution_variable ("NEGOTIATED_ENCODING", l_compression_type) req.set_execution_variable (a_handler.Negotiated_encoding_execution_variable, l_compression_type)
end end
end end
end end
end end
end end
req.set_execution_variable ("NEGOTIATED_HTTP_HEADER", h) req.set_execution_variable (a_handler.Negotiated_http_header_execution_variable, h)
ensure ensure
header_attached: attached {HTTP_HEADER} req.execution_variable ("NEGOTIATED_HTTP_HEADER") header_attached: attached {HTTP_HEADER} req.execution_variable (a_handler.Negotiated_http_header_execution_variable)
end end
feature {NONE} -- Implementation feature {NONE} -- Implementation

View File

@@ -26,6 +26,26 @@ inherit
WSF_SELF_DOCUMENTED_HANDLER WSF_SELF_DOCUMENTED_HANDLER
feature -- Execution variables
Negotiated_language_execution_variable: STRING = "NEGOTIATED_LANGUAGE"
-- Execution variable set by framework
Negotiated_charset_execution_variable: STRING = "NEGOTIATED_CHARSET"
-- Execution variable set by framework
Negotiated_media_type_execution_variable: STRING = "NEGOTIATED_MEDIA_TYPE"
-- Execution variable set by framework
Negotiated_encoding_execution_variable: STRING = "NEGOTIATED_ENCODING"
-- Execution variable set by framework
Negotiated_http_header_execution_variable: STRING = "NEGOTIATED_HTTP_HEADER"
-- Execution variable set by framework
Request_entity_execution_variable: STRING = "REQUEST_ENTITY"
-- Execution variable set by framework
feature -- Access feature -- Access
is_chunking (req: WSF_REQUEST): BOOLEAN is_chunking (req: WSF_REQUEST): BOOLEAN
@@ -295,7 +315,7 @@ feature -- GET/HEAD content
feature -- PUT/POST feature -- PUT/POST
read_entity (req: WSF_REQUEST) read_entity (req: WSF_REQUEST)
-- Read request body and set as `req.execution_variable ("REQUEST_ENTITY")'. -- Read request body and set as `req.execution_variable (Request_entity_execution_variable)'.
require require
req_attached: req /= Void req_attached: req /= Void
local local
@@ -304,7 +324,7 @@ feature -- PUT/POST
create l_body.make_empty create l_body.make_empty
req.read_input_data_into (l_body) req.read_input_data_into (l_body)
if not l_body.is_empty then if not l_body.is_empty then
req.set_execution_variable ("REQUEST_ENTITY", l_body) req.set_execution_variable (Request_entity_execution_variable, l_body)
end end
end end