Thank You for Your response Nic.

My idea came from the Java PetStore Demo, where there's only one servlet
with a requestprocessor, and so on. I tried to make something similar
(without EJBs). Maybe it was a bad idea.
I will think again the problem with Your suggestions.

Thanks again

Gábor


> >I'm new at the servlet technology and this list too,
> >and my english is terrible and I've got a question,
> >so it isn't easy for me (and for You).
>
> FWIW your english is very good. Much better than my Hindi I assue you.
>
>
> >And finally my question: Is it a good design pattern
> >or is completely wrong?
>
> Short answer: no.
>
>
> >What are the drawbacks? What can I do (make?) better?
>
> Here's the top view of what you'd doing:
>
>                                 |-> Handler
>    request ->  Broker |-> Handler
>                                 |-> Handler
>
>
> This is okay but it seems complex. You have an HTTP protocol that works on
URIs so why not get rid of the broker by making the handlers individual
servlets?
>
>
>     request "/one" -> Handler-Servlet1
>     request "/two"  -> Handler-Servlet2
>     etc...
>
>
> >I have to store some web application-wide data, so I made
> >a class called Manager. The Manager has only static
> >members (fields, methods).
> >In the servlets init method I call the Manager's static init
> >method, which make an instance from the Broker class,
> >and stores it in a private static variable.
>
> So these things you're storing are Handler's or other data?
>
> If it's other data why not just store it on the servlet-context? If all
the Handler's are built as servlets (or at least have their own servlet
wrappers) then you don't have to worry about the dependancy on the
ServletContext.
>
>
> >In the init method I also make a mapping in a hashtable
> >that requests from /foo/bar will be handled by a class
> >called FooBarHandler.
>
> You're just duplicating what the servlet platform is supposed to do for
you. Can you see that?
>
> Your're recieving a request and then dispatching the data from the request
along your own supply line. Why not just have the applet make different HTTP
requersts? Or if you can't do that have a broker servlet that uses
RequestDispatchers to pass on individual requests to other servlets.
>
>
> >In the Manager's init method I make instances from
> >other classes too, for example a Logger class. The
> >reason is that I don't want to pass the servletcontext
> >as a parameter to all my methods just to implement a log. I
> >simply call Manager.writeLog() from any method of any class.
>
> If you reduce your code to servlets then you won't be worried about that.
>
>
> Nic Ferrier
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to