Dan, You might want to look into using query string parameters rather than relying on an existing session. There are several reasons for this. 1) The session exists only between the particular browser that the user is currently using. If the email was received on another machine, the session would not be valid. 2) The session only lasts for a set amount of time. Email can take a long time to get delivered or checked. By the time the user gets the email and clicks on the link, the session might be gone. 3) The user might click on the email link days after receiving the email which by then, the session would almost certainly be gone. 4) The session state isn't transferrable across web applications. Both servlets would have to be part of the same web application for it to work. I'm not exactly sure what you meant by this statement, "Session tracking is done using cookies, which are (apparently) not shared between the servlet running in the browser, and the servlet being requested from within that servlet."
One approach would be to store the necessary information in a database record with a randomly generated string as a primary key. You could then attach this key as a query parameter in your email link. Regards, Richard Regards, Richard At 05:24 PM 5/1/2002 +0100, you wrote: >Ladies and gents, > >I am trying to write a servlet which will email the response of another >servlet. I've got the opening of the page, reading the response, then >emailing the contents done OK. > >However, the page being read (by way of URLConnection uc = >url.openConnection()) relies heavily on session state. Session tracking is >done using cookies, which are (apparently) not shared between the servlet >running in the browser, and the servlet being requested from within that >servlet. > >I have tried tacking ";jsessionid=" + <HttpSession>.getId() but this doesn't >work, I suspect since the session interceptor ignores that since it is only >expecting a cookie. > >Does anyone have any idea on whether it is even possible to use the same >session when requesting servlets in this way, and if so, how? :-) > >I am using Tomcat stand-alone on a Win2k server. IE6 is the browser I am >using to connect. > >Any advice appreciated. > >Thanks, > >Dan > >___________________________________________________________________________ >To unsubscribe, send email to [EMAIL PROTECTED] and include in the body >of the message "signoff SERVLET-INTEREST". > >Archives: http://archives.java.sun.com/archives/servlet-interest.html >Resources: http://java.sun.com/products/servlet/external-resources.html >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
