Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Access scanner from tomcat?

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Forum,

I've done java programming before. But, I'm not sure if i can call a scanner(or any other programme which is outside the tomcat and in the same system) which is attached to the server from the Tomcatserver Java Spring application. I have the API which can take care of calling the scanner. But, can it be done is the question?

if not what can be done?
 
Saloon Keeper
Posts: 22253
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Sai!

Tomcat-based webapps can definitely call external programs, including shell scripts, using the Runtime.exec() or similar techniques.

There is no built-in scanner support for Java, but if you have a Native class that implements a scanner API, you can use that.

The only restrictions are that whatever you do must be allowable for the userId that the Tomcat server is running under.

A bigger problem is logistics. Webapps run on servers, and servers are often locked away somewhere which means that the scanner unit might not be physically accessible to some or all users.

If you were thinking of scanning using a unit attached to a user's desktop, however, there are bigger issues. One of them is that HTTP protocol wasn't designed to work with scanning devices. You can scan on the desktop and transmit the image to a server, but actually having the server run the scanner is basically not possible. About the closest you could come would be to embed an applet with the scanner control code on a web page. But unsigned applets are prohibited from the use of resources needed to operate the scanner, so you'd have to use a signed applet, and that can be a real annoyance.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should certainly not try to use a request Thread to do the scanning, too many possibilities for disaster.

Instead, perfect your scanner code in a class which can run its own Thread and make status information available to servlets.

Bill
 
sai pabb
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot guyz!!! You definitely cleared my doubt!!
 
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic