From: <php...@li...> - 2011-12-07 11:24:55
|
Hello, We have a need to send requests from PHP to two different servlets running on separate JBoss servers on separate machines. Is this supported with php/JAVA bridge? If yes, how it should be configured? Kind Regards, Zvonimir |
From: <php...@li...> - 2011-12-08 20:32:17
|
Hi, > We have a need to send requests from PHP to two different servlets running > on separate JBoss servers on separate machines. > Is this supported with php/JAVA bridge? Yes. PHP can open multiple socket connections to different servers. > If yes, how it should be configured? Not sure what you mean. You cannot "configure" the bridge; you give it a HTTP connection to the back-end and it will use that connection. Regards, Jost Bökemeier |
From: <php...@li...> - 2011-12-09 08:05:07
|
Hi, Within Java.inc, constants JAVA_HOSTS and JAVA_SERVLET are used and then based on them servlet is retrieved e.g. <?php define("JAVA_HOSTS", "localhost:8080"); define("JAVA_SERVLET", "/MyWebApp/MyServlet"); require_once("java/Java.inc"); $servlet = java_context()->getServlet(); In our case we would need two different servlets based on two different JAVA_HOSTS and JAVA_SERVLET. As I see client variable within Java.inc is defined as static. Should we customize only Java.inc to fit our needs, or this can be solved differently? Kind regards, Zvonimir 2011/12/8 <php...@li...> > Hi, > > > We have a need to send requests from PHP to two different servlets > running > > on separate JBoss servers on separate machines. > > Is this supported with php/JAVA bridge? > > Yes. PHP can open multiple socket connections to different servers. > > > > If yes, how it should be configured? > > Not sure what you mean. You cannot "configure" the bridge; you give it a > HTTP connection to the back-end and it will use that connection. > > > Regards, > Jost Bökemeier > > ------------------------------------------------------------------------------ > Cloud Services Checklist: Pricing and Packaging Optimization > This white paper is intended to serve as a reference, checklist and point > of > discussion for anyone considering optimizing the pricing and packaging > model > of a cloud services business. Read Now! > http://www.accelacomm.com/jaw/sfnl/114/51491232/ > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > |
From: <php...@li...> - 2011-12-10 18:29:06
|
Hi, > Within Java.inc, constants JAVA_HOSTS and JAVA_SERVLET are used and then > based on them servlet is retrieved PHP's define() ignores namespaces and creates bindings in a global scope. Please modify Java.inc so that it looks for those bindings in the current namespace: namespace t1; const JAVA_SERVLET=... const JAVA_HOSTS=... include "Java.inc"; should do what you want. Regards, Jost Bökemeier |
From: <php...@li...> - 2011-12-12 09:33:52
|
Hi, Sorry, maybe I do not understand exactly the idea you are suggesting. Yes, introduction of namespace for these constants would solve initial issue of having "variable" JAVA_SERVLET and JAVA_HOSTS within Java.inc. But, when java_context is called: function java_context() { $client=__javaproxy_Client_getClient(); return $client->getContext(); } it calls __javaproxy_Client_getClient function that returns current client: function __javaproxy_Client_getClient() { static $client=null; if(!is_null($client)) return $client; if (function_exists("java_create_client")) $client=java_create_client(); else { global $java_initialized; $client=new java_Client(); $java_initialized=true; } return $client; } client that is returned is static variable that it is created only once and reused in subsequent calls. So I think that further customizations of Java.inc are needed to remove static instances of objects. Or your suggestion for use of namespace is somehow broader and covers also this issue? Kind Regards, Zvonimir 2011/12/10 <php...@li...> > Hi, > > > Within Java.inc, constants JAVA_HOSTS and JAVA_SERVLET are used and then > > based on them servlet is retrieved > > PHP's define() ignores namespaces and creates bindings in a global scope. > > Please modify Java.inc so that it looks for those bindings in the > current namespace: > > namespace t1; > const JAVA_SERVLET=... > const JAVA_HOSTS=... > include "Java.inc"; > > should do what you want. > > > Regards, > Jost Bökemeier > > > ------------------------------------------------------------------------------ > Learn Windows Azure Live! Tuesday, Dec 13, 2011 > Microsoft is holding a special Learn Windows Azure training event for > developers. It will provide a great way to learn Windows Azure and what it > provides. You can attend the event by watching it streamed LIVE online. > Learn more at http://p.sf.net/sfu/ms-windowsazure > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > |
From: <php...@li...> - 2011-12-12 20:31:16
|
Hi Zvonimir, The only problem are the three globals, JAVA_SERVLET, JAVA_HOSTS and a global to prevent the shutdown function from running too early. If you change these to use getter/setters, your problem is solved. > client that is returned is static variable It's not static.The bindings are created in the current top-level environment, not in the global environment. Regards, Jost Bökemeier |
From: <php...@li...> - 2011-12-15 09:33:07
|
Hi Jost, I've tried to set it up, but without success so far. Sorry for maybe repeating the question, but I still find below issues unclear. > If you change these to use getter/setters, your problem is solved. Where should these getter/setters be defined? Within Java.inc - if yes then I have again the same problem of having different "environments" for different instances of bridge. > It's not static.The bindings are created in the current top-level > environment, not in the global environment. Since there is no specific namespace defined in Java.inc, how can we change/influence current "top-level environment" of Java.inc so that we can have two separate instances of client? I always stuck on this part because only of first call client is created and on subsequent calls existing one is returned. function *__javaproxy_Client_getClient*() { * static $client=null;* * if(!is_null($client)) return $client;* if (function_exists("java_create_client")) $client=java_create_client(); else { global $java_initialized; $client=new java_Client(); $java_initialized=true; } return $client; } btw. from what I understood, as far as you know, this hasn't been tried/tested so far? Kind Regards, Zvonimir 2011/12/12 <php...@li...> > Hi Zvonimir, > > The only problem are the three globals, JAVA_SERVLET, JAVA_HOSTS and a > global to prevent the shutdown function from running too early. > > If you change these to use getter/setters, your problem is solved. > > > > client that is returned is static variable > > It's not static.The bindings are created in the current top-level > environment, not in the global environment. > > > Regards, > Jost Bökemeier > > > ------------------------------------------------------------------------------ > Learn Windows Azure Live! Tuesday, Dec 13, 2011 > Microsoft is holding a special Learn Windows Azure training event for > developers. It will provide a great way to learn Windows Azure and what it > provides. You can attend the event by watching it streamed LIVE online. > Learn more at http://p.sf.net/sfu/ms-windowsazure > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > |
From: <php...@li...> - 2011-12-15 17:15:22
|
Just a quick reply: $lambda = function() { function q() {...} } binds q local to $lambda. If you wrap the include("java.inc"), all bindings should be local to that function. |