Commit 4914822e authored by project's avatar project

--no commit message

--no commit message
parent 1fb3f873
...@@ -23,6 +23,10 @@ const STRING_TYPE = 1; ...@@ -23,6 +23,10 @@ const STRING_TYPE = 1;
const BINARY_TYPE = 2; const BINARY_TYPE = 2;
const OBJECT_TYPE = 3; const OBJECT_TYPE = 3;
module.exports.STRING_TYPE = STRING_TYPE;
module.exports.BINARY_TYPE = BINARY_TYPE;
module.exports.OBJECT_TYPE = OBJECT_TYPE;
module.exports.format = function(filename,opt,cb){ module.exports.format = function(filename,opt,cb){
var options = {}; var options = {};
if(typeof opt == 'function'){ if(typeof opt == 'function'){
......
...@@ -41,6 +41,11 @@ responseHelper.prototype.setLastModified = function(lm){ ...@@ -41,6 +41,11 @@ responseHelper.prototype.setLastModified = function(lm){
responseHelper.prototype.responseOK = responseResult; responseHelper.prototype.responseOK = responseResult;
responseHelper.prototype.type = function (tpy)
{
this.response.type(tpy);
}
responseHelper.prototype.write = function (data) responseHelper.prototype.write = function (data)
{ {
this.response.write(data); this.response.write(data);
......
...@@ -25,7 +25,7 @@ var SS = function StorageService(cfg) ...@@ -25,7 +25,7 @@ var SS = function StorageService(cfg)
SS.prototype.start = function() SS.prototype.start = function()
{ {
console.log('Starting Storage Service ...\n'); console.log('Starting Storage Service ...\n');
this.amqp_start(); //this.amqp_start();
this.http_start(); this.http_start();
} }
......
...@@ -31,6 +31,8 @@ router.get('/:id/data',function (req, res) { ...@@ -31,6 +31,8 @@ router.get('/:id/data',function (req, res) {
var opt = { var opt = {
'field' : 'data' 'field' : 'data'
} }
opt.filetype = (query.filetype)?query.filetype:null
get_object(reqHelper,respHelper,{'oid':oid,'opt':opt}); get_object(reqHelper,respHelper,{'oid':oid,'opt':opt});
}); });
...@@ -98,7 +100,7 @@ function get_object(reqHelper,respHelper,prm) ...@@ -98,7 +100,7 @@ function get_object(reqHelper,respHelper,prm)
function output(resp,obj,opt) function output(resp,obj,opt)
{ {
if(opt.filed=='data') if(opt.field=='data')
{ {
data_out(resp,obj,opt); data_out(resp,obj,opt);
}else{ }else{
...@@ -117,8 +119,23 @@ function obj_out(resp,obj,opt) ...@@ -117,8 +119,23 @@ function obj_out(resp,obj,opt)
function data_out(resp,obj,opt) function data_out(resp,obj,opt)
{ {
var objType = obj.header; var objType = obj.header.TY;
resp.responseOK(objType);
if(objType == BinStream.BINARY_TYPE){
if(opt.filetype){
resp.response.type(opt.filetype);
}else{
}
resp.response.send(obj.data);
//resp.endOK();
}else if(objType == BinStream.STRING_TYPE){
resp.response.send(obj.data);
}else{
resp.responseOK(obj.data);
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment