I was asked this question in an interview. Although I said that this can't be done as struts is only a web framework and basically an extension of the servlets, I wanted to know whether it is really possible to have struts configured for ftp protocol.

有帮助吗?

解决方案

The entry point in Struts is the ActionServlet, which is a HttpServlet:

public class ActionServlet extends HttpServlet

From that point onwards it's all HTTP. Struts was built for HTTP, you can't configure it to handle the FTP protocol.

But that's not even the main problem, the problem is that the servlet container itself needs to handle FTP and pass the control to the servlet. If you look at the Servlet API specification you will see that the focus is on the HTTP(S) protocol. I don't think any servlet container bothered to implement more than that.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top