MNetExt Framework 에 대한 필수 API 를 정의
확장된 네크워크 관련된 기능들을 제공
Changed in version 2.0.0
Arguments
Arguments
Arguments
Arguments
Example:
M.net.http.upload({
url: "http://lab.morpheus.kr/api/test/file/upload",
header: {},
params: {},
body: [
{ content: "파일업로드", type: "TEXT" },
{ name: "imgs", content: "test.zip", type: "FILE" },
{ name: "imgs", content: "test/test1.txt", type: "FILE" },
{ name: "imgs", content: "test/test2.txt", type: "FILE" }
],
encoding : "UTF-8",
finish : function(status, header, body, setting) {
console.log(status);
},
progress : function(total, current) {
console.log(total, current);
}
});
M.media.picker({
mode: "SINGLE",
media: "PHOTO",
column: 3,
callback: function( status, result ) {
var fileList = [], fileCont = {};
fileCont.name = 'file';
fileCont.content = ( M.navigator.os('android') ) ? result.fullpath : result.path; ;
fileCont.type = 'FILE';
fileList.push(fileCont);
M.net.http.upload({
url: "http://210.104.181.170:8280/board/attach",
header: {},
params: {index : "3"},
body: fileList,
encoding : "UTF-8",
finish : function(code, header, body, status, error) {
if (status == 'SUCCESS') {
M.pop.alert( status + " / " + header + body );
}
else
{
M.pop.alert( status + " / " + error );
}
}
});
}
});
M.media.picker({
media: "PHOTO",
choice: "MULTI"
}, function(status, result) {
M.tool.log(status, result);
//alert( status + ", " + JSON.stringify(result) );
if ( status === "SUCCESS" ) {
M.net.http.upload({
url: "http://210.104.181.170:8280/board/attach",
header: {},
params: {},
files: result,
encoding : "UTF-8",
finish : function(status, header, body, setting) {
},
progress : function(total, current) {
}
});
}
});
Changed in version 2.0.0
Arguments
Arguments
Arguments
Arguments
Example:
M.net.http.download({
url: 'https://s3-ap-northeast-1.amazonaws.com/morpheus-storage/lab/documents/morpheus_2.0_introduce_v1.3.modified.pdf',
indicator: true,
overwrite: true,
progress: function(total, current) {
console.log(total, current);
},
finish: function( statusCode, header, fileInfo, status, error ) {
console.log( statusCode, header, fileInfo, status, error );
if (status == "SUCCESS") {
console.log( JSON.stringify( fileInfo ) );
}
else {
console.log( JSON.stringify( arguments ) );
}
}
});
Changed in version 2.0.0
Arguments
Arguments
Arguments
Example:
M.net.ftp.list('host', {
port : '21',
account : {
username : '',
password : '',
},
target : {
serverpath : ''
},
finish : function(resultCode, listInfo, setting) {
M.tool.log( resultCode, listInfo );
alert( resultCode + ", " + JSON.stringify(listInfo) );
}
});
Changed in version 2.0.0
Arguments
Arguments
Arguments
Example:
M.net.ftp.upload('host', {
port : '21',
account : {
username : 'anonymous',
password : '',
},
target : {
localpath : 'localpath',
serverfiles : [ 'server_file0', 'server_file1', ],
},
finish : function(resultCode, resultMessage, setting) {
if (resultCode == 'SUCCESS') {
// TODO : success handle code here
} else {
// TODO : fail handle code here
}
}
});
Changed in version 2.0.0
Arguments
Arguments
Arguments
Example:
M.net.ftp.download('host', {
port : '21',
account : {
username : 'anonymous',
password : '',
},
target : {
localpath : 'localpath',
serverfiles : [ 'server_file0', 'server_file1', ],
},
finish : function(resultCode, resultMessage, setting) {
if (resultCode == 'SUCCESS') {
// TODO : success handle code here
} else {
// TODO : fail handle code here
}
}
});
CODE | Description |
---|---|
9994 | 네트워크 URL Error |
9995 | 네트워크 통신 중 취소처리 |
9996 | 네트워크 연결 에러 |
9997 | 통신중 에러 / 통신 내부 에러 |
9998 | 네트워크 응답시간 초과 에러 |
9999 | 서버에서 리턴된 에러 |
404 | Not found(네트워크 연결 실패) |