From: <php...@li...> - 2010-06-21 07:15:15
|
Hi, I have a Java servlet (myServlet) running on Tomcat (downloaded from Apache). I also have a PHP script (test.php) sitting in the same directory as the servlet. I want to call functions in the PHP script from the Java servlet. I have deployed the JavaBridge.war file, can hit and run the examples, so I'm guessing nothing is broken in so far as JavaBridge and Tomcat are concerned. >From the examples, to reference the PHP script I should use something like: ScriptEngine scriptEngine = new ScriptEngineManager().getEngineByName( "php-invocable" ); scriptEngine.eval( new URLReader( "http://localhost/test.php" ); This does not make sense to me as my PHP script is not browseable (I only have Tomcat running on port 8080). I'd prefer not to access my script via a new request to Tomcat. Isn't it possible to access the script directly via the filesystem? If I try to pass in a URL as a file rather than http, I get a class cast exception: java.lang.ClassCastException: sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection Thanks, Bernard. _________________________________________________________________ New, Used, Demo, Dealer or Private? Find it at CarPoint.com.au http://clk.atdmt.com/NMN/go/206222968/direct/01/ |