File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Storing last user page in DB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Storing last user page in DB" Watch "Storing last user page in DB" New topic
Author

Storing last user page in DB

Prasad Rachakonda
Greenhorn

Joined: Apr 22, 2004
Posts: 1
In my project we have to store user's currently displayed page content(html code) in DB. This is useful for CSR to see user's current page. I'm planning to use servletFilter's concept but not sure how to get the html code as a stream/string inorder to store in DB. I appreciate any suggestions/comments?
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
You can use following code to get the HTML:
try {
URL url = new URL("http://www.somesite.com/eng/index.htm");
DataInputStream in = new DataInputStream(url.openStream());
InputStreamReader r = new InputStreamReader(in);
BufferedReader reader = new BufferedReader(r);
String line = null;
while((line = reader.readLine()) != null){
System.out.println("LINE : " + line);
}
}
catch (Exception ex) {
}
Brahim Bakayoko
Ranch Hand

Joined: Aug 29, 2003
Posts: 155
Use a filter with a response wrapper then save the data before sending to the user.
You can use this as a jumpstart:


SCJP, SCWCD, SCBCD, IBM CSD WebSphere v5, <br />A+, MCP 2000 and 2000 server, CST, and few incompleted certification tracks.<br /> <br />Ivory Coast<br /> <br />Analyze your web Request/Response @ <a href="http://webtools.servehttp.com" target="_blank" rel="nofollow">http://webtools.servehttp.com</a> down for a while...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Storing last user page in DB