[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 349
  • Last Modified:

basic servlet container prototype..

Hi,
Can someone give me a 101 on building a basic servlet container that could deliver static web pages or run servlets. I am looking for some pointers that I can follow while writing program for a servlet container.
0
bjuneja_2000
Asked:
bjuneja_2000
  • 4
1 Solution
 
Mayank SAssociate Director - Product EngineeringCommented:
Probably try looking at the source code of the existing open source servlet containers like Tomcat: http://tomcat.apache.org
0
 
Mayank SAssociate Director - Product EngineeringCommented:
0
 
Mayank SAssociate Director - Product EngineeringCommented:
For static web pages, it is fairly simple. You need to create a TCP listener which receives the requests from users and delivers the pages after reading from a directory.

Create server socket - http://www.exampledepot.com/egs/java.net/CreateServerSocket.html

Handle the request in another thread - http://www.exampledepot.com/egs/java.lang/BasicThread.html?l=rel

Reading from a file -
http://www.exampledepot.com/egs/java.io/ReadLinesFromFile.html?l=rel

Sending contents back to the client socket - http://www.exampledepot.com/egs/java.net/WriteTextToSocket.html
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
bjuneja_2000Author Commented:
Mayankeagle,
I was able to generate static web pages based on your idea.
Any ideas about how to run servlets ?
0
 
Mayank SAssociate Director - Product EngineeringCommented:
You need a servlet container for that - look at the source code of one of the open source containers.
0
 
amodmulayCommented:
hey buddy download any of the ide's like eclipse or netbeans..ou will get good examples in that.......if u download you will also get a bundled tomcat with it...so you can figure out how things work...i think as a beginer you should find it out urself
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now