| 1 | package jrw.resp; |
| 2 | |
| 3 | import jrw.*; |
| 4 | import jrw.sp.*; |
| 5 | import jrw.util.*; |
| 6 | import java.util.*; |
| 7 | |
| 8 | public class HttpError extends UserError { |
| 9 | public int code; |
| 10 | |
| 11 | public HttpError(int code, String title, Object detail) { |
| 12 | super(title, detail); |
| 13 | this.code = code; |
| 14 | } |
| 15 | public HttpError(int code, Object detail) { |
| 16 | this(code, Http.statusinfo.get(code).status, detail); |
| 17 | } |
| 18 | public HttpError(int code) { |
| 19 | this(code, Http.statusinfo.get(code).message); |
| 20 | } |
| 21 | |
| 22 | public Map<Object, Object> handle(Request req) { |
| 23 | req.status(code + " " + skel.title); |
| 24 | return(super.handle(req)); |
| 25 | } |
| 26 | } |