Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top