Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java RMI - is that possible to take client Desktop screen shot who are browsing our application

 
joson sri
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ..

i wanted to taken user desktop screen shot when user abadon's the web page, prepare a report and send to admin mailbox.

i could use java rmi and smtp to fullfill the requirement.

But the following code when i run will take only the server(when application deployed) screenshot instead of user(client) screenshot of our webpage.

Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage capture;
try {
capture = new Robot().createScreenCapture(screenRect);
ImageIO.write(capture, "bmp", new File("D:\\test\\test.bmp"));

Please let me know if it is possibale to get the scrren shot of the client's webpage(our application) page using java or anything client side programming.

Thanks in advance.


}
 
Rob Spoor
Sheriff
Pie
Posts: 20529
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Code gets executed on the machine it runs on. For RMI the code is not transported to the client. When the client calls the method, RMI sends this request to the server. The server then executes the method, and sends any results / exceptions back to the client. Because the server executes the actual code the screenshot is created on the server.

If you need to take a screenshot of the client then the capturing code must occur on the client. The result can then be sent through RMI to the server, but keep in mind that this result must be serializable. BufferedImage isn't, but you can use ImageIO in combination with ByteArrayOutputStream to send convert the image to a byte[], then use ImageIO with ByteArrayInputStream to convert the byte[] back into a BufferedImage. byte[] is serializable so you can use it as a parameter with RMI without a problem.
 
joson sri
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Spoor, Thanks for the reply..
sorry to late reply as i was stuck in some other work.

i am not aware how do i execute the RMI block of code on client side. usually web application holds jsp as front end and how do i execute the RMI block of code on client side.
please let me know how do i do that..

Thanks in Advance

joson
 
Rob Spoor
Sheriff
Pie
Posts: 20529
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to run a piece of software on the client. That's either a stand-alone Java application that communicates with your server through RMI, or an applet (which must probably be signed).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic