URL
piSmartURLServiceSample
import com.PowerIntegral.*;
/**
* <p>
* Title: piSmartURLServiceSample
* </p>
*
* <p>
* Description: 調用下載網頁內容類別範例
* </p>
*/
public class piSmartURLServiceSample extends piSmartServiceSample {
/**
* piSmartURLServiceSample: 建構子
*
* @param ConfigurationFile
* String => 定義檔
*/
public piSmartURLServiceSample(String ConfigurationFile) {
super(ConfigurationFile);
}
/**
* main: 主函式
*
* @param args =>
* 命令列字串引數陣列
*/
public static void main(String[] args) {
String _ConfigurationFile = "piSmartService.properties";
if (args.length > 0) {
_ConfigurationFile = args[0];
}
java.io.File _FileProp = new java.io.File(_ConfigurationFile);
if (!_FileProp.exists()) {
System.out.println("定義檔:" + _ConfigurationFile + " 不存在");
return;
}
piSmartURLServiceSample _piSmartURLServiceSample = new piSmartURLServiceSample(
_ConfigurationFile);
String _CallerInfo = "Mitac", _Result = "";
_piSmartURLServiceSample.Init("piSmartServiceSample",
"piSmartURLServiceSample", "PowerIntegral", _CallerInfo);
// ********************************************************
String _URL = _piSmartURLServiceSample._Configuration
.getProperty("URL");
String _TaskParam = _piSmartURLServiceSample._piBase64.getBase64(_URL);
_Result = _piSmartURLServiceSample._piSmartService
.getURLContent(_TaskParam);
if (_piSmartURLServiceSample._piSmartService.getSuccess())
_piSmartURLServiceSample._piSmartService.getLog().Debug(
500,
_piSmartURLServiceSample._piSmartService._piBase64
.getFromBase64(_Result));
else
_piSmartURLServiceSample._piSmartService.getLog().Debug(510,
_piSmartURLServiceSample._piSmartService.getErrorMessage());
// ********************************************************
String _SaveFolder = _piSmartURLServiceSample._Configuration
.getProperty("SaveFolder");
_Result = _piSmartURLServiceSample._piSmartService.saveURLContent(
_piSmartURLServiceSample._piBase64.getBase64(_URL),
_piSmartURLServiceSample._piBase64.getBase64(_SaveFolder));
if (_piSmartURLServiceSample._piSmartService.getSuccess())
_piSmartURLServiceSample._piSmartService.getLog().Debug(
500,
_piSmartURLServiceSample._piSmartService._piBase64
.getFromBase64(_Result));
else
_piSmartURLServiceSample._piSmartService.getLog().Debug(510,
_piSmartURLServiceSample._piSmartService.getErrorMessage());
}
}