aspose file tools*
The moose likes Java in General and the fly likes Java RMI - is that possible to take client Desktop screen shot who are browsing our application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java RMI - is that possible to take client Desktop screen shot who are browsing our application " Watch "Java RMI - is that possible to take client Desktop screen shot who are browsing our application " New topic
Author

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

joson sri
Greenhorn

Joined: Nov 26, 2010
Posts: 5
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

Joined: Oct 27, 2005
Posts: 19718
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
joson sri
Greenhorn

Joined: Nov 26, 2010
Posts: 5
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

Joined: Oct 27, 2005
Posts: 19718
    
  20

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).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java RMI - is that possible to take client Desktop screen shot who are browsing our application