Renamed content_negotation' as content_negotiation' (fixed typo)
Updated .ecf and Eiffel code depending on previous CONNEG
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
note
|
||||
description: "[
|
||||
{CHARACTER_ENCODING_VARIANT_RESULTS}
|
||||
Represent the character sets results between client preferences and character sets variants supported by the server.
|
||||
If the server is unable to supports the requested Accept-Charset values, the server can build
|
||||
a response with the list of supported character sets.
|
||||
]"
|
||||
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CHARACTER_ENCODING_VARIANT_RESULTS
|
||||
|
||||
inherit
|
||||
|
||||
VARIANT_RESULTS
|
||||
|
||||
|
||||
feature -- Change Element
|
||||
|
||||
|
||||
set_variant_header
|
||||
-- Set variant header as `Accept-Charset'
|
||||
do
|
||||
variant_header := "Accept-Charset"
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
end
|
||||
@@ -0,0 +1,32 @@
|
||||
note
|
||||
description: "[
|
||||
{COMPRESSION_VARIANT_RESULTS}
|
||||
Represent the compression results between client preferences and ccompression variants supported by the server.
|
||||
If the server is unable to supports the requested Accept-Encoding values, the server can build
|
||||
a response with the list of supported encodings/compressions
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
EIS: "name= Compression", "src=http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3", "protocol=uri"
|
||||
|
||||
class
|
||||
COMPRESSION_VARIANT_RESULTS
|
||||
|
||||
inherit
|
||||
|
||||
VARIANT_RESULTS
|
||||
|
||||
|
||||
feature -- Change Element
|
||||
|
||||
set_variant_header
|
||||
-- Set variant_header as `Accept-Encoding'
|
||||
do
|
||||
variant_header := "Accept-Encoding"
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
end
|
||||
@@ -0,0 +1,33 @@
|
||||
note
|
||||
description: "[
|
||||
{LANGUAGE_VARIANT_RESULTS}.
|
||||
Represent the language results between client preferences and language variants supported by the server.
|
||||
If the server is unable to supports the requested Accept-Language values, the server can build
|
||||
a response with the list of supported languages
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
LANGUAGE_VARIANT_RESULTS
|
||||
|
||||
inherit
|
||||
|
||||
VARIANT_RESULTS
|
||||
|
||||
|
||||
feature -- Change Element
|
||||
|
||||
|
||||
set_variant_header
|
||||
-- Set variant header as 'Accept-Language'
|
||||
do
|
||||
variant_header := "Accept-Language"
|
||||
end
|
||||
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
end
|
||||
@@ -0,0 +1,32 @@
|
||||
note
|
||||
description: "[
|
||||
{MEDIA_TYPE_VARIANT_RESULTS}.
|
||||
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
|
||||
a response with the list of supported representations
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
MEDIA_TYPE_VARIANT_RESULTS
|
||||
|
||||
inherit
|
||||
|
||||
VARIANT_RESULTS
|
||||
|
||||
|
||||
feature -- Change Element
|
||||
|
||||
set_variant_header
|
||||
-- Set variant header as `Accept'
|
||||
do
|
||||
variant_header := "Accept"
|
||||
end
|
||||
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
end
|
||||
@@ -0,0 +1,83 @@
|
||||
note
|
||||
description: "Generic {VARIANT_RESULTS}.with common functionality to most header variants.."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
VARIANT_RESULTS
|
||||
|
||||
feature -- Access
|
||||
|
||||
variant_header: detachable READABLE_STRING_8
|
||||
-- Name of variant header to be added to the Vary header of the response
|
||||
|
||||
supported_variants: detachable LIST [READABLE_STRING_8]
|
||||
-- Set of supported variants for the response
|
||||
|
||||
is_acceptable: BOOLEAN
|
||||
-- is the current variant accepted?
|
||||
|
||||
type: detachable READABLE_STRING_8
|
||||
-- the type could be: media type, language, chracter_sets and encoding.
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
accept_headers_set: ARRAY[READABLE_STRING_8]
|
||||
-- Set of valid accept headers headers
|
||||
note
|
||||
EIS:"name=Accept", "src=http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1", "protocol=uri"
|
||||
EIS:"name=Accept-Charset", "src=http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.2", "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"
|
||||
once
|
||||
Result:= <<"Accept","Accept-Language","Accept-Encoding","Accept-Charset">>
|
||||
Result.compare_objects
|
||||
end
|
||||
|
||||
feature -- Status_Report
|
||||
|
||||
is_valid_header (a_header: READABLE_STRING_8): BOOLEAN
|
||||
-- is `a_header' a valid accept header?
|
||||
do
|
||||
Result := accept_headers_set.has (a_header)
|
||||
end
|
||||
|
||||
feature -- Change Element
|
||||
|
||||
|
||||
set_type (a_type: READABLE_STRING_8)
|
||||
-- Set `type' as `a_type'
|
||||
do
|
||||
type := a_type
|
||||
ensure
|
||||
type_set: attached type as l_type implies l_type = a_type
|
||||
end
|
||||
|
||||
set_acceptable (acceptable: BOOLEAN)
|
||||
-- Set `is_acceptable' with `acceptable'
|
||||
do
|
||||
is_acceptable := acceptable
|
||||
ensure
|
||||
is_acceptable_set: is_acceptable = acceptable
|
||||
end
|
||||
|
||||
set_variant_header
|
||||
-- Set variant header
|
||||
deferred
|
||||
ensure
|
||||
is_valid_header_set : attached variant_header as l_header implies is_valid_header (l_header)
|
||||
end
|
||||
|
||||
set_supported_variants (a_supported: LIST [READABLE_STRING_8])
|
||||
-- Set `supported variants' with `a_supported'
|
||||
do
|
||||
supported_variants := a_supported
|
||||
ensure
|
||||
set_supported_variants: attached supported_variants as l_supported_variants implies l_supported_variants = a_supported
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user