Commit | Line | Data |
---|---|---|
3e20c35c FT |
1 | package jrw; |
2 | ||
3 | import java.util.*; | |
88db3536 FT |
4 | import java.io.*; |
5 | import jrw.resp.*; | |
3e20c35c | 6 | |
d3d92d6c FT |
7 | public class Dispatch { |
8 | public static Map<Object, Object> handle(Handler handler, Request req) { | |
4e6705bd FT |
9 | try(Environment.Frame f = new Environment().frame()) { |
10 | while(true) { | |
11 | try { | |
12 | return(handler.handle(req)); | |
13 | } catch(Restart r) { | |
14 | handler = r; | |
88db3536 FT |
15 | } catch(Throwable t) { |
16 | t.printStackTrace((PrintStream)req.env.get("jagi.errors")); | |
17 | handler = new jrw.resp.HttpError(500); | |
4e6705bd | 18 | } |
3e20c35c FT |
19 | } |
20 | } | |
21 | } | |
22 | } |