I am developing a web application, now what I want to do is to use a HASHMAP through out the application, by mean when server starts to server stops and I should be able to play with it mean while also.
Thanks for your time.
PS : session is not available to me always [ December 16, 2008: Message edited by: rudradutt joshi ]
I'm afraid I don't understand your question. Are you saying that you want to be able to control the stopping and starting of the server from your code?
NO, what I want to do is, create an Object which's scope is application. I want to create an Object (suppose myObject). Now when I request for Object say
if it will be null, than I will create value for "keyName" and add it to Object
now I want this Object to be available throughout the application like HttpSession but I dont have any HTTP request,response to create a session with my current status.
[ December 16, 2008: Message edited by: rudradutt joshi ] [ December 16, 2008: Message edited by: rudradutt joshi ]
now how will I found the servletContext from another bean like
[ December 17, 2008: Message edited by: rudradutt joshi ]
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
That said, it doesn't necessarily have to be a servlet. That's a very odd design. Just let an HttpServlet (or, better, a ServletContextListener) create an independent FenceMap object and place it in the desired scope.
Also, testingservlets as a Java Application (with main()) isn't going to work. Test it as a servlet in a real webcontainer. Use an appserver and a webbrowser or JUnit. [ December 17, 2008: Message edited by: Bauke Scholtz ]
I had redesign the ServletContextListener for the application, but now as it is happening, I have to accept some times request from TCP/UDP ports also. In such cases it throws
Originally posted by rudradutt joshi: In such cases it throws
as no servletcontext is available.
So i want a solution of that.
Did you read my last comment anyway?
Also, testing servlets as a Java Application (with main()) isn't going to work. Test it as a servlet in a real webcontainer. Use an appserver and a webbrowser or JUnit.