Guys...... it works now, but I don't understand why))) I change code to synchronize the sharedSassionBean and didn't put any magic methods for checking, and Servlet never send the same data twice. But process still running two times. So I still need to write this magic method. Thanks for suggestions and help, Jenya
-----Original Message----- From: Tim Funk [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 18, 2002 11:25 AM To: Tomcat Users List Subject: Re: How to close a response? There is no need to synchronize the request object. It will not be used in multiple threads concurrently. What you really need is synchronization of the session to prevent processing of the "double submit". If the user submits twice, then 2 different requests may be executed in different threads. Closing response streams don't help the main goal of preventing the double submit. This may be an alternative: synchronized(sharedSessionBean){ if (magicMethodToCheckForDoubleProcessingYouNeedToWrite()){ abstractBean.setSharedSession(sharedSessionBean); abstractBean.setRequest(request); abstractBean.setResponse(response); abstractBean.setServlet(this); abstractBean.process(); abstractBean.footerProcess(); } else { //goto double submit error page } } -Tim Jenya Strokin wrote: > I'm using servlet. But if you know way how to do this from JSP, please share > it.)) > This is my method wich called from doGet and doPost: > > public void doGetPost(HttpServletRequest request, HttpServletResponse > response) > throws ServletException, IOException { > /*------------------------------------------------------ > If user clicks link twice, browser will get the same screen two times mixed. > So, I need synchronized processes. But after that browser will get the same > screen one after another. So I need close output after I process first > request, and second request can not write to output string. > --------------------------------------------------------*/ > > synchronized(request){ > abstractBean.setSharedSession(sharedSessionBean); > abstractBean.setRequest(request); > abstractBean.setResponse(response); > abstractBean.setServlet(this); > abstractBean.process(); > > abstractBean.footerProcess(); > //---------- I'm trying to close output here, but second process write its > data anyway > // out.close(); > response.getWriter().close(); > } > } > > If this information is not enough, I'll provide more. > Thanks for any help. > > -----Original Message----- > From: Durham David Cntr 805CSS/SCBE [mailto:[EMAIL PROTECTED]] > Sent: Thursday, July 18, 2002 10:18 AM > To: Tomcat Users List > Subject: RE: How to close a response? > > > Need more detail about your problem. Are you having a problem with JSP? > > -----Original Message----- > From: Jenya Strokin [mailto:[EMAIL PROTECTED]] > Sent: Thursday, July 18, 2002 9:17 AM > To: [EMAIL PROTECTED] > Subject: How to close a response? > > > Hi, > I need to close the response completely. In some case I need to avoid any > process write to response output. > Using > response.getOutputStream().close(); > response.getWriter().close(); > response.reset(); > do not help. > Thanks for any suggestions. > > Jenya > > ------------------------------------------- > Introducing NetZero Long Distance > Unlimited Long Distance only $29.95/ month! > Sign Up Today! www.netzerolongdistance.com > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > ------------------------------------------- > Introducing NetZero Long Distance > Unlimited Long Distance only $29.95/ month! > Sign Up Today! www.netzerolongdistance.com > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
