[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

basic servlet container prototype..

Posted on 2007-03-18
8
Medium Priority
?
348 Views
Last Modified: 2013-11-24
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
Comment
Question by:bjuneja_2000
  • 4
6 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 18750345
Probably try looking at the source code of the existing open source servlet containers like Tomcat: http://tomcat.apache.org
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18751545
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 2000 total points
ID: 18751569
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:bjuneja_2000
ID: 18763428
Mayankeagle,
I was able to generate static web pages based on your idea.
Any ideas about how to run servlets ?
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18768860
You need a servlet container for that - look at the source code of one of the open source containers.
0
 
LVL 3

Expert Comment

by:amodmulay
ID: 18798622
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
A solution for Fortify Path Manipulation.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question