Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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.
 
Author and ninkuma
Marshal
Posts: 66783
168
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!