Hello group
I have two problems-questions I would like to ask you for help on
1. I need my Tomcat to call myWelcomeServlet instead of one of the files from welcome-file-list. I know that I can use a redirection from html to a servlet but because of some other reasons we rather prefer to implement direct servlet invocation.
I can not find any example of such configuration so I am not sure it is possible.
If someone of you knows how to make it working please let me know.
2. The following code:
Cookie setSessionCookie = new Cookie("session",myAppUserSession);
sessionCookie.setMaxAge(1800);
response.addCookie(setSessionCookie);
response.sendRedirect(request.getRequestURI());
This code will be always invoked for a user accessing myAppServlet if his myAppUserSession has not been established yet. The problem with this intermediate servlet handling redirection is that:
- if there is no cookie saved under cookies on a client machine response.addCookie will create the cookie, but
- a page to which a user has been redirected to by sendRedirect can not read that cookie yet.
Do you have any idea what I can do to make it working even if a user if connecting and receiving a cookie for a first time?
Thank you for your help
Darek
