本文整理汇总了C++中RemoteFilename::setRemotePath方法的典型用法代码示例。如果您正苦于以下问题:C++ RemoteFilename::setRemotePath方法的具体用法?C++ RemoteFilename::setRemotePath怎么用?C++ RemoteFilename::setRemotePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RemoteFilename
的用法示例。
在下文中一共展示了RemoteFilename::setRemotePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: physicalPartCopy
static bool physicalPartCopy(IFile *from,const char *tofile, Owned<IException> &exc, StringBuffer *tmpname)
{
StringBuffer tmpnamestr;
if (!tmpname)
tmpname = &tmpnamestr;
tmpname->append(tofile).append("__");
size32_t l = tmpname->length();
genUUID(*tmpname,true); // true for windows
StringAttr uuid(tmpname->str()+l);
tmpname->append(".tmp");
RemoteFilename tmpfn;
tmpfn.setRemotePath(tmpname->str());
//unsigned lastpc;
#ifdef LOG_PART_COPY
PROGLOG("start physicalPartCopy(%s,%s)",from->queryFilename(),tmpname->str());
#endif
try {
recursiveCreateDirectoryForFile(tmpname->str());
while(!asyncCopyFileSection(
uuid,
from,
tmpfn,
(offset_t)-1, // creates file
0,
(offset_t)-1, // all file
NULL,
PHYSICAL_COPY_POLL_TIME)) {
// Abort check TBD
}
}
catch (IException *e) {
EXCLOG(e,"SingleFileCopy: File copy error");
if (exc)
exc.setown(e);
else
e->Release();
}
Owned<IFile> f = createIFile(tmpfn);
if (!exc.get()&&(tmpnamestr.length()!=0)) {
try {
#ifdef LOG_PART_COPY
PROGLOG("physicalPartCopy rename(%s,%s)",tmpname->str(),pathTail(tofile));
#endif
f->rename(pathTail(tofile));
}
catch (IException *e) {
EXCLOG(e,"SingleFileCopy: File rename error");
if (exc)
exc.setown(e);
else
e->Release();
}
}
if (exc.get()) {
try {
f->remove();
}
catch (IException *e) {
// ignore
e->Release();
}
}
#ifdef LOG_PART_COPY
PROGLOG("done physicalPartCopy %s",(exc.get()==NULL)?"OK":"Failed");
#endif
return exc.get()==NULL;
}
示例2: addPasswordForFilename
void CachedPasswordProvider::addPasswordForFilename(const char * filename)
{
RemoteFilename remote;
remote.setRemotePath(filename);
addPasswordForIp(remote.queryIP());
}
示例3: downloadFile
void CFileSpraySoapBindingEx::downloadFile(IEspContext &context, CHttpRequest* request, CHttpResponse* response)
{
try
{
StringBuffer netAddressStr, osStr, pathStr, nameStr;
request->getParameter("NetAddress", netAddressStr);
request->getParameter("OS", osStr);
request->getParameter("Path", pathStr);
request->getParameter("Name", nameStr);
#if 0
StringArray files;
IProperties* params = request->queryParameters();
Owned<IPropertyIterator> iter = params->getIterator();
if (iter && iter->first())
{
while (iter->isValid())
{
const char *keyname=iter->getPropKey();
if (!keyname || strncmp(keyname, "Names", 5))
continue;
files.append(params->queryProp(iter->getPropKey()));
iter->next();
}
}
#endif
if (netAddressStr.length() < 1)
throw MakeStringException(ECLWATCH_INVALID_INPUT, "Network address not specified.");
if (pathStr.length() < 1)
throw MakeStringException(ECLWATCH_INVALID_INPUT, "Path not specified.");
if (nameStr.length() < 1)
throw MakeStringException(ECLWATCH_INVALID_INPUT,"File name not specified.");
char pathSep = '/';
if ((osStr.length() > 1) && (atoi(osStr.str())== OS_WINDOWS))
{
pathSep = '\\';
}
pathStr.replace(pathSep=='\\'?'/':'\\', pathSep);
if (*(pathStr.str() + pathStr.length() -1) != pathSep)
pathStr.append( pathSep );
StringBuffer fullName;
fullName.appendf("%s%s", pathStr.str(), nameStr.str());
StringBuffer headerStr("attachment;");
headerStr.appendf("filename=%s", nameStr.str());
RemoteFilename rfn;
rfn.setRemotePath(fullName.str());
SocketEndpoint ep(netAddressStr.str());
rfn.setIp(ep);
Owned<IFile> rFile = createIFile(rfn);
if (!rFile)
throw MakeStringException(ECLWATCH_CANNOT_OPEN_FILE,"Cannot open file %s.",fullName.str());
OwnedIFileIO rIO = rFile->openShared(IFOread,IFSHfull);
if (!rIO)
throw MakeStringException(ECLWATCH_CANNOT_READ_FILE,"Cannot read file %s.",fullName.str());
IFileIOStream* ioS = createIOStream(rIO);
context.addCustomerHeader("Content-disposition", headerStr.str());
response->setContent(ioS);
response->setContentType(HTTP_TYPE_OCTET_STREAM);
response->send();
}
catch(IException* e)
{
FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR);
}
return;
}