Removed WGI_RESPONSE.write (..)
Replaced any internal call to WGI_RESPONSE.write () by the associated implementation (i.e output.put_string (...) ) Added WGI_OUTPUT_STREAM.put_crlf Renamed WSF_RESPONSE.put_response (a_message) as `send (a_message)' WSF_RESPONSE_MESSAGE.send_to (res) is now exported only to WSF_RESPONSE
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {WGI_NINO_CONNECTOR}."
|
description: "Summary description for {WGI_NINO_CONNECTOR}."
|
||||||
author: ""
|
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
@@ -127,7 +126,7 @@ feature -- Server
|
|||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2012, Eiffel Software and others"
|
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -21,19 +21,24 @@ create
|
|||||||
feature -- Header output operation
|
feature -- Header output operation
|
||||||
|
|
||||||
put_header_text (a_text: READABLE_STRING_8)
|
put_header_text (a_text: READABLE_STRING_8)
|
||||||
|
local
|
||||||
|
o: like output
|
||||||
do
|
do
|
||||||
write (a_text)
|
o := output
|
||||||
|
o.put_string (a_text)
|
||||||
|
|
||||||
-- Nino does not support persistent connection for now
|
-- Nino does not support persistent connection for now
|
||||||
write ("Connection: close")
|
o.put_string ("Connection: close")
|
||||||
write (crlf)
|
o.put_crlf
|
||||||
|
|
||||||
-- end of headers
|
-- end of headers
|
||||||
write (crlf)
|
o.put_crlf
|
||||||
|
|
||||||
header_committed := True
|
header_committed := True
|
||||||
end
|
end
|
||||||
|
|
||||||
;note
|
;note
|
||||||
copyright: "2011-2012, Eiffel Software and others"
|
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -42,14 +42,6 @@ feature -- Status report
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {WGI_RESPONSE} -- Core output operation
|
|
||||||
|
|
||||||
write (s: READABLE_STRING_8)
|
|
||||||
-- Send the string `s'
|
|
||||||
-- this can be used for header and body
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Status setting
|
feature -- Status setting
|
||||||
|
|
||||||
status_is_set: BOOLEAN
|
status_is_set: BOOLEAN
|
||||||
|
|||||||
@@ -48,15 +48,6 @@ feature -- Status report
|
|||||||
Result := status_is_set and header_committed
|
Result := status_is_set and header_committed
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Core output operation
|
|
||||||
|
|
||||||
write (s: READABLE_STRING_8)
|
|
||||||
-- Send the content of `s'
|
|
||||||
-- this can be used for header and body
|
|
||||||
do
|
|
||||||
output.put_string (s)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Status setting
|
feature -- Status setting
|
||||||
|
|
||||||
status_is_set: BOOLEAN
|
status_is_set: BOOLEAN
|
||||||
@@ -81,8 +72,8 @@ feature -- Header output operation
|
|||||||
|
|
||||||
put_header_text (a_text: READABLE_STRING_8)
|
put_header_text (a_text: READABLE_STRING_8)
|
||||||
do
|
do
|
||||||
write (a_text)
|
output.put_string (a_text)
|
||||||
write (crlf)
|
output.put_crlf
|
||||||
header_committed := True
|
header_committed := True
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -126,9 +117,6 @@ feature -- Output operation
|
|||||||
|
|
||||||
feature {NONE} -- Implementation: Access
|
feature {NONE} -- Implementation: Access
|
||||||
|
|
||||||
crlf: STRING = "%R%N"
|
|
||||||
-- End of header
|
|
||||||
|
|
||||||
output: WGI_OUTPUT_STREAM
|
output: WGI_OUTPUT_STREAM
|
||||||
-- Server output channel
|
-- Server output channel
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,13 @@ feature -- Specific output
|
|||||||
-- Send `s' to http client as header line
|
-- Send `s' to http client as header line
|
||||||
do
|
do
|
||||||
put_string (s)
|
put_string (s)
|
||||||
put_string ("%R%N")
|
put_crlf
|
||||||
|
end
|
||||||
|
|
||||||
|
put_crlf
|
||||||
|
-- Send "%R%N" string
|
||||||
|
do
|
||||||
|
put_string (crlf)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Status writing
|
feature -- Status writing
|
||||||
@@ -80,6 +86,10 @@ feature -- Basic operations
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Constant
|
||||||
|
|
||||||
|
crlf: STRING = "%R%N"
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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)"
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ feature -- Execution
|
|||||||
fres.set_status_code ({HTTP_STATUS_CODE}.ok)
|
fres.set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||||
fres.set_answer_head_request_method (req.request_method.same_string ({HTTP_REQUEST_METHODS}.method_head))
|
fres.set_answer_head_request_method (req.request_method.same_string ({HTTP_REQUEST_METHODS}.method_head))
|
||||||
|
|
||||||
res.put_response (fres)
|
res.send (fres)
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_not_found (uri: READABLE_STRING_8; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
respond_not_found (uri: READABLE_STRING_8; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ feature -- Implementation
|
|||||||
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
-- Execute request handler
|
-- Execute request handler
|
||||||
do
|
do
|
||||||
response (ctx, req).send_to (res)
|
res.send (response (ctx, req))
|
||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ feature -- Element change
|
|||||||
update_content_length
|
update_content_length
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Basic operations
|
feature {WSF_RESPONSE} -- Output
|
||||||
|
|
||||||
send_to (res: WSF_RESPONSE)
|
send_to (res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ feature -- Element change
|
|||||||
body := b
|
body := b
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Output
|
feature {WSF_RESPONSE} -- Output
|
||||||
|
|
||||||
send_to (res: WSF_RESPONSE)
|
send_to (res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {WSF_PAGE_RESPONSE}."
|
description: "[
|
||||||
|
|
||||||
|
]"
|
||||||
author: ""
|
author: ""
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
@@ -77,7 +79,7 @@ feature -- Element change
|
|||||||
l_body.append (a_string)
|
l_body.append (a_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Output
|
feature {WSF_RESPONSE} -- Output
|
||||||
|
|
||||||
send_to (res: WSF_RESPONSE)
|
send_to (res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ feature -- Element change
|
|||||||
content_type := Void
|
content_type := Void
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Output
|
feature {WSF_RESPONSE} -- Output
|
||||||
|
|
||||||
send_to (res: WSF_RESPONSE)
|
send_to (res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
|
|||||||
@@ -187,15 +187,31 @@ feature -- Output operation
|
|||||||
|
|
||||||
feature -- Response object
|
feature -- Response object
|
||||||
|
|
||||||
put_response (obj: WSF_RESPONSE_MESSAGE)
|
put_response (a_message: WSF_RESPONSE_MESSAGE)
|
||||||
-- Set `obj' as the whole response to the client
|
-- Set `a_message' as the whole response to the client
|
||||||
--| `obj' is responsible to sent the status code, the header and the content
|
--| `a_message' is responsible to sent the status code, the header and the content
|
||||||
|
obsolete
|
||||||
|
"[2012-Mars-19] Use `send (a_message)' "
|
||||||
require
|
require
|
||||||
header_not_committed: not header_committed
|
header_not_committed: not header_committed
|
||||||
status_not_committed: not status_committed
|
status_not_committed: not status_committed
|
||||||
no_message_committed: not message_committed
|
no_message_committed: not message_committed
|
||||||
do
|
do
|
||||||
obj.send_to (Current)
|
a_message.send_to (Current)
|
||||||
|
ensure
|
||||||
|
status_committed: status_committed
|
||||||
|
header_committed: header_committed
|
||||||
|
end
|
||||||
|
|
||||||
|
send (a_message: WSF_RESPONSE_MESSAGE)
|
||||||
|
-- Set `a_message' as the whole response to the client
|
||||||
|
--| `a_message' is responsible to sent the status code, the header and the content
|
||||||
|
require
|
||||||
|
header_not_committed: not header_committed
|
||||||
|
status_not_committed: not status_committed
|
||||||
|
no_message_committed: not message_committed
|
||||||
|
do
|
||||||
|
a_message.send_to (Current)
|
||||||
ensure
|
ensure
|
||||||
status_committed: status_committed
|
status_committed: status_committed
|
||||||
header_committed: header_committed
|
header_committed: header_committed
|
||||||
|
|||||||
@@ -7,10 +7,17 @@ note
|
|||||||
deferred class
|
deferred class
|
||||||
WSF_RESPONSE_MESSAGE
|
WSF_RESPONSE_MESSAGE
|
||||||
|
|
||||||
feature -- Output
|
feature {WSF_RESPONSE} -- Output
|
||||||
|
|
||||||
send_to (res: WSF_RESPONSE)
|
send_to (res: WSF_RESPONSE)
|
||||||
|
require
|
||||||
|
header_not_committed: not res.header_committed
|
||||||
|
status_not_committed: not res.status_committed
|
||||||
|
no_message_committed: not res.message_committed
|
||||||
deferred
|
deferred
|
||||||
|
ensure
|
||||||
|
res_status_set: res.status_is_set
|
||||||
|
res_header_committed: res.header_committed
|
||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
|
|||||||
Reference in New Issue
Block a user