SlideShare a Scribd company logo
Journal of Information Engineering and Applications                                                     www.iiste.org
ISSN 2224-5782 (print) ISSN 2225-0506 (online)
Vol 2, No.5, 2012


                                              FTP SERVLET
                              Sandeep Kumar *, Anuj Kumar Singh, Vandana Bansala
                                        Department of CSE / IT, Tula’s Institute
                                           Dehradun, Uttarakhand, INDIA
                         * E-mail of the corresponding author: sandeepkumarsiet@gmail.com
Abstract
This paper presents new idea about the servlet we know about http servlet and generic servlet case of http servlet we
use http protocol for the server side programming this is a protocol dependent servlet if we use ftp and SMTP
protocol instead of http protocol then servlet will be protocol independent. An FTP servlet is an intermediate
application that resides between the FTP server and the FTP client. It works as a proxy interposed within
client/server communications and helps to unload some of the computing power of the FTP server and distribute it to
the FTP servlet. It also provides a firewall and proxy friendly file transfer environment by wrapping FTP traffic over
HTTP. FTP traffic can be wrapped over Https using a SSL certificate to provide enhanced security.
Keywords: SMTP, wrapping FTP, enhanced security

1. Introduction
A servlet is a Java programming language class used to extend the capabilities of servers that host applications access
via a request-response programming model. Although servlets can respond to any type of request, they are
commonly used to extend the applications hosted by Web servers. Thus, it can be thought of as a Java Applet that
runs on a server instead of a browser. A Servlet is a java based server side web technology. As the name implies, it
serves a client request and receives a response from the server. Technically speaking a Servlet is a Java class in Java
EE that conforms to the Java Servlet API, a protocol by which a Java class may respond to requests. They are not tied
to a specific client-server protocol, but are most often used with the HTTP protocol. Therefore, the word "Servlet" is
often used in the meaning of "HTTP Servlet". Thus, a software developer may use a servlet to add dynamic content
to a Web server using the Java platform. The generated content is commonly HTML, but may be other data such as
XML. Servlets are the Java counterpart to non-Java dynamic Web content technologies such as CGI and ASP.NET.
Servlets can maintain state in session variables across many server transactions by using HTTP cookies, or URL
rewriting.
2. How A Servlet Work?
Three methods are central to the life cycle of a servlet. These are init( ), service( ), and destroy( ). They are
implemented by every servlet and are invoked at specific times by the server. Let us consider a typical user scenario to
understand when these methods are when we use FTT, SMTP in Place of HTTP protocol.




                                                           9
Journal of Information Engineering and Applications                                                          www.iiste.org
ISSN 2224-5782 (print) ISSN 2225-0506 (online)
Vol 2, No.5, 2012

    1.    Assume that a user enters a Uniform Resource Locator (URL) to a web browser.
               o The browser then generates an FTP request for this URL.
               o This request is then sent to the appropriate server.
     2. The FTP request is received by the web server.
               o The server maps this request to a particular servlet.
               o The servlet is dynamically retrieved and loaded into the address space of the server.
     3. The server invokes the init() method of the servlet.
               o This method is invoked only when the servlet is first loaded into memory.
               o It is possible to pass initialization parameters to the servlet so it may configure itself.
     4. The server invokes the service() method of the servlet.
               o This method is called to process the FTP request.
               o You will see that it is possible for the servlet to read data that has been provided in the FTP request.
               o It may also formulate an FTP response for the client.
     5. The servlet remains in the server’s address space and is available to process any other FTP requests received
          from clients.
               o The service() method is called for each FTP request.
     6. The server may, at some point, decide to unload the servlet from its memory.
               o The algorithms by which this determination is made are specific to each server.
     7. The server calls the destroy() method to relinquish any resources such as file handles that are allocated for
          the servlet; important data may be saved to a persistent store.
     8. The memory allocated for the servlet and its objects can then be garbage collected.
2.1 Example
The following example servlet prints how many times its service() method was called.
Note that HttpServlet is a subclass of GenericServlet, an implementation of the Servlet interface.
The service () method of HttpServlet class dispatches requests to the methods doGet(), doPost(), doPut(), doDelete(),
and so on; according to the HTTP request. In the example below method service() is overridden and does not
distinguish which HTTP request method it serves.
3. Using Genericservlet For FTP
The protocol is handled by the servlet container, not the servlet itself. If you want to have FTP commands sent to a
servlet, you need a special servlet container that handles the FTP protocol and sends the received FTP commands to a
servlet. As far as I know there are no servlet containers available that can do this.
According to the the Javadoc the only method that you must override is service(). You could look at the patterns used in
HttpServlet to get some ideas. For the FTP protocol I could see things like doPut(), doGet(), doList(), and so on. You
service() method would parse appropriately and call those methods on a FTPServlet.
The real issue, as was pointed out, is that the container handles the actual protocol. This is a not so subtle side effect of
the J2EE servlet specification. Sure, you could have a FTPServlet, a SMTPServlet, and whatever other kind of protocol
you want. But at the lowest level something has to be listening for a connection on a particular port and route packets to
and from that port appropriately. Tomcat follows the servlet spec but doesn't have a Connector (a Tomcat term) for
FTP. It really wouldn't be too bad to write one. Looking at the docs for Http11Processor you'll see that it implements
two interfaces. Basically you want to create your own connector for Tomcat.
All of this is great, but forget about portability. If you want this to work in WebLogic or WebSphere you'll have to
figure out their API's tool.

4. Ftp Servlet
An FTP servlet is an intermediate application that resides between the FTP server and the FTP client. It works as a
proxy interposed within client/server communications and helps to unload some of the computing power of the FTP
server and distribute it to the FTP servlet. It also provides a firewall and proxy friendly file transfer environment by
wrapping FTP traffic over HTTP. FTP traffic can be wrapped over Https using a SSL certificate to provide enhanced
security.
5. Architecture
FTP clients can connect to the FTP servlet through the Internet. In most cases FTP is wrapped over an application
layer protocol. Most commonly used are HTTP (for easy, unencrypted transfers) or HTTPs (for encrypted transfers).

                                                             10
Journal of Information Engineering and Applications                                                        www.iiste.org
ISSN 2224-5782 (print) ISSN 2225-0506 (online)
Vol 2, No.5, 2012

The use of HTTPs requires an SSL certificate to be present at the site of the FTP servlet. A number of simultaneous
connections can be made to the FTP servlet. The number of connections is restricted to the computing power of the
server. The number of end-users supported through the number of connections is usually more. As all connected
end-users aren’t “active” until they make a request from the server. Consequently, the number of end-users
simultaneously online on the FTP server can be greater than the number of active connections supported by the FTP
server.

6. Exploring Other Protocols:

After the successful usage of HTTP Explorer we plan to apply the main idea to other protocols and applications as
well. There are basically two requirements for a protocol or an application, it must
           I.    be text-based and
          II.    have a request-response characteristic.
These requirements have their roots in the characteristics of HTTP. Possible candidates for protocols include
WebDAV and SOAP, but it is also possible to access applications such as compilers or simulators In this case the
communication between the tool and the target application is either based on an API directly used by our tool or
based on a network protocol. If there is no such protocol available a simple
Wrapper based on TCP/IP can provide this service. Our goal is to be define an API, such that all learning tools can
use a common kernel. Also we want to develop a common testing environment.

7. Conclusion
If we use ftp servlet in place of http servlet then speed will be much better than http and unwanted thread do
not effect or we can secure band width GenericServlet defines a generic, protocol-independent servlet.
GenericServlet gives a blueprint and makes writing servlet easier. GenericServlet provides simple versions of the
lifecycle methods init and destroy and of the methods in the ServletConfig interface. GenericServlet implements the
log method, declared in the ServletContext interface. To write a generic servlet, it is sufficient to override the abstract
service method

8. References
 [1] Dustin R. Callaway. Inside Servlets: Server-Side Programming for the JavaTM
        Platform. Addison Wesley Longman, Inc., Redaing, Massachusetts, 1999.
 [2] David Flanagan. Java In A Nutshell, second edition. O'Reilly and Associates, Inc.,
      Sebastopol, CA, 1997.
 [3] Mohammad R. Islam, Dr. Frederick C. Harris, Jr., advisor. Implementation of Interactive Course Web Site
August 2000
 [4] http://pdftutorial.net/pdf/1/introduction-to-java-servlet-technology.html
 [5] http://www.coderanch.com/t/361522/Servlets/java/GenericServlet-FTP
 [6] http://javapapers.com/servlet/difference-between-httpservlet-and-genericservlet




                                                            11
This academic article was published by The International Institute for Science,
Technology and Education (IISTE). The IISTE is a pioneer in the Open Access
Publishing service based in the U.S. and Europe. The aim of the institute is
Accelerating Global Knowledge Sharing.

More information about the publisher can be found in the IISTE’s homepage:
http://www.iiste.org


The IISTE is currently hosting more than 30 peer-reviewed academic journals and
collaborating with academic institutions around the world. Prospective authors of
IISTE journals can find the submission instruction on the following page:
http://www.iiste.org/Journals/

The IISTE editorial team promises to the review and publish all the qualified
submissions in a fast manner. All the journals articles are available online to the
readers all over the world without financial, legal, or technical barriers other than
those inseparable from gaining access to the internet itself. Printed version of the
journals is also available upon request of readers and authors.

IISTE Knowledge Sharing Partners

EBSCO, Index Copernicus, Ulrich's Periodicals Directory, JournalTOCS, PKP Open
Archives Harvester, Bielefeld Academic Search Engine, Elektronische
Zeitschriftenbibliothek EZB, Open J-Gate, OCLC WorldCat, Universe Digtial
Library , NewJour, Google Scholar

More Related Content

What's hot (20)

PPTX
Networking in Java
Tushar B Kute
 
PPTX
Introduction to Remote Procedure Call
Abdelrahman Al-Ogail
 
PPT
Socket Programming - nitish nagar
Nitish Nagar
 
PDF
Covert Timing Channels using HTTP Cache Headers
Denis Kolegov
 
PPT
Java Networking
Ankit Desai
 
PPT
Network programming in Java
Tushar B Kute
 
PDF
Servlet classnotes
Vasanti Dutta
 
PPT
Networking Java Socket Programming
Mousmi Pawar
 
PDF
XML-RPC (XML Remote Procedure Call)
Peter R. Egli
 
PPTX
Covert timing channels using HTTP cache headers
yalegko
 
PDF
Maxbox starter18
Max Kleiner
 
PDF
Java Programming - 07 java networking
Danairat Thanabodithammachari
 
PPT
Java Networking
Sunil OS
 
PPT
Comparison between-rpc-rmi-and-webservices-son-1228374226080667-8
helpsoft01
 
PPTX
Using RabbitMQ and Netty library to implement RPC protocol
Tho Q Luong Luong
 
DOC
Remote procedure calls
imnomus
 
PPT
Anintroductiontojavawebtechnology 090324184240-phpapp01
raviIITRoorkee
 
PPTX
Socket programming in Java (PPTX)
UC San Diego
 
PPT
The constrained application protocol (coap) part 2
Hamdamboy (함담보이)
 
PPT
remote method invocation
Ravi Theja
 
Networking in Java
Tushar B Kute
 
Introduction to Remote Procedure Call
Abdelrahman Al-Ogail
 
Socket Programming - nitish nagar
Nitish Nagar
 
Covert Timing Channels using HTTP Cache Headers
Denis Kolegov
 
Java Networking
Ankit Desai
 
Network programming in Java
Tushar B Kute
 
Servlet classnotes
Vasanti Dutta
 
Networking Java Socket Programming
Mousmi Pawar
 
XML-RPC (XML Remote Procedure Call)
Peter R. Egli
 
Covert timing channels using HTTP cache headers
yalegko
 
Maxbox starter18
Max Kleiner
 
Java Programming - 07 java networking
Danairat Thanabodithammachari
 
Java Networking
Sunil OS
 
Comparison between-rpc-rmi-and-webservices-son-1228374226080667-8
helpsoft01
 
Using RabbitMQ and Netty library to implement RPC protocol
Tho Q Luong Luong
 
Remote procedure calls
imnomus
 
Anintroductiontojavawebtechnology 090324184240-phpapp01
raviIITRoorkee
 
Socket programming in Java (PPTX)
UC San Diego
 
The constrained application protocol (coap) part 2
Hamdamboy (함담보이)
 
remote method invocation
Ravi Theja
 

Viewers also liked (12)

PPTX
HTML to FTP
Keira Dooley
 
PDF
A theory of efficiency for managing the marketing executives in nigerian banks
Alexander Decker
 
PDF
A therapy for physical and mental fitness of school children
Alexander Decker
 
PDF
A transformational generative approach towards understanding al-istifham
Alexander Decker
 
PDF
A time series analysis of the determinants of savings in namibia
Alexander Decker
 
PDF
A trends of salmonella and antibiotic resistance
Alexander Decker
 
PDF
A unique common fixed point theorems in generalized d
Alexander Decker
 
PDF
A universal model for managing the marketing executives in nigerian banks
Alexander Decker
 
PDF
Abnormalities of hormones and inflammatory cytokines in women affected with p...
Alexander Decker
 
PDF
A validation of the adverse childhood experiences scale in
Alexander Decker
 
PDF
A usability evaluation framework for b2 c e commerce websites
Alexander Decker
 
PDF
apostila de didática
joaovitorinopolacimatos
 
HTML to FTP
Keira Dooley
 
A theory of efficiency for managing the marketing executives in nigerian banks
Alexander Decker
 
A therapy for physical and mental fitness of school children
Alexander Decker
 
A transformational generative approach towards understanding al-istifham
Alexander Decker
 
A time series analysis of the determinants of savings in namibia
Alexander Decker
 
A trends of salmonella and antibiotic resistance
Alexander Decker
 
A unique common fixed point theorems in generalized d
Alexander Decker
 
A universal model for managing the marketing executives in nigerian banks
Alexander Decker
 
Abnormalities of hormones and inflammatory cytokines in women affected with p...
Alexander Decker
 
A validation of the adverse childhood experiences scale in
Alexander Decker
 
A usability evaluation framework for b2 c e commerce websites
Alexander Decker
 
apostila de didática
joaovitorinopolacimatos
 
Ad

Similar to Ftp servlet (20)

PDF
Web technology-guide
Srihari
 
PPT
Abhishek srivastava ppt_web_tech
abhishek srivastav
 
PPTX
Learn Advanced JAVA at ASIT
ASIT
 
PPT
Web Tech Java Servlet Update1
vikram singh
 
PPT
An Introduction To Java Web Technology
vikram singh
 
PDF
SERVER SIDE PROGRAMMING
Prabu U
 
PPTX
Servlet & jsp
Subhasis Nayak
 
PPTX
java Servlet technology
Tanmoy Barman
 
PPTX
Servlets
Akshay Ballarpure
 
RTF
Marata
Cecille Marata
 
PPT
Servlet (1) also contains code to create it.ppt
juhishrivastava25
 
DOCX
internet programming and java notes 5th sem mca
Renu Thakur
 
DOC
Servlet basics
Santosh Dhoundiyal
 
PPT
Servlet123jkhuiyhkjkljioyudfrtsdrestfhgb
shubhangimalas1
 
PPTX
Web technology introduction to the web and its history
BKReddy3
 
PPT
Servlet.ppt
kstalin2
 
PPT
Servlet.ppt
MouDhara1
 
PPT
Servlet1.ppt
KhushalChoudhary14
 
PPTX
Servlets-UNIT3and introduction to servlet
RadhikaP41
 
Web technology-guide
Srihari
 
Abhishek srivastava ppt_web_tech
abhishek srivastav
 
Learn Advanced JAVA at ASIT
ASIT
 
Web Tech Java Servlet Update1
vikram singh
 
An Introduction To Java Web Technology
vikram singh
 
SERVER SIDE PROGRAMMING
Prabu U
 
Servlet & jsp
Subhasis Nayak
 
java Servlet technology
Tanmoy Barman
 
Servlet (1) also contains code to create it.ppt
juhishrivastava25
 
internet programming and java notes 5th sem mca
Renu Thakur
 
Servlet basics
Santosh Dhoundiyal
 
Servlet123jkhuiyhkjkljioyudfrtsdrestfhgb
shubhangimalas1
 
Web technology introduction to the web and its history
BKReddy3
 
Servlet.ppt
kstalin2
 
Servlet.ppt
MouDhara1
 
Servlet1.ppt
KhushalChoudhary14
 
Servlets-UNIT3and introduction to servlet
RadhikaP41
 
Ad

More from Alexander Decker (20)

PDF
A systematic evaluation of link budget for
Alexander Decker
 
PDF
A synthetic review of contraceptive supplies in punjab
Alexander Decker
 
PDF
A synthesis of taylor’s and fayol’s management approaches for managing market...
Alexander Decker
 
PDF
A survey paper on sequence pattern mining with incremental
Alexander Decker
 
PDF
A survey on live virtual machine migrations and its techniques
Alexander Decker
 
PDF
A survey on data mining and analysis in hadoop and mongo db
Alexander Decker
 
PDF
A survey on challenges to the media cloud
Alexander Decker
 
PDF
A survey of provenance leveraged
Alexander Decker
 
PDF
A survey of private equity investments in kenya
Alexander Decker
 
PDF
A study to measures the financial health of
Alexander Decker
 
PDF
A study to evaluate the attitude of faculty members of public universities of...
Alexander Decker
 
PDF
A study to assess the knowledge regarding prevention of pneumonia among middl...
Alexander Decker
 
PDF
A study regarding analyzing recessionary impact on fundamental determinants o...
Alexander Decker
 
PDF
A study on would be urban-migrants’ needs and necessities in rural bangladesh...
Alexander Decker
 
PDF
A study on the evaluation of scientific creativity among science
Alexander Decker
 
PDF
A study on the antioxidant defense system in breast cancer patients.
Alexander Decker
 
PDF
A study on the dimensions of
Alexander Decker
 
PDF
A study on knowledge and practice of post menopausal women
Alexander Decker
 
PDF
A study on financial performance of restructured or revived slp es in kerala
Alexander Decker
 
PDF
A study on financing of sme’s in bangladesh
Alexander Decker
 
A systematic evaluation of link budget for
Alexander Decker
 
A synthetic review of contraceptive supplies in punjab
Alexander Decker
 
A synthesis of taylor’s and fayol’s management approaches for managing market...
Alexander Decker
 
A survey paper on sequence pattern mining with incremental
Alexander Decker
 
A survey on live virtual machine migrations and its techniques
Alexander Decker
 
A survey on data mining and analysis in hadoop and mongo db
Alexander Decker
 
A survey on challenges to the media cloud
Alexander Decker
 
A survey of provenance leveraged
Alexander Decker
 
A survey of private equity investments in kenya
Alexander Decker
 
A study to measures the financial health of
Alexander Decker
 
A study to evaluate the attitude of faculty members of public universities of...
Alexander Decker
 
A study to assess the knowledge regarding prevention of pneumonia among middl...
Alexander Decker
 
A study regarding analyzing recessionary impact on fundamental determinants o...
Alexander Decker
 
A study on would be urban-migrants’ needs and necessities in rural bangladesh...
Alexander Decker
 
A study on the evaluation of scientific creativity among science
Alexander Decker
 
A study on the antioxidant defense system in breast cancer patients.
Alexander Decker
 
A study on the dimensions of
Alexander Decker
 
A study on knowledge and practice of post menopausal women
Alexander Decker
 
A study on financial performance of restructured or revived slp es in kerala
Alexander Decker
 
A study on financing of sme’s in bangladesh
Alexander Decker
 

Recently uploaded (20)

PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Python basic programing language for automation
DanialHabibi2
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 

Ftp servlet

  • 1. Journal of Information Engineering and Applications www.iiste.org ISSN 2224-5782 (print) ISSN 2225-0506 (online) Vol 2, No.5, 2012 FTP SERVLET Sandeep Kumar *, Anuj Kumar Singh, Vandana Bansala Department of CSE / IT, Tula’s Institute Dehradun, Uttarakhand, INDIA * E-mail of the corresponding author: [email protected] Abstract This paper presents new idea about the servlet we know about http servlet and generic servlet case of http servlet we use http protocol for the server side programming this is a protocol dependent servlet if we use ftp and SMTP protocol instead of http protocol then servlet will be protocol independent. An FTP servlet is an intermediate application that resides between the FTP server and the FTP client. It works as a proxy interposed within client/server communications and helps to unload some of the computing power of the FTP server and distribute it to the FTP servlet. It also provides a firewall and proxy friendly file transfer environment by wrapping FTP traffic over HTTP. FTP traffic can be wrapped over Https using a SSL certificate to provide enhanced security. Keywords: SMTP, wrapping FTP, enhanced security 1. Introduction A servlet is a Java programming language class used to extend the capabilities of servers that host applications access via a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by Web servers. Thus, it can be thought of as a Java Applet that runs on a server instead of a browser. A Servlet is a java based server side web technology. As the name implies, it serves a client request and receives a response from the server. Technically speaking a Servlet is a Java class in Java EE that conforms to the Java Servlet API, a protocol by which a Java class may respond to requests. They are not tied to a specific client-server protocol, but are most often used with the HTTP protocol. Therefore, the word "Servlet" is often used in the meaning of "HTTP Servlet". Thus, a software developer may use a servlet to add dynamic content to a Web server using the Java platform. The generated content is commonly HTML, but may be other data such as XML. Servlets are the Java counterpart to non-Java dynamic Web content technologies such as CGI and ASP.NET. Servlets can maintain state in session variables across many server transactions by using HTTP cookies, or URL rewriting. 2. How A Servlet Work? Three methods are central to the life cycle of a servlet. These are init( ), service( ), and destroy( ). They are implemented by every servlet and are invoked at specific times by the server. Let us consider a typical user scenario to understand when these methods are when we use FTT, SMTP in Place of HTTP protocol. 9
  • 2. Journal of Information Engineering and Applications www.iiste.org ISSN 2224-5782 (print) ISSN 2225-0506 (online) Vol 2, No.5, 2012 1. Assume that a user enters a Uniform Resource Locator (URL) to a web browser. o The browser then generates an FTP request for this URL. o This request is then sent to the appropriate server. 2. The FTP request is received by the web server. o The server maps this request to a particular servlet. o The servlet is dynamically retrieved and loaded into the address space of the server. 3. The server invokes the init() method of the servlet. o This method is invoked only when the servlet is first loaded into memory. o It is possible to pass initialization parameters to the servlet so it may configure itself. 4. The server invokes the service() method of the servlet. o This method is called to process the FTP request. o You will see that it is possible for the servlet to read data that has been provided in the FTP request. o It may also formulate an FTP response for the client. 5. The servlet remains in the server’s address space and is available to process any other FTP requests received from clients. o The service() method is called for each FTP request. 6. The server may, at some point, decide to unload the servlet from its memory. o The algorithms by which this determination is made are specific to each server. 7. The server calls the destroy() method to relinquish any resources such as file handles that are allocated for the servlet; important data may be saved to a persistent store. 8. The memory allocated for the servlet and its objects can then be garbage collected. 2.1 Example The following example servlet prints how many times its service() method was called. Note that HttpServlet is a subclass of GenericServlet, an implementation of the Servlet interface. The service () method of HttpServlet class dispatches requests to the methods doGet(), doPost(), doPut(), doDelete(), and so on; according to the HTTP request. In the example below method service() is overridden and does not distinguish which HTTP request method it serves. 3. Using Genericservlet For FTP The protocol is handled by the servlet container, not the servlet itself. If you want to have FTP commands sent to a servlet, you need a special servlet container that handles the FTP protocol and sends the received FTP commands to a servlet. As far as I know there are no servlet containers available that can do this. According to the the Javadoc the only method that you must override is service(). You could look at the patterns used in HttpServlet to get some ideas. For the FTP protocol I could see things like doPut(), doGet(), doList(), and so on. You service() method would parse appropriately and call those methods on a FTPServlet. The real issue, as was pointed out, is that the container handles the actual protocol. This is a not so subtle side effect of the J2EE servlet specification. Sure, you could have a FTPServlet, a SMTPServlet, and whatever other kind of protocol you want. But at the lowest level something has to be listening for a connection on a particular port and route packets to and from that port appropriately. Tomcat follows the servlet spec but doesn't have a Connector (a Tomcat term) for FTP. It really wouldn't be too bad to write one. Looking at the docs for Http11Processor you'll see that it implements two interfaces. Basically you want to create your own connector for Tomcat. All of this is great, but forget about portability. If you want this to work in WebLogic or WebSphere you'll have to figure out their API's tool. 4. Ftp Servlet An FTP servlet is an intermediate application that resides between the FTP server and the FTP client. It works as a proxy interposed within client/server communications and helps to unload some of the computing power of the FTP server and distribute it to the FTP servlet. It also provides a firewall and proxy friendly file transfer environment by wrapping FTP traffic over HTTP. FTP traffic can be wrapped over Https using a SSL certificate to provide enhanced security. 5. Architecture FTP clients can connect to the FTP servlet through the Internet. In most cases FTP is wrapped over an application layer protocol. Most commonly used are HTTP (for easy, unencrypted transfers) or HTTPs (for encrypted transfers). 10
  • 3. Journal of Information Engineering and Applications www.iiste.org ISSN 2224-5782 (print) ISSN 2225-0506 (online) Vol 2, No.5, 2012 The use of HTTPs requires an SSL certificate to be present at the site of the FTP servlet. A number of simultaneous connections can be made to the FTP servlet. The number of connections is restricted to the computing power of the server. The number of end-users supported through the number of connections is usually more. As all connected end-users aren’t “active” until they make a request from the server. Consequently, the number of end-users simultaneously online on the FTP server can be greater than the number of active connections supported by the FTP server. 6. Exploring Other Protocols: After the successful usage of HTTP Explorer we plan to apply the main idea to other protocols and applications as well. There are basically two requirements for a protocol or an application, it must I. be text-based and II. have a request-response characteristic. These requirements have their roots in the characteristics of HTTP. Possible candidates for protocols include WebDAV and SOAP, but it is also possible to access applications such as compilers or simulators In this case the communication between the tool and the target application is either based on an API directly used by our tool or based on a network protocol. If there is no such protocol available a simple Wrapper based on TCP/IP can provide this service. Our goal is to be define an API, such that all learning tools can use a common kernel. Also we want to develop a common testing environment. 7. Conclusion If we use ftp servlet in place of http servlet then speed will be much better than http and unwanted thread do not effect or we can secure band width GenericServlet defines a generic, protocol-independent servlet. GenericServlet gives a blueprint and makes writing servlet easier. GenericServlet provides simple versions of the lifecycle methods init and destroy and of the methods in the ServletConfig interface. GenericServlet implements the log method, declared in the ServletContext interface. To write a generic servlet, it is sufficient to override the abstract service method 8. References [1] Dustin R. Callaway. Inside Servlets: Server-Side Programming for the JavaTM Platform. Addison Wesley Longman, Inc., Redaing, Massachusetts, 1999. [2] David Flanagan. Java In A Nutshell, second edition. O'Reilly and Associates, Inc., Sebastopol, CA, 1997. [3] Mohammad R. Islam, Dr. Frederick C. Harris, Jr., advisor. Implementation of Interactive Course Web Site August 2000 [4] http://pdftutorial.net/pdf/1/introduction-to-java-servlet-technology.html [5] http://www.coderanch.com/t/361522/Servlets/java/GenericServlet-FTP [6] http://javapapers.com/servlet/difference-between-httpservlet-and-genericservlet 11
  • 4. This academic article was published by The International Institute for Science, Technology and Education (IISTE). The IISTE is a pioneer in the Open Access Publishing service based in the U.S. and Europe. The aim of the institute is Accelerating Global Knowledge Sharing. More information about the publisher can be found in the IISTE’s homepage: http://www.iiste.org The IISTE is currently hosting more than 30 peer-reviewed academic journals and collaborating with academic institutions around the world. Prospective authors of IISTE journals can find the submission instruction on the following page: http://www.iiste.org/Journals/ The IISTE editorial team promises to the review and publish all the qualified submissions in a fast manner. All the journals articles are available online to the readers all over the world without financial, legal, or technical barriers other than those inseparable from gaining access to the internet itself. Printed version of the journals is also available upon request of readers and authors. IISTE Knowledge Sharing Partners EBSCO, Index Copernicus, Ulrich's Periodicals Directory, JournalTOCS, PKP Open Archives Harvester, Bielefeld Academic Search Engine, Elektronische Zeitschriftenbibliothek EZB, Open J-Gate, OCLC WorldCat, Universe Digtial Library , NewJour, Google Scholar