[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index] [Home]

Re: Help really urgent !!!



Hi Vaibhav,

you need a way to differentiate between the clients calling your
page/servlet. The only accuryte way is by using cookies or
another "session id" or "user id" that identifies the person.
A less accurate way (because of proxies or multiple user machines)
is to get the REMOTE_HOST the user is making the request from
and make a hash of count values hashed by the remote host value.

>This is something really urgent...could anybody please guide me what
>should i do...i am sending u what exactly i want and what is
>happening....here is an example below which increments value of variable
>count and it is accessible to every thread...now i want count variable
>to be different for different threads...could anybody please guide me
>what are the approaches  available
>to implement this except for putting "count"  variable in the
>session....
>
>Thanks in advance !!!
>
>Vaibhav
>
>
>import java.io.*;
>import javax.servlet.*;
>import javax.servlet.http.*;
>
>public class RefreshServlet extends HttpServlet
>{
>  int count=0;
>    public void init(ServletConfig config) throws ServletException
>  {
>    super.init(config);
>  }
>
>  public void doGet(HttpServletRequest req, HttpServletResponse resp)
>  throws ServletException, IOException
>  {
>    resp.setContentType("text/html");
>    PrintWriter out = new PrintWriter(resp.getOutputStream());
>
>
>    out.println("<HTML>");
>    out.println("<HEAD><TITLE>RefreshServlet Output</TITLE></HEAD>");
>    out.println("<BODY>");
>
>    count++;
>
>    out.println("The count is "+count);
>
>    out.println("</BODY>");
>    out.println("</HTML>");
>    out.close();
>  }
>
>}
>
>
>
>
>Could anybody please suggest me what should i do to counter this....coz
>i do
>want different variables for different threads...
>
>Thanks in advance
>
>Vaibhav
>
>
>
>
>

Ciao,
	Carsten Heyl

  Carsten Heyl                          Heyl@NADS.De
  NADS - Solutions on Nets              http://www.nads.de/
  NADS GmbH                             http://www.pixelboxx.de/
  Hildebrandtstr. 4E                    Tel.: +49 211 933 02-90
D-40215 Duesseldorf                     Fax.: +49 211 933 02-93