ServeHTTP conforms to the http.Handler interface.
(w http.ResponseWriter, req *http.Request)
| 660 | |
| 661 | // ServeHTTP conforms to the http.Handler interface. |
| 662 | func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) { |
| 663 | engine.routeTreesUpdated.Do(func() { |
| 664 | engine.updateRouteTrees() |
| 665 | }) |
| 666 | |
| 667 | c := engine.pool.Get().(*Context) |
| 668 | c.writermem.reset(w) |
| 669 | c.Request = req |
| 670 | c.reset() |
| 671 | |
| 672 | engine.handleHTTPRequest(c) |
| 673 | |
| 674 | engine.pool.Put(c) |
| 675 | } |
| 676 | |
| 677 | // HandleContext re-enters a context that has been rewritten. |
| 678 | // This can be done by setting c.Request.URL.Path to your new target. |