*
The moose likes Java in General and the fly likes Architecture for a  web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

Architecture for a web application

Rishi Singh
Ranch Hand

Joined: Dec 09, 2000
Posts: 321
Dear all,
I have the following doubts:
First:
I was thinking about the following architecture for a
web based application -
having a single servlet which would receive all requests.
The rest of the modules of the application can be classes.
The servlet would do
* the authentication,
* log the result of the same (who logged in, when and if
the attempt is unsuccessful - log the same)
* the connection pool object would be in the servlet context
its getConnection() method would return a connection to the
database. This method would be passed to the method of the
class instantiated
* check if the user has rights to access the module asked for
(say - prepare a sales order)
* if the user has the rights, then it would insantiate the
sales order class and call the appropriate method of the
class depending on the type of the request (prepare a new
sales order, modify an existing sales order, query an order
etc...)
in short the servlet would have a huge switch case which
would take care of the business logic. These would return
the html to the servlet and the servlet calls some template files , does patern matching and outputs the
html content to the browser in one out.println() statement
do you think that such big a servlet would cause performance
issues - one because all requests to the servlet would be
handled by this one servlet and another it would instantiate
the business class required and process it.
Second:
My main question is - will the classes be reused once they are
instantiated in RAM (on the next hit) OR are we completely at the
mercy of the garbage collector (ie if he leaves the class object
in RAM then and then only would it be reused, else the next request
for the same class would need the instantiation again)?
Third:
Because servlets are internally threaded, would the object
instantiated by one thread be available to another thread?
if yes, then do i need to take care about the mutation of public
variables in the class.
in the servlets case, i feel that i may get some benefits..
but that again is a feeling - no arguments in support
I WOULD APPRECIATE A DETAILED RESPONSE FROM THE SHERRIFS AND ANYONE WHO IS DWINDLING WITH WEB TECHNOLOGIES AND HAVE ENOUGH
EXPERIENCE...I would like to know where would this approach go haywire.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

This has been covered in the Servlets Forum. Please don't post the same question in multiple forums.
Dave.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Architecture for a web application
 
Similar Threads
simple quesition abt init() and constructor of a servlet.
please answer these sun j2ee test questions
When should Servlet utility classes be Servlets and when ordinary Java classes?
Whether this architecture is flawless!!!
whether this architecture is feasible..to the Authors!!!!!