diff --git a/library/server/wsf/src/response/wsf_not_found_response.e b/library/server/wsf/src/response/wsf_not_found_response.e new file mode 100644 index 00000000..3a17cf0f --- /dev/null +++ b/library/server/wsf/src/response/wsf_not_found_response.e @@ -0,0 +1,128 @@ +note + description: "[ + This class is used to report a 404 Not found page + ]" + date: "$Date$" + revision: "$Revision$" + +class + WSF_NOT_FOUND_RESPONSE + + +inherit + WSF_RESPONSE_MESSAGE + + SHARED_HTML_ENCODER + +create + make + +feature {NONE} -- Initialization + + make (req: WSF_REQUEST) + do + request := req + create header.make + create suggested_locations.make (0) + end + +feature -- Header + + header: HTTP_HEADER + -- Response' header + + request: WSF_REQUEST + -- Associated request. + + suggested_locations: ARRAYED_LIST [TUPLE [location: READABLE_STRING_8; title: detachable READABLE_STRING_GENERAL]] + -- Optional suggestions + -- First is the default. + +feature -- Element change + + add_suggested_location (a_loc: READABLE_STRING_8; a_title: detachable READABLE_STRING_GENERAL) + -- Add `a_loc' to `suggested_locations' + do + suggested_locations.force ([a_loc, a_title]) + end + +feature {WSF_RESPONSE} -- Output + + send_to (res: WSF_RESPONSE) + local + s: STRING + l_title: detachable READABLE_STRING_GENERAL + h: like header + do + h := header + res.set_status_code ({HTTP_STATUS_CODE}.not_found) + + s := "
" + s.append ("" + html_encoder.encoded_string (request.request_uri) + "