You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(6) |
Nov
(8) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(19) |
Feb
(15) |
Mar
(10) |
Apr
(8) |
May
(7) |
Jun
(9) |
Jul
(13) |
Aug
(31) |
Sep
(111) |
Oct
(52) |
Nov
(72) |
Dec
(42) |
2006 |
Jan
(21) |
Feb
(32) |
Mar
(33) |
Apr
(24) |
May
(15) |
Jun
(40) |
Jul
(32) |
Aug
(19) |
Sep
(38) |
Oct
(37) |
Nov
(63) |
Dec
(37) |
2007 |
Jan
(18) |
Feb
(39) |
Mar
(69) |
Apr
(49) |
May
(71) |
Jun
(59) |
Jul
(71) |
Aug
(85) |
Sep
(46) |
Oct
(14) |
Nov
(25) |
Dec
(56) |
2008 |
Jan
(24) |
Feb
(77) |
Mar
(104) |
Apr
(44) |
May
(41) |
Jun
(11) |
Jul
(31) |
Aug
(59) |
Sep
(44) |
Oct
(86) |
Nov
(66) |
Dec
(93) |
2009 |
Jan
(88) |
Feb
(41) |
Mar
(49) |
Apr
(135) |
May
(22) |
Jun
(31) |
Jul
(60) |
Aug
(71) |
Sep
(76) |
Oct
(18) |
Nov
(52) |
Dec
(20) |
2010 |
Jan
(8) |
Feb
(50) |
Mar
(35) |
Apr
(48) |
May
(46) |
Jun
(84) |
Jul
(38) |
Aug
(61) |
Sep
(51) |
Oct
(31) |
Nov
(17) |
Dec
(18) |
2011 |
Jan
(51) |
Feb
(14) |
Mar
(17) |
Apr
(23) |
May
(15) |
Jun
(11) |
Jul
(5) |
Aug
(5) |
Sep
(15) |
Oct
(8) |
Nov
(5) |
Dec
(25) |
2012 |
Jan
(2) |
Feb
(4) |
Mar
(6) |
Apr
(9) |
May
(27) |
Jun
(32) |
Jul
(36) |
Aug
(10) |
Sep
(16) |
Oct
(3) |
Nov
(13) |
Dec
(7) |
2013 |
Jan
(1) |
Feb
(4) |
Mar
|
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(4) |
Oct
(2) |
Nov
(1) |
Dec
|
2014 |
Jan
|
Feb
|
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(9) |
Jul
(5) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
2015 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(3) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(2) |
Sep
(5) |
Oct
(1) |
Nov
|
Dec
|
2016 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
2017 |
Jan
(6) |
Feb
|
Mar
|
Apr
(10) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
2018 |
Jan
(2) |
Feb
(5) |
Mar
|
Apr
|
May
(1) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2021 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <php...@li...> - 2010-09-24 15:53:02
|
Hi, where you can get the file php-5.0-java-x86-windows.dll or java-x86-windows.dll to test the bridge between php and java, and that the war is not found. Thank's |
From: <php...@li...> - 2010-09-23 17:38:19
|
> am not understanding how http://sourceforge.net/mailarchive/message.php?msg_id=AANLkTikUyejJ_jaZ9XBo2DUL1r9_RK6_W-bCyoByJ_4t%40mail.gmail.com is related to my problem.. It probably isn't. http://localhost:8080/test/env.jsp/tail?a=b => URI /test/env.jsp/tail ServletPath /test/env.jsp PathInfo /tail QueryString a=b a b >env.servletPath = (String) req.getAttribute("javax.servlet.include.servlet_path"); >if (env.servletPath == null) { >env.servletPath = req.getServletPath() + req.getPathInfo(); >} So PATH_INFO should be null for your request. The super.setupRequestVariables() sets env.servletPath = (String) req.getAttribute("javax.servlet.include.servlet_path"); if (env.servletPath == null) env.servletPath = req.getServletPath(); which is equivalent to your code. Regards, Jost Bökemeier |
From: <php...@li...> - 2010-09-22 17:59:01
|
I downloeded 6.2.1.RC3 http://sourceforge.net/projects/php-java-bridge/files/Binary%20package/php-java-bridge_6.2.1rc3/exploded/JavaBridge.jar/download We use Tomcat with our JBOSS. I am not understanding how http://sourceforge.net/mailarchive/message.php?msg_id=AANLkTikUyejJ_jaZ9XBo2DUL1r9_RK6_W-bCyoByJ_4t%40mail.gmail.com is related to my problem... Please elaborate. Thanks! Theen-Theen On Sep 22, 2010, at 10:01 AM, <php...@li...> wrote: > Hi, > > you say "latest" PHP/Java Bridge version. I assume it is version > 6.2.1RC3. -- latest stable is 5.4.something. > > >> env.servletPath = (String) req.getAttribute("javax.servlet.include.servlet_path"); > > We've made a change regarding this, please see > http://sourceforge.net/mailarchive/message.php?msg_id=AANLkTikUyejJ_jaZ9XBo2DUL1r9_RK6_W-bCyoByJ_4t%40mail.gmail.com > > >> JBOSS, and its own servlet container. > > I don't think jboss uses its own servlet container. Do you use jetty or tomcat? > > > Regards, > Jost Bökemeier > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users |
From: <php...@li...> - 2010-09-22 17:08:30
|
> ? Is this the way? Well the "destop guide" shows how to extend your Java desktop application to allow scripting. For web applications please follow the other guide (web front-end => servlet/jee back-end). You *can* use JavaBridge.jar instead of a servlet back end. But note that the standalone JavaBridge.jar container isn't as efficient as a servlet or JEE container. Regards, Jost Bökemeier |
From: <php...@li...> - 2010-09-22 17:01:11
|
Hi, you say "latest" PHP/Java Bridge version. I assume it is version 6.2.1RC3. -- latest stable is 5.4.something. > env.servletPath = (String) req.getAttribute("javax.servlet.include.servlet_path"); We've made a change regarding this, please see http://sourceforge.net/mailarchive/message.php?msg_id=AANLkTikUyejJ_jaZ9XBo2DUL1r9_RK6_W-bCyoByJ_4t%40mail.gmail.com > JBOSS, and its own servlet container. I don't think jboss uses its own servlet container. Do you use jetty or tomcat? Regards, Jost Bökemeier |
From: <php...@li...> - 2010-09-22 16:35:04
|
Hi, JBOSS, and its own servlet container. I wrote a servlet that replaced this in FastCGIServlet protected void setupRequestVariables(HttpServletRequest req, Environment env) { super.setupRequestVariables(req, env); env.servletPath = (String) req.getAttribute("javax.servlet.include.servlet_path"); if (env.servletPath == null) { env.servletPath = req.getServletPath() + req.getPathInfo(); } } And I can get to pages with https://localhost:8080/ctx/directory/directory/test.php now. But not sure if I should do that ... PS. I don't know how to reply to my own email in digest mode... Thanks. Theen-Theen Message: 5 Date: Wed, 22 Sep 2010 08:54:18 +0200 From: php...@li...<mailto:php...@li...> Subject: Re: [Php-java-bridge-users] No input file specified. To: php...@li...<mailto:php...@li...> Message-ID: <AANLkTi=FuwJ5jX9VPvPEaxGLMrDEdzZH_0pF=3M...@ma...<mailto:AANLkTi=FuwJ5jX9VPvPEaxGLMrDEdzZH_0pF=3M...@ma...>> Content-Type: text/plain; charset=UTF-8 jboss/jetty or jboss/tomcat? On Sep 21, 2010, at 1:40 PM, Theen-Theen Tan wrote: Hi, I am running - on MacOSX - php-cgi compiled using Macport. - latest php-java-bridge - JBOSS 4.0.3 - I do not have the doc_root variable set in my php.ini I can access the test.php page (which is a call to phpinfo) fine from php-cgi directly, or when I place it one level from my web app root. But I get "No input file specified." on the page when I place the file under a directory. Here are the various environment parameters that is useful for debugging. For me, it looks like both SCRIPT_NAME and SCRIPT_FILENAME are wrong. This fails https://localhost:8080/ctx/directory/directory/test.php PATH_INFO=/test.php PATH_TRANSLATED=/<JBOSS_HOME>/server/myserver/./deploy/ctx.war/test.php SCRIPT_NAME=/ctx/directory SCRIPT_FILENAME=/<JBOSS_HOME>/server/myserver/./deploy/ctx.war/directory This works https://localhost:8080/ctx/test.php SCRIPT_NAME=/ctx/test.php SCRIPT_FILENAME=/<JBOSS_HOME>/server/myserver/./deploy/ctx.war/test.php What can be done? Thanks. Theen-Theen |
From: <php...@li...> - 2010-09-22 12:08:39
|
Hello, I'm new to php/java bridge and I'm wondering if I could use this fantastic project in a work of mine. The "problem" is the follow: I have to create a Webservices running on a customized-centos to offer an access to some business operation. My goal is to write the webservices in PHP (as I've already an Apache running on my distro) and write the business operations in java (to avoid my code to be read or edited). Business operations would be a collection of classes rappresenting database entities, classes to manipulate them and some other stuff. I could say I want to create a java-layer between php-webservices and database server. Reading at the installation guide, I've found out one could create a "desktop" java client and call it's methods and classes within php. I don't understand if it's my scenario (webservices + persistence-layer) or it's completely different. So, do I need to write something like the follow: - a java-main class like public class Test { public static final String JAVABRIDGE_PORT="8087"; static final php.java.bridge.JavaBridgeRunner runner = php.java.bridge.JavaBridgeRunner.getInstance(JAVABRIDGE_PORT); public static void main(String args[]) throws Exception { //some initializations go here? runner.waitFor(); System.exit(0); } //and then write a contract for php public Model getModel(String modelName).. public boolean someStuff() } public interface Model{ public boolean save(); } -and within php <?php require_once("http://localhost:8087/JavaBridge/java/Java.inc"); $dbLibrary = new java("Test"); $model = $dbLibrary->getModel("myModel"); //does it return a valid class with a valid db connection(if i setted it in the model)? //do some stuff on model $model->save(); //should it work????? ?> ? Is this the way? Thank you very much Giorgio Maria Santini |
From: <php...@li...> - 2010-09-22 06:54:24
|
jboss/jetty or jboss/tomcat? On 9/21/10, php...@li... <php...@li...> wrote: > Hi, > > I am running > > - on MacOSX > - php-cgi compiled using Macport. > - latest php-java-bridge > - JBOSS 4.0.3 > - I do not have the doc_root variable set in my php.ini > > I can access the test.php page (which is a call to phpinfo) fine from > php-cgi directly, or when I place it one level from my web app root. But I > get "No input file specified." on the page when I place the file under a > directory. > > Here are the various environment parameters that is useful for debugging. > For me, it looks like both SCRIPT_NAME and SCRIPT_FILENAME are wrong. > > This fails > > https://localhost:8080/ctx/directory/directory/test.php > > PATH_INFO=/test.php > PATH_TRANSLATED=/<JBOSS_HOME>/server/myserver/./deploy/ctx.war/test.php > SCRIPT_NAME=/ctx/directory > SCRIPT_FILENAME=/<JBOSS_HOME>/server/myserver/./deploy/ctx.war/directory > > This works > > https://localhost:8080/ctx/test.php > > SCRIPT_NAME=/ctx/test.php > SCRIPT_FILENAME=/<JBOSS_HOME>/server/myserver/./deploy/ctx.war/test.php > > What can be done? > > Thanks. > > Theen-Theen > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > |
From: <php...@li...> - 2010-09-21 21:14:59
|
Hi, I am running - on MacOSX - php-cgi compiled using Macport. - latest php-java-bridge - JBOSS 4.0.3 - I do not have the doc_root variable set in my php.ini I can access the test.php page (which is a call to phpinfo) fine from php-cgi directly, or when I place it one level from my web app root. But I get "No input file specified." on the page when I place the file under a directory. Here are the various environment parameters that is useful for debugging. For me, it looks like both SCRIPT_NAME and SCRIPT_FILENAME are wrong. This fails https://localhost:8080/ctx/directory/directory/test.php PATH_INFO=/test.php PATH_TRANSLATED=/<JBOSS_HOME>/server/myserver/./deploy/ctx.war/test.php SCRIPT_NAME=/ctx/directory SCRIPT_FILENAME=/<JBOSS_HOME>/server/myserver/./deploy/ctx.war/directory This works https://localhost:8080/ctx/test.php SCRIPT_NAME=/ctx/test.php SCRIPT_FILENAME=/<JBOSS_HOME>/server/myserver/./deploy/ctx.war/test.php What can be done? Thanks. Theen-Theen |
From: <php...@li...> - 2010-09-21 17:14:49
|
Hi Ian, > I don't normally call this manually but let the main site __destruct() > function call handle the saving of all my objects into a session > variable the __destruct() hook lets you destroy external resources associated with the current class instance. What you are looking for is the __sleep() hook, which lets you save the object state. Please see the PHP documentation for details. Please see also: http://bugs.php.net/bug.php?id=49432 Regards, Jost Bökemeier |
From: <php...@li...> - 2010-09-21 13:25:56
|
On 20/09/2010 19:25, php...@li... wrote: > Hi, > > not if we want to get PHP/Java Bridge 6.2.1 through the release tests, > no. Please see http://php-java-bridge.cvs.sourceforge.net/viewvc/php-java-bridge/php-java-bridge/tests.php5/session_write_close_bug.php?revision=1.5&content-type=text%2Fplain > > This problem should be solved on PHP level, please see > http://bugs.php.net/bug.php?id=46451 > > >> This was causing >> problems with my application by saving the session before I had finished >> using it. > > Why and how do you want to access the session after the evaluator shutdown? Hi, Thanks for the response, although I don't quite understand what's going on so please bare with me ;) The site I am working is pure php but in order to process a particular type of transaction I have to use a Java library. I have placed all the code I need into a php class and call this when necessary. I have found that session variable set after using this class aren't stored. (This was very frustrating to debug as you can imagine.) Could you tell me when and under what circumstances the java_shutdown() function is called? I may be able to alter my code to work around this issue if it is necessary to run the session_write_close() at that point. I don't normally call this manually but let the main site __destruct() function call handle the saving of all my objects into a session variable - which is then rebuilt when another page is called. Thanks for your assistance. Ian -- |
From: <php...@li...> - 2010-09-20 20:42:32
|
probably the decorator resets or reverts your changes. we wlll see On 9/20/10, php...@li... <php...@li...> wrote: > Anyone, Jost, got any thoughts on why this PHP script is not working > as I would expect it to? I am stuck until I can find a solution... > Thanks... Marc.. > > On 9/15/2010 6:31 PM, php...@li... wrote: >> Jost, all - >> >> I have been doing more investigations into why the php-java bridge is >> not working as I would expect, but so far I got no joy in why it is >> failing... So I thought I would send in a concise version of the jsp >> code/file I am trying to set up, and see if you or anyone else can spot >> what I am doing wrong.... (this also shows the interplay between jsp >> variables and the Javascript/PHP scripts, which is why I am choosing to >> use JSP) >> >> What I am discovering, is that as expected the method evalPHP is being >> called (twice). The call to the function - outputJavaScript in my PHP >> script does indeed return a Javascript statement (via the internal call >> to pass_to_php_backend), which is a String variable, and I can in fact >> put an echo statement just before the return and see that the expected >> Javascript statement is produced. But what is NOT happening is that >> this returned string is produced in the output document, at the point of >> call to evalPHP. (I have placed calls to alerts to show this is indeed >> what is happening, as can be seen in the following code.) >> >> Thoughts? Thanks again in advance for helping me with this... Marc... >> >> >> <?xml version="1.0" encoding="UTF-8"?> >> <!DOCTYPE html >> PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> >> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> >> <%@ page import="java.io.*" %> >> <%@ page import="org.apache.commons.lang.*" %> >> <%@page import="javax.script.*" %> >> <%@page import="php.java.script.servlet.*" %> >> >> <head> >> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> >> <title>Example</title> >> >> <% >> String url = request.getAttribute("URL").toString(); >> String file = request.getAttribute("DocPath").toString(); >> String docRootDir = file.substring(0, file.lastIndexOf("/")); >> String serverURL = request.getAttribute("ServerURL").toString(); >> String contextPath = "/" + >> request.getAttribute("ContextPath").toString(); >> String Dir = request.getAttribute("Dir").toString(); >> %> >> >> <% >> // My PHP script is defined here.... >> String phpScript = ""; >> phpScript = "require_once '" + Dir + "/java/Java.inc'; \n"; >> phpScript += "require_once '" + Dir + "/contrib/php-utilities.php'; \n"; >> >> phpScript += "function outputJavaScript() { \n"; >> phpScript += "$IMConfig = array(); \n"; >> phpScript += "$IMConfig['images_dir'] = '" + docRootDir + "/images'; \n"; >> phpScript += "$IMConfig['allowed_image_extensions'] = >> array('jpg','gif','png'); \n"; >> phpScript += "return pass_to_php_backend($IMConfig); \n"; >> phpScript += "} \n"; >> >> phpScript += "outputJavaScript(); \n"; >> %> >> >> <%! >> private static final CompiledScript script; >> static { >> try { >> script =((Compilable)(new >> ScriptEngineManager().getEngineByName("php"))).compile( >> "<?php echo eval(java_context()->get('script')); ?>"); >> } catch (ScriptException e) { >> throw new RuntimeException("bleh!"); >> } >> } >> // private static final String evalPHP(String arg) { >> private String evalPHP(String arg, HttpServletRequest request, >> HttpServletResponse response) { >> CompiledScript instance = >> (CompiledScript)((java.security.cert.CertStoreParameters)script).clone(); >> instance.getEngine().put("script", arg); >> OutputStream out = new ByteArrayOutputStream(); >> Writer writer = new OutputStreamWriter(out); >> instance.getEngine().getContext().setWriter(writer); >> instance.getEngine().setContext((ScriptContext)new >> >> PhpCompiledHttpScriptContext(instance.getEngine().getContext(),this,this.getServletContext(),request,response)); >> try { >> instance.eval(); >> } catch (ScriptException e) { >> throw new RuntimeException("bleh!"); >> } >> try { >> writer.close(); >> } catch (IOException e) { >> throw new RuntimeException("bleh!"); >> } >> String result = out.toString(); >> return result; >> } >> %> >> >> >> <script type="text/javascript"> >> url =<%= "\"" + serverURL + "\"" %> +<%= "\"" + contextPath + >> "\"" %>; >> lang = "en"; >> </script> >> >> <!--<script type="text/javascript" src="../Core.js"></script> --> >> <script type="text/javascript" src="Loader.js"></script> >> >> <script type="text/javascript"> >> config = config ? config : new Backend.Config(); >> config.fullPage = true; >> // pass the configuration to plugin >> if (config.FileManager) { >> with (config.FileManager) >> { >> a = "<%= evalPHP(phpScript, request, response) %>"; >> if (a == "") alert("No Output"); >> else { >> alert("Output = " + a); >> <%= evalPHP(phpScript, request, response) %> >> } >> >> } >> } >> }; >> </script> >> </head> >> >> <body> >> <!-- Content of body not important, removed --> >> </body> >> </html> >> >> >> ------------------------------------------------------------------------------ >> Start uncovering the many advantages of virtual appliances >> and start using them to simplify application deployment and >> accelerate your shift to cloud computing. >> http://p.sf.net/sfu/novell-sfdev2dev >> _______________________________________________ >> php-java-bridge-users mailing list >> php...@li... >> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users >> > > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > |
From: <php...@li...> - 2010-09-20 20:26:37
|
Anyone, Jost, got any thoughts on why this PHP script is not working as I would expect it to? I am stuck until I can find a solution... Thanks... Marc.. On 9/15/2010 6:31 PM, php...@li... wrote: > Jost, all - > > I have been doing more investigations into why the php-java bridge is > not working as I would expect, but so far I got no joy in why it is > failing... So I thought I would send in a concise version of the jsp > code/file I am trying to set up, and see if you or anyone else can spot > what I am doing wrong.... (this also shows the interplay between jsp > variables and the Javascript/PHP scripts, which is why I am choosing to > use JSP) > > What I am discovering, is that as expected the method evalPHP is being > called (twice). The call to the function - outputJavaScript in my PHP > script does indeed return a Javascript statement (via the internal call > to pass_to_php_backend), which is a String variable, and I can in fact > put an echo statement just before the return and see that the expected > Javascript statement is produced. But what is NOT happening is that > this returned string is produced in the output document, at the point of > call to evalPHP. (I have placed calls to alerts to show this is indeed > what is happening, as can be seen in the following code.) > > Thoughts? Thanks again in advance for helping me with this... Marc... > > > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE html > PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> > <%@ page import="java.io.*" %> > <%@ page import="org.apache.commons.lang.*" %> > <%@page import="javax.script.*" %> > <%@page import="php.java.script.servlet.*" %> > > <head> > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> > <title>Example</title> > > <% > String url = request.getAttribute("URL").toString(); > String file = request.getAttribute("DocPath").toString(); > String docRootDir = file.substring(0, file.lastIndexOf("/")); > String serverURL = request.getAttribute("ServerURL").toString(); > String contextPath = "/" + > request.getAttribute("ContextPath").toString(); > String Dir = request.getAttribute("Dir").toString(); > %> > > <% > // My PHP script is defined here.... > String phpScript = ""; > phpScript = "require_once '" + Dir + "/java/Java.inc'; \n"; > phpScript += "require_once '" + Dir + "/contrib/php-utilities.php'; \n"; > > phpScript += "function outputJavaScript() { \n"; > phpScript += "$IMConfig = array(); \n"; > phpScript += "$IMConfig['images_dir'] = '" + docRootDir + "/images'; \n"; > phpScript += "$IMConfig['allowed_image_extensions'] = > array('jpg','gif','png'); \n"; > phpScript += "return pass_to_php_backend($IMConfig); \n"; > phpScript += "} \n"; > > phpScript += "outputJavaScript(); \n"; > %> > > <%! > private static final CompiledScript script; > static { > try { > script =((Compilable)(new > ScriptEngineManager().getEngineByName("php"))).compile( > "<?php echo eval(java_context()->get('script')); ?>"); > } catch (ScriptException e) { > throw new RuntimeException("bleh!"); > } > } > // private static final String evalPHP(String arg) { > private String evalPHP(String arg, HttpServletRequest request, > HttpServletResponse response) { > CompiledScript instance = > (CompiledScript)((java.security.cert.CertStoreParameters)script).clone(); > instance.getEngine().put("script", arg); > OutputStream out = new ByteArrayOutputStream(); > Writer writer = new OutputStreamWriter(out); > instance.getEngine().getContext().setWriter(writer); > instance.getEngine().setContext((ScriptContext)new > > PhpCompiledHttpScriptContext(instance.getEngine().getContext(),this,this.getServletContext(),request,response)); > try { > instance.eval(); > } catch (ScriptException e) { > throw new RuntimeException("bleh!"); > } > try { > writer.close(); > } catch (IOException e) { > throw new RuntimeException("bleh!"); > } > String result = out.toString(); > return result; > } > %> > > > <script type="text/javascript"> > url =<%= "\"" + serverURL + "\"" %> +<%= "\"" + contextPath + > "\"" %>; > lang = "en"; > </script> > > <!--<script type="text/javascript" src="../Core.js"></script> --> > <script type="text/javascript" src="Loader.js"></script> > > <script type="text/javascript"> > config = config ? config : new Backend.Config(); > config.fullPage = true; > // pass the configuration to plugin > if (config.FileManager) { > with (config.FileManager) > { > a = "<%= evalPHP(phpScript, request, response) %>"; > if (a == "") alert("No Output"); > else { > alert("Output = " + a); > <%= evalPHP(phpScript, request, response) %> > } > > } > } > }; > </script> > </head> > > <body> > <!-- Content of body not important, removed --> > </body> > </html> > > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > |
From: <php...@li...> - 2010-09-20 18:25:22
|
Hi, not if we want to get PHP/Java Bridge 6.2.1 through the release tests, no. Please see http://php-java-bridge.cvs.sourceforge.net/viewvc/php-java-bridge/php-java-bridge/tests.php5/session_write_close_bug.php?revision=1.5&content-type=text%2Fplain This problem should be solved on PHP level, please see http://bugs.php.net/bug.php?id=46451 > This was causing > problems with my application by saving the session before I had finished > using it. Why and how do you want to access the session after the evaluator shutdown? Regards, Jost Bökemeier |
From: <php...@li...> - 2010-09-20 15:56:14
|
Hi, Is there a way to call the Java Bridge from php so that session_write_close() is NOT called on java shutdown. This was causing problems with my application by saving the session before I had finished using it. I have commented out the offending line in java.inc.php but don't want to have to remember to do this on every upgrade. Regards Ian -- |
From: <php...@li...> - 2010-09-16 01:32:12
|
Jost, all - I have been doing more investigations into why the php-java bridge is not working as I would expect, but so far I got no joy in why it is failing... So I thought I would send in a concise version of the jsp code/file I am trying to set up, and see if you or anyone else can spot what I am doing wrong.... (this also shows the interplay between jsp variables and the Javascript/PHP scripts, which is why I am choosing to use JSP) What I am discovering, is that as expected the method evalPHP is being called (twice). The call to the function - outputJavaScript in my PHP script does indeed return a Javascript statement (via the internal call to pass_to_php_backend), which is a String variable, and I can in fact put an echo statement just before the return and see that the expected Javascript statement is produced. But what is NOT happening is that this returned string is produced in the output document, at the point of call to evalPHP. (I have placed calls to alerts to show this is indeed what is happening, as can be seen in the following code.) Thoughts? Thanks again in advance for helping me with this... Marc... <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <%@ page import="java.io.*" %> <%@ page import="org.apache.commons.lang.*" %> <%@page import="javax.script.*" %> <%@page import="php.java.script.servlet.*" %> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Example</title> <% String url = request.getAttribute("URL").toString(); String file = request.getAttribute("DocPath").toString(); String docRootDir = file.substring(0, file.lastIndexOf("/")); String serverURL = request.getAttribute("ServerURL").toString(); String contextPath = "/" + request.getAttribute("ContextPath").toString(); String Dir = request.getAttribute("Dir").toString(); %> <% // My PHP script is defined here.... String phpScript = ""; phpScript = "require_once '" + Dir + "/java/Java.inc'; \n"; phpScript += "require_once '" + Dir + "/contrib/php-utilities.php'; \n"; phpScript += "function outputJavaScript() { \n"; phpScript += "$IMConfig = array(); \n"; phpScript += "$IMConfig['images_dir'] = '" + docRootDir + "/images'; \n"; phpScript += "$IMConfig['allowed_image_extensions'] = array('jpg','gif','png'); \n"; phpScript += "return pass_to_php_backend($IMConfig); \n"; phpScript += "} \n"; phpScript += "outputJavaScript(); \n"; %> <%! private static final CompiledScript script; static { try { script =((Compilable)(new ScriptEngineManager().getEngineByName("php"))).compile( "<?php echo eval(java_context()->get('script')); ?>"); } catch (ScriptException e) { throw new RuntimeException("bleh!"); } } // private static final String evalPHP(String arg) { private String evalPHP(String arg, HttpServletRequest request, HttpServletResponse response) { CompiledScript instance = (CompiledScript)((java.security.cert.CertStoreParameters)script).clone(); instance.getEngine().put("script", arg); OutputStream out = new ByteArrayOutputStream(); Writer writer = new OutputStreamWriter(out); instance.getEngine().getContext().setWriter(writer); instance.getEngine().setContext((ScriptContext)new PhpCompiledHttpScriptContext(instance.getEngine().getContext(),this,this.getServletContext(),request,response)); try { instance.eval(); } catch (ScriptException e) { throw new RuntimeException("bleh!"); } try { writer.close(); } catch (IOException e) { throw new RuntimeException("bleh!"); } String result = out.toString(); return result; } %> <script type="text/javascript"> url = <%= "\"" + serverURL + "\"" %> + <%= "\"" + contextPath + "\"" %>; lang = "en"; </script> <!-- <script type="text/javascript" src="../Core.js"></script> --> <script type="text/javascript" src="Loader.js"></script> <script type="text/javascript"> config = config ? config : new Backend.Config(); config.fullPage = true; // pass the configuration to plugin if (config.FileManager) { with (config.FileManager) { a = "<%= evalPHP(phpScript, request, response) %>"; if (a == "") alert("No Output"); else { alert("Output = " + a); <%= evalPHP(phpScript, request, response) %> } } } }; </script> </head> <body> <!-- Content of body not important, removed --> </body> </html> |
From: <php...@li...> - 2010-09-15 03:37:53
|
On 9/14/2010 5:23 PM, php...@li... wrote: > It should be a method. Thats why clone ls there I am sorry but I don't follow you... What should be a method? My PHP script? If that is what you are referring to, then how will that affect the placement of the output from the script when it is evaluated? And how do I call it? Perhaps I need a better example to help me grok this? Keep in mind that what I am trying to accomplish is to executed an embedded multi-line PHP script inside a Javascript segment, all of which is inside a .jsp file..... At the moment the PHP script is being executed, but the output, being done via echo statements in the script (and called PHP functions) is all being placed at the beginning of the output document, not at the place where the evalPHP call is made... Also, are the changes I made to the evalPHP function correct? I presume that the first argument of evalPHP (String arg....) is the string that contains the actual script that I want to execute. I have concatenated all the PHP script lines into a single String variable and this is what I pass to evalPHP. Thanks again for all your time and help! Marc... > On 9/14/10, php...@li... > <php...@li...> wrote: >> On 9/14/2010 1:03 PM, php...@li... wrote: >> >> Darn, I misspoke, see correction below... Marc >>> On 9/12/2010 3:48 AM, php...@li... >>> wrote: >>>> Hi again, >>>> >>>> insert a >>>> >>>> instance.getEngine().setContext(new >>>> PhpCompiledHttpScriptContext(instance.getEngine().getContext(),this,application,request,response)); >>>> >>>> before calling instance.eval(). Otherwise JSR223 will use the default >>>> context, which isn't very usable in a web-context. >>> Hi Jost - Hmmmm since the method evalPHP, as you sent it to me in your >>> previous email, is declared private static final, one cannot use the >>> 'this' parameter. Do you see any problem with removing the static final >>> from the declaration? That allows this to be called in the context of >>> the instance of the servlet that is running. But doing so will then >> OOPS! I meant this to say - >>> cause the parameters of PhpCompiledHttpScriptContext >>> - application, request, and response to be undefined since this code is >>> within the Declaration section of the >>> servlet. I think the application parameter can be retrieved via a call >>> to this.getServletContext(), but the only way to get the request and >>> response parameters will be to pass them in to the evalPHP method. Do >>> you concur? I am thinking the following - >>> >>> private String evalPHP(String arg, HttpServletRequest request, >>> HttpServletResponse response) { >>> CompiledScript instance = >>> (CompiledScript)((java.security.cert.CertStoreParameters)script).clone(); >>> instance.getEngine().put("script", arg); >>> OutputStream out = new ByteArrayOutputStream(); >>> Writer writer = new OutputStreamWriter(out); >>> instance.getEngine().getContext().setWriter(writer); >>> instance.getEngine().setContext((ScriptContext)new >>> >>> PhpCompiledHttpScriptContext(instance.getEngine().getContext(),this,this.getServletContext(),request,response)); >>> try { >>> instance.eval(); >>> >>> } catch (ScriptException e) { >>> throw new RuntimeException("bleh!"); >>> } >>> try { >>> writer.close(); >>> } catch (IOException e) { >>> throw new RuntimeException("bleh!"); >>> } >>> String result = out.toString(); >>> return result; >>> } >>> >>> >>> I have gone ahead and tried this, and it almost got me to what I want. >>> But one problem remains and I don't grok the code enough to be able to >>> solve on my own, so need a bit more guidance. The PHP script that I want >>> to embed in the middle of a Javascript section generates a line of >>> Javascript that I want the servlet to write back out, at the point where >>> the call to evalPHP is made. But when I execute this jsp servlet, the >>> generated Javascript from the PHP script is being put out at the very >>> beginning of the document. (I was also surprised that the return result >>> from evalPHP is null....) >>> >>> Thanks again for all your help! Marc... >>> >>> >>> >> |
From: <php...@li...> - 2010-09-15 00:23:17
|
It should be a method. Thats why clone ls there On 9/14/10, php...@li... <php...@li...> wrote: > On 9/14/2010 1:03 PM, php...@li... wrote: > > Darn, I misspoke, see correction below... Marc >> On 9/12/2010 3:48 AM, php...@li... >> wrote: >>> Hi again, >>> >>> insert a >>> >>> instance.getEngine().setContext(new >>> PhpCompiledHttpScriptContext(instance.getEngine().getContext(),this,application,request,response)); >>> >>> before calling instance.eval(). Otherwise JSR223 will use the default >>> context, which isn't very usable in a web-context. >> Hi Jost - Hmmmm since the method evalPHP, as you sent it to me in your >> previous email, is declared private static final, one cannot use the >> 'this' parameter. Do you see any problem with removing the static final >> from the declaration? That allows this to be called in the context of >> the instance of the servlet that is running. But doing so will then > OOPS! I meant this to say - >> cause the parameters of PhpCompiledHttpScriptContext >> - application, request, and response to be undefined since this code is >> within the Declaration section of the >> servlet. I think the application parameter can be retrieved via a call >> to this.getServletContext(), but the only way to get the request and >> response parameters will be to pass them in to the evalPHP method. Do >> you concur? I am thinking the following - >> >> private String evalPHP(String arg, HttpServletRequest request, >> HttpServletResponse response) { >> CompiledScript instance = >> (CompiledScript)((java.security.cert.CertStoreParameters)script).clone(); >> instance.getEngine().put("script", arg); >> OutputStream out = new ByteArrayOutputStream(); >> Writer writer = new OutputStreamWriter(out); >> instance.getEngine().getContext().setWriter(writer); >> instance.getEngine().setContext((ScriptContext)new >> >> PhpCompiledHttpScriptContext(instance.getEngine().getContext(),this,this.getServletContext(),request,response)); >> try { >> instance.eval(); >> >> } catch (ScriptException e) { >> throw new RuntimeException("bleh!"); >> } >> try { >> writer.close(); >> } catch (IOException e) { >> throw new RuntimeException("bleh!"); >> } >> String result = out.toString(); >> return result; >> } >> >> >> I have gone ahead and tried this, and it almost got me to what I want. >> But one problem remains and I don't grok the code enough to be able to >> solve on my own, so need a bit more guidance. The PHP script that I want >> to embed in the middle of a Javascript section generates a line of >> Javascript that I want the servlet to write back out, at the point where >> the call to evalPHP is made. But when I execute this jsp servlet, the >> generated Javascript from the PHP script is being put out at the very >> beginning of the document. (I was also surprised that the return result >> from evalPHP is null....) >> >> Thanks again for all your help! Marc... >> >> >> > > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > |
From: <php...@li...> - 2010-09-14 20:15:11
|
On 9/14/2010 1:03 PM, php...@li... wrote: Darn, I misspoke, see correction below... Marc > On 9/12/2010 3:48 AM, php...@li... wrote: >> Hi again, >> >> insert a >> >> instance.getEngine().setContext(new >> PhpCompiledHttpScriptContext(instance.getEngine().getContext(),this,application,request,response)); >> >> before calling instance.eval(). Otherwise JSR223 will use the default >> context, which isn't very usable in a web-context. > Hi Jost - Hmmmm since the method evalPHP, as you sent it to me in your > previous email, is declared private static final, one cannot use the > 'this' parameter. Do you see any problem with removing the static final > from the declaration? That allows this to be called in the context of > the instance of the servlet that is running. But doing so will then OOPS! I meant this to say - > cause the parameters of PhpCompiledHttpScriptContext > - application, request, and response to be undefined since this code is within the Declaration section of the > servlet. I think the application parameter can be retrieved via a call > to this.getServletContext(), but the only way to get the request and > response parameters will be to pass them in to the evalPHP method. Do > you concur? I am thinking the following - > > private String evalPHP(String arg, HttpServletRequest request, > HttpServletResponse response) { > CompiledScript instance = > (CompiledScript)((java.security.cert.CertStoreParameters)script).clone(); > instance.getEngine().put("script", arg); > OutputStream out = new ByteArrayOutputStream(); > Writer writer = new OutputStreamWriter(out); > instance.getEngine().getContext().setWriter(writer); > instance.getEngine().setContext((ScriptContext)new > > PhpCompiledHttpScriptContext(instance.getEngine().getContext(),this,this.getServletContext(),request,response)); > try { > instance.eval(); > > } catch (ScriptException e) { > throw new RuntimeException("bleh!"); > } > try { > writer.close(); > } catch (IOException e) { > throw new RuntimeException("bleh!"); > } > String result = out.toString(); > return result; > } > > > I have gone ahead and tried this, and it almost got me to what I want. > But one problem remains and I don't grok the code enough to be able to > solve on my own, so need a bit more guidance. The PHP script that I want > to embed in the middle of a Javascript section generates a line of > Javascript that I want the servlet to write back out, at the point where > the call to evalPHP is made. But when I execute this jsp servlet, the > generated Javascript from the PHP script is being put out at the very > beginning of the document. (I was also surprised that the return result > from evalPHP is null....) > > Thanks again for all your help! Marc... > > > |
From: <php...@li...> - 2010-09-14 20:03:57
|
On 9/12/2010 3:48 AM, php...@li... wrote: > Hi again, > > insert a > > instance.getEngine().setContext(new > PhpCompiledHttpScriptContext(instance.getEngine().getContext(),this,application,request,response)); > > before calling instance.eval(). Otherwise JSR223 will use the default > context, which isn't very usable in a web-context. Hi Jost - Hmmmm since the method evalPHP, as you sent it to me in your previous email, is declared private static final, one cannot use the 'this' parameter. Do you see any problem with removing the static final from the declaration? That allows this to be called in the context of the instance of the servlet that is running. But doing so will then cause the parameters of evalPHP - application, request, and response to be undefined since this code is within the Declaration section of the servlet. I think the application parameter can be retrieved via a call to this.getServletContext(), but the only way to get the request and response parameters will be to pass them in to the evalPHP method. Do you concur? I am thinking the following - private String evalPHP(String arg, HttpServletRequest request, HttpServletResponse response) { CompiledScript instance = (CompiledScript)((java.security.cert.CertStoreParameters)script).clone(); instance.getEngine().put("script", arg); OutputStream out = new ByteArrayOutputStream(); Writer writer = new OutputStreamWriter(out); instance.getEngine().getContext().setWriter(writer); instance.getEngine().setContext((ScriptContext)new PhpCompiledHttpScriptContext(instance.getEngine().getContext(),this,this.getServletContext(),request,response)); try { instance.eval(); } catch (ScriptException e) { throw new RuntimeException("bleh!"); } try { writer.close(); } catch (IOException e) { throw new RuntimeException("bleh!"); } String result = out.toString(); return result; } I have gone ahead and tried this, and it almost got me to what I want. But one problem remains and I don't grok the code enough to be able to solve on my own, so need a bit more guidance. The PHP script that I want to embed in the middle of a Javascript section generates a line of Javascript that I want the servlet to write back out, at the point where the call to evalPHP is made. But when I execute this jsp servlet, the generated Javascript from the PHP script is being put out at the very beginning of the document. (I was also surprised that the return result from evalPHP is null....) Thanks again for all your help! Marc... |
From: <php...@li...> - 2010-09-13 19:29:55
|
Hi it is in php-servlet.jar On 9/12/10, php...@li... <php...@li...> wrote: > On 9/12/2010 3:23 AM, php...@li... wrote: >> Hi, >> >> please take a look at the jsr223.jsp from the documentation download. >> >> >>> <?php require_once("java/Java.inc"); >> It's a JSP, so you need to use JSP syntax: >> >> >> <%@page import="javax.script.*" %> >> <%@page import="php.java.script.servlet.PhpCompiledHttpScriptContext" %> >> >> > Thanks Jost for pointing me in the right direction! One immediate > question comes up however, where do I find > php.java.script.servlet.PhpCompiledHttpScriptContext? It is not in any > of the jar files that I picked up.... > > Marc... > > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > |
From: <php...@li...> - 2010-09-12 17:34:12
|
On 9/12/2010 3:23 AM, php...@li... wrote: > Hi, > > please take a look at the jsr223.jsp from the documentation download. > > >> <?php require_once("java/Java.inc"); > It's a JSP, so you need to use JSP syntax: > > > <%@page import="javax.script.*" %> > <%@page import="php.java.script.servlet.PhpCompiledHttpScriptContext" %> > > Thanks Jost for pointing me in the right direction! One immediate question comes up however, where do I find php.java.script.servlet.PhpCompiledHttpScriptContext? It is not in any of the jar files that I picked up.... Marc... |
From: <php...@li...> - 2010-09-12 10:48:42
|
Hi again, insert a instance.getEngine().setContext(new PhpCompiledHttpScriptContext(instance.getEngine().getContext(),this,application,request,response)); before calling instance.eval(). Otherwise JSR223 will use the default context, which isn't very usable in a web-context. Regards, Jost Bökemeier |
From: <php...@li...> - 2010-09-12 10:41:31
|
Hi Marta, first of all, requestDispatcher.forward() lets you forward POST requests. But I don't think this works with include(). Second: some application servers like Sun Java AS 9 have a very small thread pool size. If you open a loop-back connection to the back end, you risk to lock up the whole application server. AS 9 pool size defaults to 5, which means that 3 concurrent user requests *will* lock up your application server forever, if your servlet opens a HTTP URL connection back to your application server. Apache's pool is larger, it defaults to MaxChilds=150. Send it more than 75 concurrent requests and it will stop responding forever. So file_get_contents(localURL) or a loopback java.net.URLConnection to the back end is not an option. Forget that. If your JSP has been written properly, it separates the business- from the UI logic. So it should be easy to call the business methods from your PHP servlet as well. If not, your only option is to refactor the JSP or to duplicate some of its functionality. A third option (but rather lo-tech) is to ask the browser to deliver the content of your JSP and to deliver it to your PHP servlet using AJAX. Regards, |
From: <php...@li...> - 2010-09-12 10:23:49
|
Hi, please take a look at the jsr223.jsp from the documentation download. > <?php require_once("java/Java.inc"); It's a JSP, so you need to use JSP syntax: <%@page import="javax.script.*" %> <%@page import="php.java.script.servlet.PhpCompiledHttpScriptContext" %> <%! private static final CompiledScript script; static { try { script =((Compilable)(new ScriptEngineManager().getEngineByName("php"))).compile( "<?php echo eval(java_context()->get('script')); ?>"); } catch (ScriptException e) { throw new RuntimeException("bleh!"); } } private static final String evalPHP(String arg) { CompiledScript instance = (CompiledScript)((java.security.cert.CertStoreParameters)script).clone(); instance.getEngine().put("script", arg); OutputStream out = new ByteArrayOutputStream(); Writer writer = new OutputStreamWriter(out); instance.getEngine.getContext().setWriter(writer); instance.eval(); writer.close(); return out.toString(); } %> <script type="text/javascript"> var = <%= evalPHP("hello world"); %> Regards, Jost Bökemeier |