Class: Gonzui::TopPageServlet
- Inherits:
-
GonzuiAbstractServlet
- Object
- HTTPServlet::AbstractServlet
- GonzuiAbstractServlet
- Gonzui::TopPageServlet
- Defined in:
- lib/gonzui/webapp/top.rb
Constant Summary
Constants included from URIMaker
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from GonzuiAbstractServlet
#format_html, #get_media_type, #get_mime_type, #init_servlet, #initialize, #log, #make_path, #set_content_type_text_html
Methods included from HTMLMaker
#make_content_script_type, #make_css, #make_footer, #make_format_select, #make_h1, #make_html, #make_license_select, #make_meta, #make_meta_and_css, #make_navi, #make_property_select, #make_script, #make_search_form, #make_spacer, #make_status_line, #make_title
Methods included from URIMaker
#decompose_search_query, #escape_path, #get_default_query_value, #get_query_value, #get_short_name, #make_advanced_search_uri, #make_doc_uri, #make_google_uri, #make_lineno_uri, #make_markup_uri, #make_search_uri, #make_search_uri_partial, #make_source_uri, #make_stat_uri, #make_top_uri, #make_uri_general, #make_uri_with_options
Methods included from GetText
#gettext, #gettext_noop, #load_catalog, #set_catalog
Methods included from Util
assert, assert_equal, assert_equal_all, assert_non_nil, assert_not_reached, benchmark, command_exist?, commify, eprintf, format_bytes, program_name, protect_from_signals, require_command, set_verbosity, shell_escape, unix?, vprintf, windows?, wprintf
Constructor Details
This class inherits a constructor from Gonzui::GonzuiAbstractServlet
Class Method Details
.mount_point ⇒ Object
14 15 16 |
# File 'lib/gonzui/webapp/top.rb', line 14 def self.mount_point "" end |
Instance Method Details
#do_GET(request, response) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/gonzui/webapp/top.rb', line 29 def do_GET(request, response) init_servlet(request, response) validate_request log() title = make_title html = make_html head = [:head, title, make_script, *] body = [:body] content = [:div, {:class => "center"}, make_h1, make_search_form(:central => true), ] = summary = [ [:br], sprintf(_("Searching %s packages of %s contents"), commify(@dbm.get_npackages), commify(@dbm.get_ncontents)) ] .push(*summary) content.push() body.push(content) html.push(head) html.push(body) set_content_type_text_html response.body = format_html(html) end |
#validate_request ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gonzui/webapp/top.rb', line 18 def validate_request return if @request.path_info == "/" or @request.path_info.empty? if @request.path_info == "/favicon.ico" uri = make_doc_uri("favicon.ico") @response.set_redirect(HTTPStatus::MovedPermanently, uri) else raise HTTPStatus::NotFound.new("not found") end assert_not_reached end |