Search in sources :

Example 11 with AFTPClient

use of lucee.runtime.net.ftp.AFTPClient in project Lucee by lucee.

the class Ftp method actionOpen.

/**
 * Opens a FTP Connection
 * @return FTPCLinet
 * @throws IOException
 * @throws PageException
 */
private AFTPClient actionOpen() throws IOException, PageException {
    required("server", server);
    required("username", username);
    required("password", password);
    AFTPClient client = getClient();
    writeCfftp(client);
    return client;
}
Also used : AFTPClient(lucee.runtime.net.ftp.AFTPClient)

Example 12 with AFTPClient

use of lucee.runtime.net.ftp.AFTPClient in project Lucee by lucee.

the class Ftp method actionExistsFile.

/**
 * check if a file exists or not
 * @return FTPCLient
 * @throws IOException
 * @throws PageException
 */
private AFTPClient actionExistsFile() throws PageException, IOException {
    required("remotefile", remotefile);
    AFTPClient client = getClient();
    FTPFile file = existsFile(client, remotefile, true);
    Struct cfftp = writeCfftp(client);
    cfftp.setEL(RETURN_VALUE, Caster.toBoolean(file != null && file.isFile()));
    cfftp.setEL(SUCCEEDED, Boolean.TRUE);
    stoponerror = false;
    return client;
}
Also used : AFTPClient(lucee.runtime.net.ftp.AFTPClient) FTPFile(org.apache.commons.net.ftp.FTPFile) Struct(lucee.runtime.type.Struct)

Example 13 with AFTPClient

use of lucee.runtime.net.ftp.AFTPClient in project Lucee by lucee.

the class Ftp method actionExists.

/**
 * check if a file or directory exists
 * @return FTPCLient
 * @throws PageException
 * @throws IOException
 */
private AFTPClient actionExists() throws PageException, IOException {
    required("item", item);
    AFTPClient client = getClient();
    FTPFile file = existsFile(client, item, false);
    Struct cfftp = writeCfftp(client);
    cfftp.setEL(RETURN_VALUE, Caster.toBoolean(file != null));
    cfftp.setEL(SUCCEEDED, Boolean.TRUE);
    return client;
}
Also used : AFTPClient(lucee.runtime.net.ftp.AFTPClient) FTPFile(org.apache.commons.net.ftp.FTPFile) Struct(lucee.runtime.type.Struct)

Example 14 with AFTPClient

use of lucee.runtime.net.ftp.AFTPClient in project Lucee by lucee.

the class Ftp method actionListDir.

/**
 * List data of a ftp connection
 * @return FTPCLient
 * @throws PageException
 * @throws IOException
 */
private AFTPClient actionListDir() throws PageException, IOException {
    required("name", name);
    required("directory", directory);
    AFTPClient client = getClient();
    FTPFile[] files = client.listFiles(directory);
    if (files == null)
        files = new FTPFile[0];
    pageContext.setVariable(name, toQuery(files, "ftp", directory, client.getRemoteAddress().getHostName()));
    writeCfftp(client);
    return client;
}
Also used : AFTPClient(lucee.runtime.net.ftp.AFTPClient) FTPFile(org.apache.commons.net.ftp.FTPFile)

Example 15 with AFTPClient

use of lucee.runtime.net.ftp.AFTPClient in project Lucee by lucee.

the class Ftp method actionChangeDir.

/**
 * change working directory
 * @return FTPCLient
 * @throws IOException
 * @throws PageException
 */
private AFTPClient actionChangeDir() throws IOException, PageException {
    required("directory", directory);
    AFTPClient client = getClient();
    client.changeWorkingDirectory(directory);
    writeCfftp(client);
    return client;
}
Also used : AFTPClient(lucee.runtime.net.ftp.AFTPClient)

Aggregations

AFTPClient (lucee.runtime.net.ftp.AFTPClient)16 Struct (lucee.runtime.type.Struct)6 FTPFile (org.apache.commons.net.ftp.FTPFile)3 Resource (lucee.commons.io.res.Resource)2 ApplicationException (lucee.runtime.exp.ApplicationException)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 FTPConnection (lucee.runtime.net.ftp.FTPConnection)1