Examples of ListArgument


Examples of org.apache.ftpserver.command.impl.listing.ListArgument

            }

            boolean failure = false;
            try {
                // parse argument
                ListArgument parsedArg = ListArgumentParser.parse(request
                        .getArgument());

                FileFormater formater = new MLSTFileFormater((String[]) session
                        .getAttribute("MLST.types"));
View Full Code Here

Examples of org.apache.ftpserver.command.impl.listing.ListArgument

            // reset state variables
            session.resetState();

            // parse argument
            ListArgument parsedArg = ListArgumentParser.parse(request
                    .getArgument());

            // checl that the directory or file exists
            FtpFile file = session.getFileSystemView().getFile(parsedArg.getFile());
           
            if(!file.doesExist()) {
                LOG.debug("Listing on a non-existing file");
                session.write(LocalizedDataTransferFtpReply.translate(session, request, context,
                        FtpReply.REPLY_450_REQUESTED_FILE_ACTION_NOT_TAKEN, "LIST",
View Full Code Here

Examples of org.apache.ftpserver.command.impl.listing.ListArgument

            }

            boolean failure = false;
            try {
                // parse argument
                ListArgument parsedArg = ListArgumentParser.parse(request
                        .getArgument());

                FileFormater formater;
                if (parsedArg.hasOption('l')) {
                    formater = LIST_FILE_FORMATER;
                } else {
                    formater = NLST_FILE_FORMATER;
                }
View Full Code Here

Examples of org.apache.ftpserver.command.impl.listing.ListArgument

        // reset state variables
        session.resetState();

        // parse argument
        ListArgument parsedArg = ListArgumentParser
                .parse(request.getArgument());

        FtpFile file = null;
        try {
            file = session.getFileSystemView().getFile(
                    parsedArg.getFile());
            if (file != null && file.doesExist()) {
                FileFormater formater = new MLSTFileFormater((String[]) session
                        .getAttribute("MLST.types"));
                session.write(LocalizedFtpReply.translate(session, request, context,
                        FtpReply.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "MLST",
View Full Code Here

Examples of org.apache.ftpserver.command.impl.listing.ListArgument

        // reset state variables
        session.resetState();

        if(request.getArgument() != null) {
            ListArgument parsedArg = ListArgumentParser.parse(request.getArgument());

            // check that the directory or file exists
            FtpFile file = null;
            try {
                file = session.getFileSystemView().getFile(parsedArg.getFile());
                if(!file.doesExist()) {
                    session.write(LocalizedDataTransferFtpReply.translate(session, request, context,
                            FtpReply.REPLY_450_REQUESTED_FILE_ACTION_NOT_TAKEN, "LIST",
                            null, file));            
                    return;
View Full Code Here

Examples of org.apache.ftpserver.command.impl.listing.ListArgument

*
*/
public class ListArgumentParserTest extends TestCase {

    public void testParseOnlyFile() {
        ListArgument arg = ListArgumentParser.parse("foo");

        assertEquals("foo", arg.getFile());
        assertNull(arg.getPattern());
        assertEquals(0, arg.getOptions().length);
    }
View Full Code Here

Examples of org.apache.ftpserver.command.impl.listing.ListArgument

        assertNull(arg.getPattern());
        assertEquals(0, arg.getOptions().length);
    }

    public void testParseOnlyFileWithDir() {
        ListArgument arg = ListArgumentParser.parse("bar/foo");

        assertEquals("bar/foo", arg.getFile());
        assertNull(arg.getPattern());
        assertEquals(0, arg.getOptions().length);
    }
View Full Code Here

Examples of org.apache.ftpserver.command.impl.listing.ListArgument

        assertNull(arg.getPattern());
        assertEquals(0, arg.getOptions().length);
    }

    public void testParseOnlyPatternWithDir() {
        ListArgument arg = ListArgumentParser.parse("bar/foo*");

        assertEquals("bar/", arg.getFile());
        assertEquals("foo*", arg.getPattern());
        assertEquals(0, arg.getOptions().length);
    }
View Full Code Here

Examples of org.apache.ftpserver.command.impl.listing.ListArgument

        assertEquals("foo*", arg.getPattern());
        assertEquals(0, arg.getOptions().length);
    }

    public void testParseFileWithSpace() {
        ListArgument arg = ListArgumentParser.parse("foo bar");

        assertEquals("foo bar", arg.getFile());
        assertNull(arg.getPattern());
        assertEquals(0, arg.getOptions().length);
    }
View Full Code Here

Examples of org.apache.ftpserver.command.impl.listing.ListArgument

        assertNull(arg.getPattern());
        assertEquals(0, arg.getOptions().length);
    }

    public void testParseWithTrailingOptions() {
        ListArgument arg = ListArgumentParser.parse("foo -la");

        assertEquals("foo -la", arg.getFile());
        assertNull(arg.getPattern());
        assertEquals(0, arg.getOptions().length);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.