You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lessault Jean-Luc <JL...@kheops.com> on 2001/10/12 11:18:11 UTC
To keep beans sessions associated at jsp files in a servlet...hel
p!
hi,
in order to make a web cache, I'm looking for to keep a answers local copy.
But I'm loosing beans sessions associated at jsp files " filename.jsp "
(line 5)
in using the following code lines.Nevertheless the session servlet
"request.getRequestedSessionId()" is the same.
Why?
public void makeTask( Task task){
URL url=null;
setStatus("good");
try{
url= new URL("http://localhost:8080/jspcontext/filename.jsp");
URLConnection con=url.openConnection();
con.connect();
String contentType=con.getContentType();
HttpURLConnection httpconn=(HttpURLConnection)con;
if (httpconn.getResponseCode() == HttpURLConnection.HTTP_OK)
if (contentType.startsWith("text/"))
{
returnURLText(con.getInputStream(),contentType);
}
}
}
catch(MalformedURLException mue)
{...}
catch(Exception e)
{...}
}
public void returnURLText(InputStream instream, String contentType){
InputStream in=null;
String text="";
try{
InputStreamReader isr= new InputStreamReader(instream);
BufferedReader in= new BufferedReader(isr);
Html_Parser parser=new Html_Parser(in);
text=parser.parse();
setResponse(text, contentType));
in.close();
isr.close();
}
catch(IOException ioe){
System.out.println("IOException"+ ioe.toString());
}
}
I note, I keep sessions in using
"getServletContext().getRequestDispatcher("/fileName.jsp").forward(request,r
esponse);"
unfortunately this method not allowed to keep a local copy.
I would be very happy if someone say me a solution and why not, give me code
lines tosolve this problem.
Thanks to all, in advance.