aboutsummaryrefslogtreecommitdiffstats
path: root/src/nodejs/response.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/nodejs/response.js37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/nodejs/response.js b/src/nodejs/response.js
index 47fb170..45dcc89 100644
--- a/src/nodejs/response.js
+++ b/src/nodejs/response.js
@@ -1,3 +1,5 @@
+var xmlGen = require('./xmlGenerator');
+// FIXME: this is a total mess
exports.mkJsonRes = function mkJsonRes(res){
res.started = false;
res.atStart = function (){
@@ -29,7 +31,40 @@ exports.mkJsonRes = function mkJsonRes(res){
}
exports.mkXmlRes = function (res){
- return exports.mkJsonRes(res);
+ res.started = false;
+ res.atStart = function (){
+ if(!this.started){
+ this.writeHead(200);
+ this.write('<xml>');
+ this.started = true;
+ }
+ }
+ res.atEnd = function(){
+ if(!this.started){
+ this.atStart(pojo);
+ }
+ this.write('</xml>');
+ this.end();
+ }
+ res.putWay = function (pojo){
+ if(!this.started){
+ this.atStart(pojo);
+ }
+ this.write(xmlGen.createWay(pojo));
+ }
+
+ res.putNode = function (pojo){
+ if(!this.started){
+ this.atStart(pojo);
+ }
+ this.write(xmlGen.createNode(pojo));
+ }
+
+ res.endWith500 = function(){
+ this.writeHead(500);
+ this.end();
+ }
+ return res;
}