Package org.apache.ftpserver

Examples of org.apache.ftpserver.DefaultDataConnectionConfiguration


    protected FtpServer createServer() throws Exception {
      FtpServer server = super.createServer();
       
      DefaultFtpServerContext context = (DefaultFtpServerContext) server.getServerContext();

      DefaultDataConnectionConfiguration ddcc = (DefaultDataConnectionConfiguration) context.getListener("default").getDataConnectionConfiguration();
      ddcc.setPassiveExernalAddress(InetAddress.getByName("127.0.0.1"));
     
        return server;
    }
View Full Code Here


        dataSslConfig.setKeystorePassword(KEYSTORE_PASSWORD);
        dataSslConfig.setSslProtocol(getAuthValue());
        dataSslConfig.setClientAuthentication(getClientAuth());
        dataSslConfig.setKeyPassword(KEYSTORE_PASSWORD);
       
        DefaultDataConnectionConfiguration dataConfig = new DefaultDataConnectionConfiguration();
        dataConfig.setSslConfiguration(dataSslConfig);
       
        listener.setDataConnectionConfiguration(dataConfig);
       
        return server;
    }
View Full Code Here

    private InetAddress passiveAddress;
   
    protected FtpServer createServer() throws Exception {
        FtpServer server = super.createServer();

        DefaultDataConnectionConfiguration ddcc = (DefaultDataConnectionConfiguration) server.getServerContext()
                .getListener("default").getDataConnectionConfiguration();

        passiveAddress = TestUtil.findNonLocalhostIp();
        ddcc.setPassiveAddress(passiveAddress);
        ddcc.setPassivePorts("12347");

        return server;
    }
View Full Code Here

       
   
    }
   
    private DataConnectionConfiguration parseDataConnection(final Element element, final SslConfiguration listenerSslConfiguration) {
        DefaultDataConnectionConfiguration dc = new DefaultDataConnectionConfiguration();
       
        if(element != null) {
            // data con config element available
            SslConfiguration ssl = parseSsl(element);
            if(ssl != null) {
                LOG.debug("SSL configuration found for the data connection");
                dc.setSslConfiguration(ssl);
            } else {
                // go look for the parent element SSL config
                // find the listener element
                if(listenerSslConfiguration != null) {
                    LOG.debug("SSL configuration found for the listener, falling back for that for the data connection");
                    dc.setSslConfiguration(listenerSslConfiguration);
                }
            }
           
            Element activeElm = SpringUtil.getChildElement(element, FtpServerNamespaceHandler.FTPSERVER_NS, "active");
            if(activeElm != null) {
                Active active = new Active();
                active.setEnable(SpringUtil.parseBoolean(activeElm, "enabled", true));
                active.setIpCheck(SpringUtil.parseBoolean(activeElm, "ip-check", false));
                active.setLocalPort(SpringUtil.parseInt(activeElm, "local-port", 0));
               
                InetAddress localAddress = SpringUtil.parseInetAddress(activeElm, "local-address");
                if(localAddress != null) {
                    active.setLocalAddress(localAddress);
                }
               
                dc.setActive(active);
            }
           
            Element passiveElm = SpringUtil.getChildElement(element, FtpServerNamespaceHandler.FTPSERVER_NS, "passive");
            if(passiveElm != null) {
                Passive passive = new Passive();
               
                InetAddress address = SpringUtil.parseInetAddress(passiveElm, "address");
                if(address != null) {
                    passive.setAddress(address);
                }
               
                InetAddress externalAddress = SpringUtil.parseInetAddress(passiveElm, "external-address");
                if(externalAddress != null) {
                    passive.setExternalAddress(externalAddress);
                }
               
                String ports = SpringUtil.parseString(passiveElm, "ports");
                if(ports != null) {
                    passive.setPorts(ports);
                }
                dc.setPassive(passive);
            }
        } else {
            // no data conn config element, do we still have SSL config from the parent?
            if(listenerSslConfiguration != null) {
                LOG.debug("SSL configuration found for the listener, falling back for that for the data connection");
                dc.setSslConfiguration(listenerSslConfiguration);
            }

        }

        return dc;
View Full Code Here

        FtpServer server = super.createServer();

        DefaultFtpServerContext context = (DefaultFtpServerContext) server
                .getServerContext();

        DefaultDataConnectionConfiguration ddcc = (DefaultDataConnectionConfiguration) context
                .getListener("default").getDataConnectionConfiguration();
        ddcc.setPassiveExernalAddress(InetAddress.getByName("127.0.0.1"));

        return server;
    }
View Full Code Here

    private InetAddress passiveAddress;

    protected FtpServer createServer() throws Exception {
        FtpServer server = super.createServer();

        DefaultDataConnectionConfiguration ddcc = (DefaultDataConnectionConfiguration) server
                .getServerContext().getListener("default")
                .getDataConnectionConfiguration();

        passiveAddress = TestUtil.findNonLocalhostIp();
        ddcc.setPassiveAddress(passiveAddress);
        ddcc.setPassivePorts("12347");

        return server;
    }
View Full Code Here

    }

    private DataConnectionConfiguration parseDataConnection(
            final Element element,
            final SslConfiguration listenerSslConfiguration) {
        DefaultDataConnectionConfiguration dc = new DefaultDataConnectionConfiguration();

        if (element != null) {
            // data con config element available
            SslConfiguration ssl = parseSsl(element);
            if (ssl != null) {
                LOG.debug("SSL configuration found for the data connection");
                dc.setSslConfiguration(ssl);
            } else {
                // go look for the parent element SSL config
                // find the listener element
                if (listenerSslConfiguration != null) {
                    LOG
                            .debug("SSL configuration found for the listener, falling back for that for the data connection");
                    dc.setSslConfiguration(listenerSslConfiguration);
                }
            }

            Element activeElm = SpringUtil.getChildElement(element,
                    FtpServerNamespaceHandler.FTPSERVER_NS, "active");
            if (activeElm != null) {
                Active active = new Active();
                active.setEnable(SpringUtil.parseBoolean(activeElm, "enabled",
                        true));
                active.setIpCheck(SpringUtil.parseBoolean(activeElm,
                        "ip-check", false));
                active.setLocalPort(SpringUtil.parseInt(activeElm,
                        "local-port", 0));

                InetAddress localAddress = SpringUtil.parseInetAddress(
                        activeElm, "local-address");
                if (localAddress != null) {
                    active.setLocalAddress(localAddress);
                }

                dc.setActive(active);
            }

            Element passiveElm = SpringUtil.getChildElement(element,
                    FtpServerNamespaceHandler.FTPSERVER_NS, "passive");
            if (passiveElm != null) {
                Passive passive = new Passive();

                InetAddress address = SpringUtil.parseInetAddress(passiveElm,
                        "address");
                if (address != null) {
                    passive.setAddress(address);
                }

                InetAddress externalAddress = SpringUtil.parseInetAddress(
                        passiveElm, "external-address");
                if (externalAddress != null) {
                    passive.setExternalAddress(externalAddress);
                }

                String ports = SpringUtil.parseString(passiveElm, "ports");
                if (ports != null) {
                    passive.setPorts(ports);
                }
                dc.setPassive(passive);
            }
        } else {
            // no data conn config element, do we still have SSL config from the
            // parent?
            if (listenerSslConfiguration != null) {
                LOG
                        .debug("SSL configuration found for the listener, falling back for that for the data connection");
                dc.setSslConfiguration(listenerSslConfiguration);
            }

        }

        return dc;
View Full Code Here

        dataSslConfig.setKeystorePassword(KEYSTORE_PASSWORD);
        dataSslConfig.setSslProtocol(getAuthValue());
        dataSslConfig.setClientAuthentication(getClientAuth());
        dataSslConfig.setKeyPassword(KEYSTORE_PASSWORD);

        DefaultDataConnectionConfiguration dataConfig = new DefaultDataConnectionConfiguration();
        dataConfig.setSslConfiguration(dataSslConfig);

        listener.setDataConnectionConfiguration(dataConfig);

        return server;
    }
View Full Code Here

TOP

Related Classes of org.apache.ftpserver.DefaultDataConnectionConfiguration

Copyright © 2018 www.massapicom. 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.