Applied recent changes on WGI_ and WSF_
Moved classes away from ewsgi, restructured, cleaned
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WGI_CONNECTOR}."
|
||||
specification: "EWSGI/connector specification https://github.com/Eiffel-World/Eiffel-Web-Framework/wiki/EWSGI-specification"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WGI_CONNECTOR
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_app: like application)
|
||||
do
|
||||
application := a_app
|
||||
initialize
|
||||
end
|
||||
|
||||
initialize
|
||||
-- Initialize connector
|
||||
do
|
||||
end
|
||||
|
||||
feature {NONE} -- Access
|
||||
|
||||
application: WGI_APPLICATION
|
||||
-- Gateway Application
|
||||
|
||||
feature -- Server
|
||||
|
||||
launch
|
||||
deferred
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2011, 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
|
||||
@@ -1,186 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {EWF_BUFFERED_RESPONSE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
EWF_BUFFERED_RESPONSE
|
||||
|
||||
inherit
|
||||
WGI_RESPONSE_BUFFER
|
||||
|
||||
create {WGI_APPLICATION}
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_res: like response_buffer; a_buffer_size: INTEGER)
|
||||
do
|
||||
response_buffer := a_res
|
||||
buffer_capacity := a_buffer_size
|
||||
create buffer.make (a_buffer_size)
|
||||
end
|
||||
|
||||
response_buffer: WGI_RESPONSE_BUFFER
|
||||
|
||||
buffer: STRING_8
|
||||
|
||||
buffer_capacity: INTEGER
|
||||
|
||||
buffer_count: INTEGER
|
||||
|
||||
feature {NONE} -- Core output operation
|
||||
|
||||
write (s: STRING)
|
||||
-- Send the content of `s'
|
||||
local
|
||||
buf: like buffer
|
||||
len_b, len_s: INTEGER
|
||||
do
|
||||
buf := buffer
|
||||
len_s := s.count
|
||||
len_b := buffer_count
|
||||
if len_b + len_s >= buffer_capacity then
|
||||
flush_buffer
|
||||
if len_s >= buffer_capacity then
|
||||
-- replace buffer by `s'
|
||||
buffer := s
|
||||
buffer_count := len_s
|
||||
flush_buffer
|
||||
-- restore buffer with `buf'
|
||||
buffer := buf
|
||||
else
|
||||
buf.append (s)
|
||||
buffer_count := len_s
|
||||
end
|
||||
else
|
||||
buf.append (s)
|
||||
buffer_count := len_b + len_s
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Output operation
|
||||
|
||||
flush
|
||||
do
|
||||
flush_buffer
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
flush_buffer
|
||||
require
|
||||
buffer_count_match_buffer: buffer_count = buffer.count
|
||||
do
|
||||
response_buffer.write (buffer)
|
||||
buffer_count := 0
|
||||
ensure
|
||||
buffer_flushed: buffer_count = 0 and buffer.count = 0
|
||||
end
|
||||
|
||||
feature {WGI_APPLICATION} -- Commit
|
||||
|
||||
commit
|
||||
do
|
||||
flush_buffer
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
header_committed: BOOLEAN
|
||||
-- Header committed?
|
||||
|
||||
message_committed: BOOLEAN
|
||||
-- Message committed?
|
||||
|
||||
message_writable: BOOLEAN
|
||||
-- Can message be written?
|
||||
do
|
||||
Result := status_is_set and header_committed
|
||||
end
|
||||
|
||||
feature -- Status setting
|
||||
|
||||
status_is_set: BOOLEAN
|
||||
-- Is status set?
|
||||
do
|
||||
Result := status_code /= 0
|
||||
end
|
||||
|
||||
set_status_code (a_code: INTEGER)
|
||||
-- Set response status code
|
||||
-- Should be done before sending any data back to the client
|
||||
do
|
||||
status_code := a_code
|
||||
response_buffer.set_status_code (a_code)
|
||||
end
|
||||
|
||||
status_code: INTEGER
|
||||
-- Response status
|
||||
|
||||
feature -- Header output operation
|
||||
|
||||
write_headers_string (a_headers: STRING)
|
||||
do
|
||||
write (a_headers)
|
||||
header_committed := True
|
||||
end
|
||||
|
||||
write_header (a_status_code: INTEGER; a_headers: detachable ARRAY [TUPLE [key: STRING; value: STRING]])
|
||||
-- Send headers with status `a_status', and headers from `a_headers'
|
||||
local
|
||||
h: EWF_HEADER
|
||||
i,n: INTEGER
|
||||
do
|
||||
set_status_code (a_status_code)
|
||||
create h.make
|
||||
h.put_status (a_status_code)
|
||||
if a_headers /= Void then
|
||||
from
|
||||
i := a_headers.lower
|
||||
n := a_headers.upper
|
||||
until
|
||||
i > n
|
||||
loop
|
||||
h.put_header_key_value (a_headers[i].key, a_headers[i].value)
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
write_headers_string (h.string)
|
||||
end
|
||||
|
||||
feature -- Output operation
|
||||
|
||||
write_string (s: STRING)
|
||||
-- Send the string `s'
|
||||
do
|
||||
write (s)
|
||||
end
|
||||
|
||||
write_substring (s: STRING; start_index, end_index: INTEGER)
|
||||
-- Send the substring `start_index:end_index]'
|
||||
--| Could be optimized according to the target output
|
||||
do
|
||||
flush_buffer
|
||||
response_buffer.write_substring (s, start_index, end_index)
|
||||
end
|
||||
|
||||
write_file_content (fn: STRING)
|
||||
-- Send the content of file `fn'
|
||||
do
|
||||
flush_buffer
|
||||
response_buffer.write_file_content (fn)
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "2011-2011, 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
|
||||
@@ -1,151 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {EWF_IN_MEMORY_RESPONSE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
EWF_IN_MEMORY_RESPONSE
|
||||
|
||||
inherit
|
||||
WGI_RESPONSE_BUFFER
|
||||
|
||||
create {WGI_APPLICATION}
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (res: WGI_RESPONSE_BUFFER)
|
||||
do
|
||||
response_buffer := res
|
||||
create header.make
|
||||
create body.make (100)
|
||||
end
|
||||
|
||||
response_buffer: WGI_RESPONSE_BUFFER
|
||||
|
||||
header: EWF_HEADER
|
||||
|
||||
body: STRING_8
|
||||
|
||||
feature {WGI_APPLICATION} -- Commit
|
||||
|
||||
commit
|
||||
local
|
||||
r: like response_buffer
|
||||
do
|
||||
r := response_buffer
|
||||
r.set_status_code (status_code)
|
||||
r.write_headers_string (header.string)
|
||||
header_committed := True
|
||||
r.write_string (body)
|
||||
r.flush
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
header_committed: BOOLEAN
|
||||
-- Header committed?
|
||||
|
||||
message_committed: BOOLEAN
|
||||
-- Message committed?
|
||||
|
||||
message_writable: BOOLEAN
|
||||
-- Can message be written?
|
||||
do
|
||||
Result := status_is_set and header_committed
|
||||
end
|
||||
|
||||
|
||||
feature -- Status setting
|
||||
|
||||
status_is_set: BOOLEAN
|
||||
-- Is status set?
|
||||
do
|
||||
Result := status_code /= 0
|
||||
end
|
||||
|
||||
set_status_code (a_code: INTEGER)
|
||||
-- Set response status code
|
||||
-- Should be done before sending any data back to the client
|
||||
do
|
||||
status_code := a_code
|
||||
end
|
||||
|
||||
status_code: INTEGER
|
||||
-- Response status
|
||||
|
||||
feature {NONE} -- Status output
|
||||
|
||||
write (s: STRING)
|
||||
-- Send the content of `s'
|
||||
do
|
||||
body.append (s)
|
||||
end
|
||||
|
||||
feature -- Header output operation
|
||||
|
||||
write_headers_string (a_headers: STRING)
|
||||
do
|
||||
write (a_headers)
|
||||
header_committed := True
|
||||
end
|
||||
|
||||
write_header (a_status_code: INTEGER; a_headers: detachable ARRAY [TUPLE [key: STRING; value: STRING]])
|
||||
-- Send headers with status `a_status', and headers from `a_headers'
|
||||
local
|
||||
h: EWF_HEADER
|
||||
i,n: INTEGER
|
||||
do
|
||||
set_status_code (a_status_code)
|
||||
create h.make
|
||||
if a_headers /= Void then
|
||||
from
|
||||
i := a_headers.lower
|
||||
n := a_headers.upper
|
||||
until
|
||||
i > n
|
||||
loop
|
||||
h.put_header_key_value (a_headers[i].key, a_headers[i].value)
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
header := h
|
||||
end
|
||||
|
||||
feature -- Output operation
|
||||
|
||||
write_string (s: STRING)
|
||||
-- Send the string `s'
|
||||
do
|
||||
write (s)
|
||||
end
|
||||
|
||||
write_substring (s: STRING; start_index, end_index: INTEGER)
|
||||
-- Send the substring `start_index:end_index]'
|
||||
--| Could be optimized according to the target output
|
||||
do
|
||||
write_string (s.substring (start_index, end_index))
|
||||
end
|
||||
|
||||
write_file_content (fn: STRING)
|
||||
-- Send the content of file `fn'
|
||||
do
|
||||
response_buffer.write_file_content (fn)
|
||||
end
|
||||
|
||||
flush
|
||||
do
|
||||
--| Do nothing ... this is in_memory response
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "2011-2011, 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
|
||||
@@ -1,59 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {EWF_IN_MEMORY_RESPONSE_APPLICATION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
EWF_IN_MEMORY_RESPONSE_APPLICATION
|
||||
|
||||
inherit
|
||||
WGI_APPLICATION
|
||||
rename
|
||||
execute as app_execute
|
||||
end
|
||||
|
||||
|
||||
feature -- Execution
|
||||
|
||||
app_execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Execute the request
|
||||
-- See `req.input' for input stream
|
||||
-- `req.environment' for the Gateway environment
|
||||
-- and `res' for output buffer
|
||||
do
|
||||
execute (req, new_response (req, res))
|
||||
end
|
||||
|
||||
feature -- Execute
|
||||
|
||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Execute the request
|
||||
-- See `req.input' for input stream
|
||||
-- `req.environment' for the Gateway environment
|
||||
-- and `res' for output buffer
|
||||
require
|
||||
res_status_unset: not res.status_is_set
|
||||
deferred
|
||||
ensure
|
||||
res_status_set: res.status_is_set
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
new_response (req: WGI_REQUEST; a_res: WGI_RESPONSE_BUFFER): EWF_IN_MEMORY_RESPONSE
|
||||
do
|
||||
create {EWF_IN_MEMORY_RESPONSE} Result.make (a_res)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2011, 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
|
||||
@@ -1,226 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
An EWSGI response. This may be used as is or specialized (subclassed)
|
||||
if a developer wishes to reimplement their own version of the feature
|
||||
'read_message_body_block' for supporting a block-based message body
|
||||
response.
|
||||
]"
|
||||
author: "Paul Cohen <paul.cohen@seibostudio.se>"
|
||||
status: "Draft"
|
||||
|
||||
class WGI_RESPONSE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Create new response object
|
||||
do
|
||||
is_buffered := False
|
||||
ready_to_transmit := False
|
||||
end_of_blocks := False
|
||||
max_block_size := default_max_block_size
|
||||
current_block := ""
|
||||
create headers_table.make (10)
|
||||
end
|
||||
|
||||
feature {WGI_RESPONSE_APPLICATION} -- Response status
|
||||
|
||||
transmit_to (res: WGI_RESPONSE_BUFFER)
|
||||
do
|
||||
res.set_status_code (status)
|
||||
res.write_headers_string (headers)
|
||||
from
|
||||
read_block
|
||||
res.write_string (last_block)
|
||||
-- res.flush
|
||||
until
|
||||
end_of_blocks
|
||||
loop
|
||||
read_block
|
||||
res.write_string (last_block)
|
||||
-- res.flush
|
||||
end
|
||||
end
|
||||
|
||||
ready_to_transmit: BOOLEAN
|
||||
-- Is this response ready to be transmitted?
|
||||
|
||||
set_ready_to_transmit
|
||||
-- Set response to ready to transmit.
|
||||
do
|
||||
if is_buffered then
|
||||
set_header ("Content-Length", current_block.count.out)
|
||||
-- elseif tmp_file /= Void then
|
||||
-- if tmp_file.is_open_write then
|
||||
-- tmp_file.close
|
||||
-- set_header ("Content-Length", tmp_file.count.out)
|
||||
-- end
|
||||
end
|
||||
ready_to_transmit := True
|
||||
ensure
|
||||
ready_to_transmit
|
||||
end
|
||||
|
||||
feature {WGI_RESPONSE_APPLICATION} -- Message start line and status
|
||||
|
||||
status: INTEGER
|
||||
-- HTTP status code
|
||||
|
||||
set_status (s: INTEGER)
|
||||
-- Set 'status_code'.
|
||||
do
|
||||
status := s
|
||||
set_header ("Status", s.out)
|
||||
ensure
|
||||
status = s
|
||||
end
|
||||
|
||||
start_line: STRING
|
||||
-- HTTP message start-line
|
||||
do
|
||||
if attached status as st then
|
||||
Result := "HTTP/1.1 " + st.out + " " + status_text (st) + crlf
|
||||
else
|
||||
Result := "HTTP/1.1 200 " + status_text (200) + crlf
|
||||
end
|
||||
end
|
||||
|
||||
feature {WGI_RESPONSE_APPLICATION} -- Message headers
|
||||
|
||||
headers: STRING
|
||||
-- HTTP message headers including trailing empty line.
|
||||
local
|
||||
t: HASH_TABLE [STRING, STRING]
|
||||
do
|
||||
Result := ""
|
||||
t := headers_table
|
||||
from
|
||||
t.start
|
||||
until
|
||||
t.after
|
||||
loop
|
||||
Result.append (t.key_for_iteration + ": " + t.item_for_iteration + crlf)
|
||||
t.forth
|
||||
end
|
||||
Result.append (crlf)
|
||||
end
|
||||
|
||||
headers_table: HASH_TABLE [STRING, STRING]
|
||||
-- Hash table of HTTP headers
|
||||
|
||||
set_header (key, value: STRING)
|
||||
-- Set the HTTP header with the given 'key' to the given 'value'.
|
||||
do
|
||||
headers_table.put (value, key)
|
||||
ensure
|
||||
headers_table.has (key) and headers_table @ key = value
|
||||
end
|
||||
|
||||
feature {WGI_RESPONSE_APPLICATION} -- Message body
|
||||
|
||||
read_block
|
||||
-- Read a message body block.
|
||||
do
|
||||
if is_buffered then
|
||||
end_of_blocks := True
|
||||
-- else
|
||||
-- -- File based block-based output
|
||||
-- -- TBD!
|
||||
end
|
||||
ensure
|
||||
--Commented, since it is far from obvious to ensure that:
|
||||
-- not is_buffered implies last_block.count <= max_block_size
|
||||
end
|
||||
|
||||
last_block: STRING
|
||||
-- Last message body block that has been read.
|
||||
do
|
||||
Result := current_block
|
||||
end
|
||||
|
||||
is_buffered: BOOLEAN
|
||||
-- Is the entire entity body buffered in memory (STRING)?
|
||||
|
||||
end_of_blocks: BOOLEAN
|
||||
-- Has the last of the entity body blocks been read?
|
||||
|
||||
set_message_body (s: STRING)
|
||||
-- Set the message body to 's'. Use this for when you want a memory
|
||||
-- buffered response.
|
||||
do
|
||||
current_block := s
|
||||
is_buffered := True
|
||||
set_ready_to_transmit
|
||||
ensure
|
||||
is_buffered
|
||||
ready_to_transmit
|
||||
last_block.is_equal (s)
|
||||
end
|
||||
|
||||
max_block_size: INTEGER
|
||||
-- Maximum block size returned by message body if not buffered
|
||||
|
||||
set_max_block_size (block_size: INTEGER)
|
||||
-- Set 'max_block_size'.
|
||||
do
|
||||
max_block_size := block_size
|
||||
ensure
|
||||
max_block_size = block_size
|
||||
end
|
||||
|
||||
-- write_message_block (s: STRING)
|
||||
-- -- Write message body block 's' to a temporary file. Us this when
|
||||
-- -- you want a non-buffered response.
|
||||
-- require
|
||||
-- not is_buffered
|
||||
-- do
|
||||
-- -- TBD!
|
||||
-- ensure
|
||||
-- not is_buffered
|
||||
-- not ready_to_transmit
|
||||
-- end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
-- tmp_file_name: STRING
|
||||
|
||||
-- tmp_file: detachable FILE
|
||||
-- -- Created with mktmp
|
||||
|
||||
-- position: INTEGER
|
||||
-- -- Current read position in tmp_file
|
||||
|
||||
current_block: STRING
|
||||
-- Current message body block
|
||||
|
||||
default_max_block_size: INTEGER = 65536
|
||||
-- Default value of 'max_block_size'
|
||||
|
||||
crlf: STRING = "%/13/%/10/"
|
||||
|
||||
status_text (code: INTEGER): STRING
|
||||
do
|
||||
inspect code
|
||||
when 500 then
|
||||
Result := "Internal Server Error"
|
||||
when 200 then
|
||||
Result := "OK"
|
||||
else
|
||||
Result := "Code " + code.out
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2011, 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
|
||||
@@ -1,56 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WGI_RESPONSE_APPLICATION} "
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WGI_RESPONSE_APPLICATION
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Execute the request
|
||||
-- See `req.input' for input stream
|
||||
-- `req.environment' for the Gateway environment
|
||||
-- and `res.output' for output stream
|
||||
local
|
||||
rs: WGI_RESPONSE
|
||||
do
|
||||
rs := response (req)
|
||||
if rs.ready_to_transmit then
|
||||
rs.transmit_to (res)
|
||||
else
|
||||
-- Report internal server error.
|
||||
-- Response not ready to transmit!
|
||||
-- Implementor of WGI_APPLICATION has not done his job!
|
||||
create rs.make
|
||||
rs.set_status (500)
|
||||
rs.set_header ("Content-Type", "text/plain")
|
||||
rs.set_message_body ("Incomplete server implementation: Response not ready to transmit.%NTell the programmer to finish his/her job!")
|
||||
rs.transmit_to (res)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Response
|
||||
|
||||
response (request: WGI_REQUEST): WGI_RESPONSE
|
||||
-- HTTP response for given 'request'.
|
||||
deferred
|
||||
ensure
|
||||
ready_to_transmit: Result.ready_to_transmit
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "2011-2011, 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
|
||||
@@ -1,66 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {EWF_ERROR}."
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
EWF_ERROR
|
||||
|
||||
inherit
|
||||
ERROR
|
||||
|
||||
HTTP_STATUS_CODE_MESSAGES
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_code: INTEGER)
|
||||
do
|
||||
code := a_code
|
||||
name := "HTTP Error"
|
||||
if attached http_status_code_message (a_code) as m then
|
||||
name := m
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
code: INTEGER
|
||||
|
||||
name: STRING
|
||||
|
||||
message: detachable STRING_32
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_message (m: like message)
|
||||
-- Set `message' to `m'
|
||||
require
|
||||
m_attached: m /= Void
|
||||
do
|
||||
message := m
|
||||
end
|
||||
|
||||
feature -- Visitor
|
||||
|
||||
process (a_visitor: ERROR_VISITOR)
|
||||
-- Process Current using `a_visitor'.
|
||||
do
|
||||
a_visitor.process_error (Current)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2011, 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
|
||||
Reference in New Issue
Block a user