| 1 | package dolda.jsvc; |
| 2 | |
| 3 | public class RequestThread extends Thread { |
| 4 | private Request req; |
| 5 | private Responder resp; |
| 6 | |
| 7 | public RequestThread(Responder resp, Request req, ThreadGroup th, String name) { |
| 8 | super(th, name); |
| 9 | this.resp = resp; |
| 10 | this.req = req; |
| 11 | } |
| 12 | |
| 13 | public void run() { |
| 14 | resp.respond(req); |
| 15 | try { |
| 16 | req.output().close(); |
| 17 | } catch(java.io.IOException e) { |
| 18 | throw(new RuntimeException(e)); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | public static ServerContext context() { |
| 23 | return(((RequestThread)Thread.currentThread()).req.ctx()); |
| 24 | } |
| 25 | |
| 26 | public static Request request() { |
| 27 | return(((RequestThread)Thread.currentThread()).req); |
| 28 | } |
| 29 | } |