I ran into a similar problem dealing with ASP pages which redirect to another
ASP page. I found that by grabbing the Cookie info from the header, and
including it on future requests, I was able to maintian the ASP session across
multiple ASP pages. My problem though was a Java networking issue instead of a
servlet issue as I was corrected on by other knowledgable indivuals. Here's an
example of the code I used:
try {
URL url = new URL(reqURL);
URLConnection connect = url.openConnection();
//Get current cookie info (really ASP session ID)
cookie = connect.getHeaderField ("Set-Cookie");
//Get location of new ASP page I'm being redirected to
location = connect.getHeaderField("Location");
BufferedReader in = new BufferedReader(
new InputStreamReader(connect.getInputStream()));
//Get response
while ((inputLine = in.readLine()) != null)
outPut = outPut + inputLine;
in.close();
} catch (Exception e) {
outPut = "Error: " + e;
} //try
reqURL = "http://someasp.server.com";
reqURL = reqURL + location;
try {
URL url = new URL(reqURL);
URLConnection connect = url.openConnection();
//Pass the original ASP session ID back
connect.setRequestProperty("Cookie", cookie);
outPut="";
BufferedReader in = new BufferedReader(
new InputStreamReader(connect.getInputStream()));
//Get response
while ((inputLine = in.readLine()) != null)
outPut = outPut + inputLine;
in.close();
} catch (Exception e) {
outPut = "Error: " + e;
} //try
System.out.println(outPut);
}
}
Alex Amies <[EMAIL PROTECTED]> on 05/04/2001 08:31:01 AM
Please respond to "A mailing list for discussion about Sun Microsystem's Java
Servlet API Technology." <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Wendell Joyner/Corporate/AirTouch)
Subject: Re: How to I keep track of ASP session in JAVA servlets.
You will need to use cookies to do home baked session management.
Establish
a session by adding a session cookie at logon and more cookies for
session
data shared between servers. Check out a good servlet reference book,
most
discuss this.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 04, 2001 5:42 AM
To: [EMAIL PROTECTED]
Subject: Re: How to I keep track of ASP session in JAVA servlets.
i'm also finding these solution.
if you had got it......... publish it please.....
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java
Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf
Of soumya Govardhana
Sent: Tuesday, August 22, 2000 12:46 AM
To: [EMAIL PROTECTED]
Subject: How to I keep track of ASP session in JAVA servlets.
Hi All,
I'm working on in designing a web application. Our application is
half in ASP and hlaf in JAVA servlets. When I work at Servlet side ASP
session is getting expired. How do I keep track of it. I want to run a
single seesion for both ASP and Java. Is it possible?
DOn't ask why our application is running with both?
Thanks in advance for replies ,
Soumya
________________________________________________________________________
___
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
___________________________________________________________________________
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