Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


}
 
Sheriff
Posts: 22644
123
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 22644
123
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
And then the flying monkeys attacked. My only defense was this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic