diff --git a/library/email/email_service.e b/library/email/email_service.e index a28da86..1e1c19b 100644 --- a/library/email/email_service.e +++ b/library/email/email_service.e @@ -28,7 +28,6 @@ feature {NONE} -- Initialization -- Initialize service. do admin_email := parameters.admin_email - create {NOTIFICATION_SMTP_MAILER} mailer.make (parameters.smtp_server) set_successful end diff --git a/src/configuration/cms_default_setup.e b/src/configuration/cms_default_setup.e index 1fa5858..bdcfc4a 100644 --- a/src/configuration/cms_default_setup.e +++ b/src/configuration/cms_default_setup.e @@ -86,13 +86,19 @@ feature -- Access local retried: BOOLEAN f: FILE + l_chain: NOTIFICATION_CHAIN_MAILER + l_storage_mailer: NOTIFICATION_STORAGE_MAILER + l_mailer: detachable NOTIFICATION_MAILER do if not retried then if attached text_item ("mailer.smtp") as l_smtp then - create {NOTIFICATION_SMTP_MAILER} mailer.make (l_smtp) + create {NOTIFICATION_SMTP_MAILER} l_mailer.make (l_smtp) elseif attached text_item ("mailer.sendmail") as l_sendmail then - create {NOTIFICATION_SENDMAIL_MAILER} mailer.make_with_location (l_sendmail) - elseif attached text_item ("mailer.output") as l_output then + create {NOTIFICATION_SENDMAIL_MAILER} l_mailer.make_with_location (l_sendmail) + end + -- If a mailer.ouput is set, set a notification chain with potential previous mailer + -- and file storage. + if attached text_item ("mailer.output") as l_output then if l_output.is_case_insensitive_equal ("@stderr") then f := io.error elseif l_output.is_case_insensitive_equal ("@stdout") then @@ -104,10 +110,18 @@ feature -- Access f.close end end - create {NOTIFICATION_STORAGE_MAILER} mailer.make (create {NOTIFICATION_EMAIL_FILE_STORAGE}.make (f)) - else - create {NOTIFICATION_STORAGE_MAILER} mailer.make (create {NOTIFICATION_EMAIL_FILE_STORAGE}.make (io.error)) + create {NOTIFICATION_STORAGE_MAILER} l_storage_mailer.make (create {NOTIFICATION_EMAIL_FILE_STORAGE}.make (f)) + if l_mailer /= Void then + create l_chain.make (l_mailer) + l_chain.set_next (l_storage_mailer) + l_mailer := l_chain + else + l_mailer := l_storage_mailer + end + elseif l_mailer = Void then + create {NOTIFICATION_STORAGE_MAILER} l_mailer.make (create {NOTIFICATION_EMAIL_FILE_STORAGE}.make (io.error)) end + mailer := l_mailer else check valid_mailer: False end -- FIXME: should we report persistent error message? If yes, see how. diff --git a/src/service/response/cms_response.e b/src/service/response/cms_response.e index c95ada9..72559ce 100644 --- a/src/service/response/cms_response.e +++ b/src/service/response/cms_response.e @@ -995,6 +995,7 @@ feature {NONE} -- Execution page: CMS_HTML_PAGE_RESPONSE utf: UTF_CONVERTER h: HTTP_HEADER + l_new_location: READABLE_STRING_8 do if attached {READABLE_STRING_GENERAL} values.item ("optional_content_type") as l_type then create cms_page.make_typed (utf.utf_32_string_to_utf_8_string_8 (l_type)) @@ -1010,12 +1011,12 @@ feature {NONE} -- Execution if attached redirection as l_location then -- FIXME: find out if this is safe or not. if l_location.has_substring ("://") then --- h.put_location (l_location) - response.redirect_now (l_location) + l_new_location := l_location else --- h.put_location (request.absolute_url (l_location, Void)) - response.redirect_now (absolute_url (l_location, Void)) + l_new_location := absolute_url (l_location, Void) end +-- h.put_location (l_new_location) + response.redirect_now (l_new_location) else h.put_header_object (header) diff --git a/src/service/response/error/bad_request_error_cms_response.e b/src/service/response/error/bad_request_error_cms_response.e index 4c2cab1..a115455 100644 --- a/src/service/response/error/bad_request_error_cms_response.e +++ b/src/service/response/error/bad_request_error_cms_response.e @@ -20,9 +20,10 @@ feature -- Generation custom_prepare (page: CMS_HTML_PAGE) do + set_status_code ({HTTP_STATUS_CODE}.bad_request) page.register_variable (absolute_url (request.percent_encoded_path_info, Void), "request") - page.set_status_code ({HTTP_STATUS_CODE}.bad_request) - page.register_variable (page.status_code.out, "code") + page.set_status_code (status_code) + page.register_variable (status_code.out, "code") end feature -- Execution diff --git a/src/service/response/error/forbidden_error_cms_response.e b/src/service/response/error/forbidden_error_cms_response.e index 0cc2982..8d2812e 100644 --- a/src/service/response/error/forbidden_error_cms_response.e +++ b/src/service/response/error/forbidden_error_cms_response.e @@ -20,9 +20,10 @@ feature -- Generation custom_prepare (page: CMS_HTML_PAGE) do + set_status_code ({HTTP_STATUS_CODE}.forbidden) page.register_variable (absolute_url (request.percent_encoded_path_info, Void), "request") - page.set_status_code ({HTTP_STATUS_CODE}.forbidden) - page.register_variable (page.status_code.out, "code") + page.set_status_code (status_code) + page.register_variable (status_code.out, "code") end feature -- Execution diff --git a/src/service/response/error/internal_server_error_cms_response.e b/src/service/response/error/internal_server_error_cms_response.e index 99aa752..cdb4e1f 100644 --- a/src/service/response/error/internal_server_error_cms_response.e +++ b/src/service/response/error/internal_server_error_cms_response.e @@ -20,9 +20,10 @@ feature -- Generation custom_prepare (page: CMS_HTML_PAGE) do + set_status_code ({HTTP_STATUS_CODE}.internal_server_error) page.register_variable (absolute_url (location, Void), "request") - page.set_status_code ({HTTP_STATUS_CODE}.internal_server_error) - page.register_variable (page.status_code.out, "code") + page.set_status_code (status_code) + page.register_variable (status_code.out, "code") end feature -- Execution diff --git a/src/service/response/error/not_found_error_cms_response.e b/src/service/response/error/not_found_error_cms_response.e index 0768a0b..8f3ab3e 100644 --- a/src/service/response/error/not_found_error_cms_response.e +++ b/src/service/response/error/not_found_error_cms_response.e @@ -20,9 +20,10 @@ feature -- Generation custom_prepare (page: CMS_HTML_PAGE) do + set_status_code ({HTTP_STATUS_CODE}.not_found) page.register_variable (absolute_url (request.percent_encoded_path_info, Void), "request") - page.set_status_code ({HTTP_STATUS_CODE}.not_found) - page.register_variable (page.status_code.out, "code") + page.set_status_code (status_code) + page.register_variable (status_code.out, "code") end feature -- Execution diff --git a/src/service/response/error/not_implemented_error_cms_response.e b/src/service/response/error/not_implemented_error_cms_response.e index 5e6c18f..5d5e179 100644 --- a/src/service/response/error/not_implemented_error_cms_response.e +++ b/src/service/response/error/not_implemented_error_cms_response.e @@ -20,9 +20,10 @@ feature -- Generation custom_prepare (page: CMS_HTML_PAGE) do + set_status_code ({HTTP_STATUS_CODE}.not_implemented) page.register_variable (absolute_url (request.percent_encoded_path_info, Void), "request") - page.set_status_code ({HTTP_STATUS_CODE}.not_implemented) - page.register_variable (page.status_code.out, "code") + page.set_status_code (status_code) + page.register_variable (status_code.out, "code") end feature -- Execution