This week's book giveaway is in the Web Services forum.
We're giving away four copies of Microservices in Action and have Morgan Bruce & Paulo A. Pereira on-line!
See this thread for details.
Win a copy of Microservices in Action this week in the Web Services 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Calling a JAR file from JSP or from a PHP page or another option?  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JAR that is a simple command line program/utility that converts an image file to another image format. I need to integrate this into a website where users upload image files and the files are converted to another image format. All the pages for the site are written in PHP and all image files are stored on the file system (not in a database). What is the recommended approach to integrate this JAR into the website - by calling a JSP from a PHP page or by calling the JAR directly from PHP...or another recommended way to integrate the JAR into the website?

Ideally, I would like to have the JAR called (with the required parameters) to convert each image file as soon as it has finished uploading.

I was planning on creating a script that would be called by a CRON job to scan for new/changed files or folders and for the conversion utility to run on those files or folders, but this doesn't provide the desired user experience. We'd like to minimize the time between when an image is uploaded to when it is converted to another image format. Thanks in advance.
 
Marshal
Posts: 67165
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JSP is simply a template for creating an HTML page so I don't see how JSP enters into this at all.

What I'd explore is creating a web service from the Java code, and have the PHP call the web service.
 
Mohit Mathur
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear, I like the recommendation. Though if I go down this route, should I design the webservice to only require a parameter of the file path of the image file to convert (since the file will be uploaded to the server and I want the WebService to perform the conversion on the files that reside on the server)? Or would you recommend that the PHP passes the image file to be uploaded to the WebService and the WebService handles the process to upload the image file and then the conversion.

Any recommendations on designing a WebService that performs file I/O on the hosting server would be appreciated. Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!