Added class HTTP_CONTENT_TYPE to help manipulation of Content-Type value

Now WSF_REQUEST return a HTTP_CONTENT_TYPE if available
Adapted WSF_MIME_HANDLER to use this new class
Added one manual autotest to test MIME handler
This commit is contained in:
Jocelyn Fiat
2012-03-23 16:40:13 +01:00
parent ac9cbb0bd2
commit 40c6aff423
14 changed files with 741 additions and 72 deletions

View File

@@ -0,0 +1,89 @@
note
description: "Summary description for WGI_NULL_FILE_INPUT_STREAM."
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
WGI_NULL_FILE_INPUT_STREAM
inherit
WGI_NULL_INPUT_STREAM
create
make
feature {NONE} -- Initialization
make (f: FILE)
do
file := f
end
file: FILE
feature -- Input
read_character
-- Read the next character in input stream.
-- Make the result available in `last_character'
do
file.read_character
end
read_string (nb: INTEGER)
-- Read the next `nb' characters and
-- make the string result available in `last_string'
do
file.read_stream (nb)
end
feature -- Access
last_string: STRING_8
-- Last string read.
--
-- Note: this query *might* return the same object.
-- Therefore a clone should be used if the result
-- is to be kept beyond the next call to this feature.
-- However `last_string' is not shared between file objects.)
do
Result := file.last_string
end
last_character: CHARACTER_8
-- Last item read.
do
Result := file.last_character
end
feature -- Status report
is_open_read: BOOLEAN
-- Can items be read from input stream?
do
Result := file.is_open_read
end
end_of_input: BOOLEAN
-- Has the end of input stream been reached?
do
Result := file.end_of_file
end
invariant
note
copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -5,31 +5,12 @@ note
date: "$Date$"
revision: "$Revision$"
class
deferred class
WGI_NULL_INPUT_STREAM
inherit
WGI_INPUT_STREAM
undefine
read_to_string
end
CONSOLE
rename
make as console_make,
read_stream as read_string,
end_of_file as end_of_input
end
create
make
feature {NONE} -- Initialization
make
do
make_open_stdin ("stdin")
end
note
copyright: "2011-2011, Eiffel Software and others"

View File

@@ -0,0 +1,86 @@
note
description: "Summary description for WGI_NULL_STRING_INPUT_STREAM."
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
WGI_NULL_STRING_INPUT_STREAM
inherit
WGI_NULL_INPUT_STREAM
create
make
feature {NONE} -- Initialization
make (s: READABLE_STRING_8)
do
body := s
index := 1
count := s.count
last_string := ""
end
body: READABLE_STRING_8
index: INTEGER
count: INTEGER
feature -- Input
read_character
-- Read the next character in input stream.
-- Make the result available in `last_character'
do
last_character := body[index]
index := index + 1
end
read_string (nb: INTEGER)
-- Read the next `nb' characters and
-- make the string result available in `last_string'
local
e: INTEGER
do
e := (index + nb).min (count)
last_string := body.substring (index, e)
index := e + 1
end
feature -- Access
last_string: STRING_8
last_character: CHARACTER_8
feature -- Status report
is_open_read: BOOLEAN
-- Can items be read from input stream?
do
Result := True
end
end_of_input: BOOLEAN
-- Has the end of input stream been reached?
do
Result := index > count
end
invariant
note
copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end