Hello, I'm trying to build a very simple MVC framework. I work with a single frontservlet, that dispatches the queries to handler objects. The handler are simple java beans, and the front servlet invoke them with the help of java.lanf.reflect. My problem follows: I would like to know if it is possible to use the HttpServletRequest, or the HttpServletResponse, or the ServletContext, as object attributes for the handler? I know that if my handler were servlets, I wouldn't be allowed to do that, because it's not threadSafe. But my handler are simple java bean that are invocated by the frontservlet with the reflect package. Is my servlet threadsafe? Any help would be nice. Thank you, regards,
Its thread safe if the methods that use httpservletresponse, httpservletrequest, and servletcontext are declared and instaniated within a service method of the servlet. Anything outside the service methods are not thread safe.
Joined: Mar 15, 2004
Thanks for your answer. As my handler objects (who have the HttpServletRequest,HttpServletResponse,ServletCOntext) are dynamically (with java.lang.reflect) invokated in the service method and are never used outside service method, I know now that my FrontServlet is ThreadSafe.