U:RDoc::NormalClass[iI" Events:ETI"Rack::Events;TI" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Verbatim;[I"GThis middleware provides hooks to certain places in the request / ;T: @format0o:RDoc::Markup::Paragraph;[I"Oresponse lifecycle. This is so that middleware that don't need to filter ;TI"Othe response data can safely leave it alone and not have to send messages ;TI"'down the traditional "rack stack".;To:RDoc::Markup::BlankLineo; ;[I"The events are:;T@o:RDoc::Markup::List: @type: BULLET: @items[ o:RDoc::Markup::ListItem: @label0;[ o; ;[I" on_start(request, response);T@o; ;[ I"EThis event is sent at the start of the request, before the next ;TI"Nmiddleware in the chain is called. This method is called with a request ;TI"Nobject, and a response object. Right now, the response object is always ;TI"Fnil, but in the future it may actually be a real response object.;T@o;;0;[ o; ;[I"!on_commit(request, response);T@o; ;[ I"MThe response has been committed. The application has returned, but the ;TI"Mresponse has not been sent to the webserver yet. This method is always ;TI"Icalled with a request object and the response object. The response ;TI"Oobject is constructed from the rack triple that the application returned. ;TI"DChanges may still be made to the response object at this point.;T@o;;0;[ o; ;[I"on_send(request, response);T@o; ;[ I"OThe webserver has started iterating over the response body and presumably ;TI"Ohas started sending data over the wire. This method is always called with ;TI"Ga request object and the response object. The response object is ;TI"Nconstructed from the rack triple that the application returned. Changes ;TI"LSHOULD NOT be made to the response object as the webserver has already ;TI"Mstarted sending data. Any mutations will likely result in an exception.;T@o;;0;[ o; ;[I"!on_finish(request, response);T@o; ;[ I"MThe webserver has closed the response, and all data has been written to ;TI"Jthe response socket. The request and response object should both be ;TI"Mread-only at this point. The body MAY NOT be available on the response ;TI"6object as it may have been flushed to the socket.;T@o;;0;[ o; ;[I"'on_error(request, response, error);T@o; ;[I"KAn exception has occurred in the application or an `on_commit` event. ;TI"KThis method will get the request, the response (if available) and the ;TI"exception that was raised.;T@o; ;[I" ## Order;T@o; ;[ I"P`on_start` is called on the handlers in the order that they were passed to ;TI"Nthe constructor. `on_commit`, on_send`, `on_finish`, and `on_error` are ;TI"Mcalled in the reverse order. `on_finish` handlers are called inside an ;TI"K`ensure` block, so they are guaranteed to be called even if something ;TI"Mraises an exception. If something raises an exception in a `on_finish` ;TI"(method, then nothing is guaranteed.;T: @fileI"lib/rack/events.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[[[[[I" class;T[[: public[[I"new;TI"lib/rack/events.rb;T[:protected[[: private[[I" instance;T[[;[[I" call;T@l[;[[;[ [I"make_request;T@l[I"make_response;T@l[I"on_commit;T@l[I" on_error;T@l[I"on_finish;T@l[I" on_start;T@l[[U:RDoc::Context::Section[i0o;;[;0;0[@`I" Rack;TcRDoc::NormalModule