Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Can't tell if the original questioner <strong><em>wanted</em></strong> to configure FtpServer via XML, or whether he/she doesn't know if that is a requirement of embedding.</p> <p>As clearly shown in the product documentation, and as pointed out by other answers here, it's straight forward to configure FtpServer entirely programmatically.</p> <p>But I figure that if the original questioner did want to do it, surely lots of people will recognize the administrative benefits to configuring FtpServer declaratively with XML in an embedded application. Here's how to do it:</p> <p>Yes, you do need to use Spring to use XML configs for FtpServer, but you don't need to learn anything about Spring.</p> <p>Just code this single statement to instantiate your FTP server, configured with the specified XML file:</p> <pre><code>FtpServer server = new FileSystemXmlApplicationContext("config/ftpd.xml").getBean("fServer", FtpServer.class); </code></pre> <p>(And you will obviously need to .start() it afterwards... that's it).</p> <p>There are other ways to load the bean from the bean file, but this is simple and serviceable and it's easy enough for you to change your element's ID to match the specified bean name ("fServer" in the line above). The XML file path is relative to where the JVM ("java") is invoked from, but you can use an absolute path instead. You could also load the XML file as a CLASSPATH resource instead of from the filesystem. That has advantages and disadvantages and I won't take time here to discuss them, nor how to do that.</p> <p>The only other thing to know is, you will require a couple Spring jar files in your compilation CLASSPATH, and many Spring jar files in your runtime CLASSPATH. ALl of these jars are readily available in the Maven central repository, and all together they come in at under 3 MB. Here are the jar dependencies in Ivy format:</p> <pre><code> &lt;dependency name="mina-core" org="org.apache.mina" rev="2.0.4" conf="runtime"/&gt; &lt;dependency name="slf4j-api" org="org.slf4j" rev="1.6.3" conf="runtime"/&gt; &lt;dependency name="jcl-over-slf4j" org="org.slf4j" rev="1.6.3" conf="runtime"/&gt; &lt;dependency name="slf4j-jdk14" org="org.slf4j" rev="1.6.3" conf="runtime"/&gt; &lt;dependency name="ftplet-api" org="org.apache.ftpserver" rev="1.0.6" conf="runtime"/&gt; &lt;dependency name="ftpserver-core" org="org.apache.ftpserver" rev="1.0.6"/&gt; &lt;dependency name="spring-context" org="org.springframework" rev="3.0.6.RELEASE"/&gt; &lt;dependency name="spring-core" org="org.springframework" rev="3.0.6.RELEASE"/&gt; &lt;dependency name="spring-beans" org="org.springframework" rev="3.0.6.RELEASE"/&gt; &lt;dependency name="spring-asm" org="org.springframework" conf="runtime" rev="3.0.6.RELEASE"/&gt; &lt;dependency name="spring-expression" org="org.springframework" conf="runtime" rev="3.0.6.RELEASE"/&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload