File: C:/Ruby27-x64/share/ri/2.7.0/system/WEBrick/HTTPServlet/AbstractServlet/cdesc-AbstractServlet.ri
U:RDoc::NormalClass[iI"AbstractServlet:ETI"*WEBrick::HTTPServlet::AbstractServlet;TI"Object;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[I"MAbstractServlet allows HTTP server modules to be reused across multiple ;TI"7servers and allows encapsulation of functionality.;To:RDoc::Markup::BlankLine o; ;[I"NBy default a servlet will respond to GET, HEAD (through an alias to GET) ;TI"and OPTIONS requests.;T@o; ;[I"KBy default a new servlet is initialized for every request. A servlet ;TI"@instance can be reused by overriding ::get_instance in the ;TI"AbstractServlet subclass.;T@S:RDoc::Markup::Heading:
leveli: textI"A Simple Servlet;T@o:RDoc::Markup::Verbatim;[I":class Simple < WEBrick::HTTPServlet::AbstractServlet
;TI"$ def do_GET request, response
;TI"< status, content_type, body = do_stuff_with request
;TI"
;TI"" response.status = status
;TI"1 response['Content-Type'] = content_type
;TI" response.body = body
;TI" end
;TI"
;TI"! def do_stuff_with request
;TI"4 return 200, 'text/plain', 'you got a page'
;TI" end
;TI" end
;T:@format0o; ;[I"=This servlet can be mounted on a server at a given path:;T@o;;[I"$server.mount '/simple', Simple
;T;0S;;i;
I"Servlet Configuration;T@o; ;[I"KServlets can be configured via initialize. The first argument is the ;TI"6HTTP server the servlet is being initialized for.;T@o;;[I"!class Configurable < Simple
;TI"* def initialize server, color, size
;TI" super server
;TI" @color = color
;TI" @size = size
;TI" end
;TI"
;TI"! def do_stuff_with request
;TI" content = "<p " \
;TI"G %q{style="color: #{@color}; font-size: #{@size}"} \
;TI"$ ">Hello, World!"
;TI"
;TI"* return 200, "text/html", content
;TI" end
;TI" end
;T;0o; ;[I"?This servlet must be provided two arguments at mount time:;T@o;;[I"=server.mount '/configurable', Configurable, 'red', '2em';T;0:
@fileI"(lib/webrick/httpservlet/abstract.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ [ [[I"
class;T[[:public[[I"get_instance;TI"6../ruby-2.7.7/lib/webrick/httpservlet/abstract.rb;T[I"new;T@\[:protected[ [:private[ [I"
instance;T[[;[ [I"do_GET;T@\[I"do_HEAD;T@\[I"do_OPTIONS;T@\[I"service;T@\[;[ [;[[I"redirect_to_directory_uri;T@\[ [U:RDoc::Context::Section[i 0o;;[ ;0;0[I"(lib/webrick/httpservlet/abstract.rb;TI"WEBrick::HTTPServlet;TcRDoc::NormalModule