forked from cory/tildefriends
Just trying a thing. Let apps produce atom content.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3172 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
9f23147678
commit
8fafcb5232
@ -203,6 +203,8 @@ function handler(request, response, packageOwner, packageName, uri) {
|
|||||||
options.credentials = credentials;
|
options.credentials = credentials;
|
||||||
if (uri == "/submit") {
|
if (uri == "/submit") {
|
||||||
process = getServiceProcess(packageOwner, packageName, "submit");
|
process = getServiceProcess(packageOwner, packageName, "submit");
|
||||||
|
} else if (uri == "/atom") {
|
||||||
|
process = getServiceProcess(packageOwner, packageName, "atom");
|
||||||
} else {
|
} else {
|
||||||
var sessionId = form.decodeForm(request.query).sessionId;
|
var sessionId = form.decodeForm(request.query).sessionId;
|
||||||
var isNewSession = false;
|
var isNewSession = false;
|
||||||
@ -261,6 +263,21 @@ function handler(request, response, packageOwner, packageName, uri) {
|
|||||||
return response.end("");
|
return response.end("");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else if (uri === "/atom") {
|
||||||
|
return process.ready.then(function() {
|
||||||
|
var payload = form.decodeForm(request.body, form.decodeForm(request.query));
|
||||||
|
return invoke(process.eventHandlers['onAtom'], [payload]).then(function(content) {
|
||||||
|
var atomContent = content.join();
|
||||||
|
response.writeHead(200, {
|
||||||
|
"Content-Type": "application/atom+xml; charset=utf-8",
|
||||||
|
"Content-Length": atomContent.length.toString(),
|
||||||
|
"Cache-Control": "no-cache, no-store, must-revalidate",
|
||||||
|
"Pragma": "no-cache",
|
||||||
|
"Expires": "0",
|
||||||
|
});
|
||||||
|
return response.end(atomContent);
|
||||||
|
});
|
||||||
|
});
|
||||||
} else if (uri === "/receive") {
|
} else if (uri === "/receive") {
|
||||||
if (isNewSession) {
|
if (isNewSession) {
|
||||||
var data = JSON.stringify({
|
var data = JSON.stringify({
|
||||||
|
Loading…
Reference in New Issue
Block a user