Reused string constants from HTTP_HEADER_NAMES

This commit is contained in:
2013-09-24 15:27:02 +02:00
parent 88192335b6
commit 843955b7b8
5 changed files with 17 additions and 14 deletions

View File

@@ -23,7 +23,7 @@ feature -- Change Element
set_variant_header set_variant_header
-- Set variant header as `Accept-Charset' -- Set variant header as `Accept-Charset'
do do
variant_header := "Accept-Charset" variant_header := {HTTP_HEADER_NAMES}.header_accept_charset -- "Accept-Charset"
end end
note note

View File

@@ -22,7 +22,7 @@ feature -- Change Element
set_variant_header set_variant_header
-- Set variant_header as `Accept-Encoding' -- Set variant_header as `Accept-Encoding'
do do
variant_header := "Accept-Encoding" variant_header := {HTTP_HEADER_NAMES}.header_accept_encoding -- "Accept-Encoding"
end end
note note

View File

@@ -15,17 +15,14 @@ inherit
VARIANT_RESULTS VARIANT_RESULTS
feature -- Change Element feature -- Change Element
set_variant_header set_variant_header
-- Set variant header as 'Accept-Language' -- Set variant header as 'Accept-Language'
do do
variant_header := "Accept-Language" variant_header := {HTTP_HEADER_NAMES}.header_accept_language -- "Accept-Language"
end end
note note
copyright: "2011-2013, Javier Velilla, Jocelyn Fiat, Eiffel Software and others" copyright: "2011-2013, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"

View File

@@ -3,7 +3,7 @@ note
{MEDIA_TYPE_VARIANT_RESULTS}. {MEDIA_TYPE_VARIANT_RESULTS}.
Represent the media type results between client preferences and media type variants supported by the server.. Represent the media type results between client preferences and media type variants supported by the server..
If the server is unable to supports the requested Accept values, the server can build If the server is unable to supports the requested Accept values, the server can build
a response with the list of supported representations a response with the list of supported representations
]" ]"
date: "$Date$" date: "$Date$"
revision: "$Revision$" revision: "$Revision$"
@@ -15,16 +15,14 @@ inherit
VARIANT_RESULTS VARIANT_RESULTS
feature -- Change Element feature -- Change Element
set_variant_header set_variant_header
-- Set variant header as `Accept' -- Set variant header as `Accept'
do do
variant_header := "Accept" variant_header := {HTTP_HEADER_NAMES}.header_accept -- "Accept"
end end
note note
copyright: "2011-2013, Javier Velilla, Jocelyn Fiat, Eiffel Software and others" copyright: "2011-2013, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"

View File

@@ -18,11 +18,15 @@ feature -- Access
-- is the current variant accepted? -- is the current variant accepted?
type: detachable READABLE_STRING_8 type: detachable READABLE_STRING_8
-- the type could be: media type, language, chracter_sets and encoding. -- Associated type, it could be:
-- media type
-- language
-- character_sets
-- encoding.
feature {NONE} -- Implementation feature {NONE} -- Implementation
accept_headers_set: ARRAY[READABLE_STRING_8] accept_headers_set: ARRAY [READABLE_STRING_8]
-- Set of valid accept headers headers -- Set of valid accept headers headers
note note
EIS:"name=Accept", "src=http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1", "protocol=uri" EIS:"name=Accept", "src=http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1", "protocol=uri"
@@ -30,7 +34,12 @@ feature {NONE} -- Implementation
EIS:"name=Accept-Encoding", "src=http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3", "protocol=uri" EIS:"name=Accept-Encoding", "src=http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3", "protocol=uri"
EIS:"name=Accept-Language", "src=http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4", "protocol=uri" EIS:"name=Accept-Language", "src=http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4", "protocol=uri"
once once
Result:= <<"Accept","Accept-Language","Accept-Encoding","Accept-Charset">> Result:= <<
{HTTP_HEADER_NAMES}.header_accept, -- "Accept",
{HTTP_HEADER_NAMES}.header_accept_language, -- "Accept-Language",
{HTTP_HEADER_NAMES}.header_accept_encoding, -- "Accept-Encoding",
{HTTP_HEADER_NAMES}.header_accept_charset --"Accept-Charset"
>>
Result.compare_objects Result.compare_objects
end end
@@ -44,7 +53,6 @@ feature -- Status_Report
feature -- Change Element feature -- Change Element
set_type (a_type: READABLE_STRING_8) set_type (a_type: READABLE_STRING_8)
-- Set `type' as `a_type' -- Set `type' as `a_type'
do do