can we write servlet engine

can we write servlet engine?if yes How?
LVL 20
chaitu chaituAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you don't need to write one.  download tomcat and run some examples to better understand it:

shows you the principals of it...

Though it will be a LOT of work (to include security, etc), and you are probably better off using Tomcat (which is free)

it also has the full source code :-)

There are also smoe other open source alternatives you could look at:
chaitu chaituAuthor Commented:
i know i dont need to write servlet engine i can sue any of servlet engine currently available;

but if  i want to write a simple servlet engine(leave security etc aspects) who can handle my request and response;how can i write

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Have a look at tjws...

That seems to be a 50k java implementation of a servlet container...  You should be able to learn a lot from the source code...
Basically, the flow goes something like this:


1) Create Servlet instance
2) call init(), passing ServletConfig (if any)
3) map servlet to url pattern

then, when you get a connection on a socket

1) build up request object
2) create response object
3) call servlet.service with request and response
4) check error codes in response
any help?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.