Dolda2000 GitWeb
/
jrw.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add separate handling of response status.
[jrw.git]
/
src
/
jrw
/
Request.java
diff --git
a/src/jrw/Request.java
b/src/jrw/Request.java
index
abe7161
..
5065320
100644
(file)
--- a/
src/jrw/Request.java
+++ b/
src/jrw/Request.java
@@
-5,6
+5,8
@@
import java.util.*;
public class Request {
public final Map<Object, Object> env;
public final Map<Object, Object> resp = new HashMap<>();
public class Request {
public final Map<Object, Object> env;
public final Map<Object, Object> resp = new HashMap<>();
+ public String status = "200 OK";
+ public Object body = null;
public Request(Map<Object, Object> env) {
this.env = env;
public Request(Map<Object, Object> env) {
this.env = env;
@@
-29,7
+31,7
@@
public class Request {
}
@SuppressWarnings("unchecked")
}
@SuppressWarnings("unchecked")
- public
void
ohead(String name, Object val, boolean repl) {
+ public
Request
ohead(String name, Object val, boolean repl) {
name = "http." + name;
if(repl) {
resp.put(name, val);
name = "http." + name;
if(repl) {
resp.put(name, val);
@@
-42,9
+44,15
@@
public class Request {
else
resp.put(name, new ArrayList<Object>(Arrays.asList(cur, val)));
}
else
resp.put(name, new ArrayList<Object>(Arrays.asList(cur, val)));
}
+ return(this);
}
}
+ public Request status(String status) {this.status = status; return(this);}
+ public Request body(Object body) {this.body = body; return(this);}
+
public Map<Object, Object> response() {
public Map<Object, Object> response() {
+ resp.put("http.status", status);
+ resp.put("jagi.output", body);
return(resp);
}
}
return(resp);
}
}