Skip to content

Commit

Permalink
Merge pull request #52 from belgattitude/develop
Browse files Browse the repository at this point in the history
Prep v7.0.0
  • Loading branch information
belgattitude committed Mar 6, 2017
2 parents e7ce821 + 79dc48e commit bd91060
Show file tree
Hide file tree
Showing 31 changed files with 2,694 additions and 202 deletions.
23 changes: 21 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,30 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/).

## 6.2.13 (TBD)
## 7.0.1 (TBD)

## 7.0.0 (2017-03-06)

This release includes merges from the upstream original php-java-bridge 7.0.1,
Due to license restrictions, the PHPDebugger.java additions have **not** been merged
in the 7.0.0 version. See [#49](https://github.com/belgattitude/php-java-bridge/issues/49)


### Added

- Added configuration `enableDirectoryIndex()` in `JavaBridgeRunner` and changed its
value to `true`, set it to `false` to prevent directory listing. See [#43](https://github.com/belgattitude/php-java-bridge/issues/43).
- Documentation: added embedding recipes (wip, see [#51](https://github.com/belgattitude/php-java-bridge/issues/51) for progress)

### Bugfix

- **Upstream-7.0.1:** Bugfix in `WriterOutputStream.java`.

### Updated

- gradlew updated to v3.4.0
- **Upstream-7.0.1:** Legacy Java.inc updated with upstream support for PHP7
and rebuilt of javainc.java, proxy... *(Note that Java.inc is kept for upstream
compat, but have been deprecated in the fork in favour of soluble-japha instead)*


## 6.2.12 (2017-02-21)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.2.11
7.0.1
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apply plugin: 'maven-publish'
group = "io.soluble.pjb"
archivesBaseName = 'php-java-bridge'
//version = "6.2.11"
version = "6.2.13-SNAPSHOT"
version = "7.0.1-SNAPSHOT"
description = "PHPJavaBridge server (soluble fork)"

ext {
Expand Down
16 changes: 16 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<delete file="${serverDir}/META-INF/java/JavaProxy.php"/>
<delete file="${pkgDir}/bridge/JavaInc.java"/>
<delete file="${pkgDir}/bridge/JavaProxy.java"/>
<delete file="${pkgDir}/bridge/PhpDebuggerPHP.java" />
<delete file="${pkgDir}/bridge/LauncherUnix.java"/>
<delete file="${pkgDir}/bridge/LauncherWindows.java"/>
<delete file="${pkgDir}/bridge/LauncherWindows2.java"/>
Expand Down Expand Up @@ -88,6 +89,21 @@
</fileset>
</apply>
</target>
<!--
WARNING if you build the genPHPDebuggerPHPJava... License is GPL (GPL+classpath exception)
if you distribute... The PHPDebugger is needed only for tests and should not
be included in the build.
-->
<target name="genPhpDebuggerPHPJava" depends="genInit">
<apply executable="${phpExec}" failonerror = "true" dir="${serverDir}" parallel="true">
<arg value="buildClassFromTextFile.php" />
<arg value="${pkgDir}/bridge/PhpDebuggerPHP.java" />
<arg value="PhpDebuggerPHP" />
<fileset dir="${resDir}" >
<include name="META-INF/java/PHPDebugger.php" />
</fileset>
</apply>
</target>
<target name="genLauncherUnix" depends="genInit">
<apply executable="${phpExec}" failonerror="true" dir="${serverDir}" parallel="true">
<arg value="buildClassFromTextFile.php"/>
Expand Down
19 changes: 19 additions & 0 deletions doc/legacy/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
2017-02-25 <jostb@intern>

* PhpDebugger.inc: Removed

* Client.inc: Warning fixed.

* PHPDebugger.php: Rewritten to use latest protocol

* Util.java, FCGIConnectionFactory.java, IFCGIProcessFactory.java, NPChannelFactory.java, SocketChannelFactory.java, CGIRunner.java, FCGIProcess.java, FastCGIProxy.java, ContextLoaderListener.java, FCGIProcess.java, FastCGIServlet.java: Use PHPDebuger.php

2017-02-01 <jostb@intern>

* WriterOutputStream.java: Fixed crash.


2017-01-30 <jostb@intern>

* Protocol.inc, PHPDebugger.php, PHPDebugger.inc, Parser.inc, Options.inc, NativeParser.inc, JavaProxy.inc, JavaBridge.inc, GlobalRef.inc, Client.inc: Changed constructor

2010-06-01 <jostb@intern>

* php/java/script/servlet/EngineFactory.java
Expand Down
17 changes: 17 additions & 0 deletions doc/legacy/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@ php-java-bridge NEWS -- history of user-visible changes.
Please send bug reports, questions and suggestions to
<php-java-bridge-users@lists.sourceforge.net>.

Version 7.0.0

* Fixed a bug in Java.inc and Client.inc

* PHPDebugger.php now uses the latest protocol and is now part of the PHP/Java Bridge. It can be switched off by addint the following line to WEB-INF/web.xml:
<context-param><param-name>php_include_debugger</param-name><param-value>Off</param-value></context-param>


Version 6.2.3

* Fixed a bug in WriterOutputStream.


Version 6.2.2

* Changed old constructor to __construct

Version 6.2.1

* java_session(null, false) now returns false if a session does not exist.
Expand Down
1 change: 1 addition & 0 deletions doc/notes_fork_status.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Latest version 6.2.1 has been released long ago but, AFAIK, proved stable and ma
- [x] Travis CI support with soluble-japha client suite [tests](https://github.com/belgattitude/php-java-bridge/blob/master/.travis/run_soluble_japha_phpunit_tests.sh)
- [x] Clean-up of obsolete code and unused resources.
- [x] Releases starting at 6.2.10
- [x] Merged upstream changes for 7.0.1 (without GPL debugger). See [#49](https://github.com/belgattitude/php-java-bridge/issues/49)
- [ ] Deprecate and remove completely the `Java.inc` client.
- [ ] Security review and safe practices.
- [ ] Documentation (always a wip)
Expand Down
69 changes: 69 additions & 0 deletions doc/recipes_embedding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Embed recipes

> This document is currently a work-in-progess stub. To learn more
> see the [#51](https://github.com/belgattitude/php-java-bridge/issues/51)
> and feel free to contribute.
## Introduction

The php-java-bridge provides a standalone server (`JavaBridgeRunner`) for
embedding the bridge. In the soluble fork, this internal server have been
deprecated in favour of embedded Tomcat, Jetty... adopted more widely.


## Embedded containers


### Tomcat


1. Add the embedded tomcat in your dependencies:

With maven:

```xml
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>7.0.75</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
<version>7.0.75</version>
</dependency>
```

With gradle

```gradle
// todo
```

2. Register servlet and start tomcat.

```java
public void startTomcat() {
Tomcat tomcat = new Tomcat();
tomcat.setPort(8087);
Context ctx = tomcat.addContext("/", new File(".").getAbsolutePath());
Tomcat.addServlet(ctx, "jbs", new JavaBridgeServlet());
ctx.addServletMapping("/*", "jbs");
try {
tomcat.start();
log("started, now waiting for connections...");
tomcat.getServer().await();
} catch (Exception e) {
warning(e.getMessage());
}
}
```

### Jetty

> The doPut() method Seems buggy right now. See [#43](https://github.com/belgattitude/php-java-bridge/issues/43)
### Undertow

(todo)

2 changes: 1 addition & 1 deletion legacy/server/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Manifest-Version: 1.0
Main-Class: php.java.bridge.Standalone
Main-Class: io.soluble.pjb.bridge.Standalone
Created-By: 1.5.0 (Sun Microsystems Inc.)
Class-Path: php-script.jar script-api.jar log4j.jar
20 changes: 10 additions & 10 deletions legacy/server/META-INF/java/Client.inc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ require_once(java_get_base()."/GlobalRef.inc");
*/
class java_SimpleFactory {
public $client;
function java_SimpleFactory($client) {
function __construct($client) {
$this->client = $client;
}
function getProxy($result, $signature, $exception, $wrap) {
Expand Down Expand Up @@ -138,7 +138,7 @@ class java_CacheEntry {
public $fmt, $signature, $factory, $java;
public $resultVoid;

function java_CacheEntry($fmt, $signature, $factory, $resultVoid) {
function __construct($fmt, $signature, $factory, $resultVoid) {
$this->fmt = $fmt;
$this->signature = $signature;
$this->factory = $factory;
Expand All @@ -155,7 +155,7 @@ class java_Arg {
public $factory, $val;
public $signature; // class type

function java_Arg($client) {
function __construct($client) {
$this->client = $client;
$this->factory = $client->simpleFactory;
}
Expand Down Expand Up @@ -211,8 +211,8 @@ class java_CompositeArg extends java_Arg {
public $type; // for A and X
public $counter;

function java_CompositeArg($client, $type) {
parent::java_Arg($client);
function __construct($client, $type) {
parent::__construct($client);
$this->type = $type;
$this->val = array();
$this->counter = 0;
Expand All @@ -237,8 +237,8 @@ class java_CompositeArg extends java_Arg {
class java_ApplyArg extends java_CompositeArg {
public $m, $p, $v, $n; // see PROTOCOL.TXT

function java_ApplyArg($client, $type, $m, $p, $v, $n) {
parent::java_CompositeArg($client, $type);
function __construct($client, $type, $m, $p, $v, $n) {
parent::__construct($client, $type);
$this->m = $m;
$this->p = $p;
$this->v = $v;
Expand All @@ -261,7 +261,7 @@ class java_Client /* implements IDocHandler */ {
$arrayProxyFactory, $exceptionProxyFactory, $throwExceptionProxyFactory;

public $arg;
public $asyncCtx, $cancelProxyCreationCounter;
public $asyncCtx, $cancelProxyCreationTag;
public $globalRef;

public $stack;
Expand All @@ -279,7 +279,7 @@ class java_Client /* implements IDocHandler */ {
// do not finish protocol if ags construction fails due to PHP OutOfMemory error
public $inArgs;

function java_Client() {
function __construct() {
$this->RUNTIME = array();
$this->RUNTIME["NOTICE"]='***USE echo java_inspect(jVal) OR print_r(java_values(jVal)) TO SEE THE CONTENTS OF THIS JAVA OBJECT!***';

Expand All @@ -299,7 +299,7 @@ class java_Client /* implements IDocHandler */ {

$this->globalRef = new java_GlobalRef();

$this->asyncCtx = $this->cancelProxyCreationCounter = 0;
$this->asyncCtx = $this->cancelProxyCreationTag = 0;

$this->methodCache = $this->defaultCache;

Expand Down
2 changes: 1 addition & 1 deletion legacy/server/META-INF/java/GlobalRef.inc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
class java_GlobalRef {
public $map;

function java_GlobalRef() {
function __construct() {
$this->map = array();
}

Expand Down
6 changes: 3 additions & 3 deletions legacy/server/META-INF/java/JavaBridge.inc
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ if(!function_exists("java_get_base")) {
function java_virtual($path, $return=false) {

$req = java_context()->getHttpServletRequest();
$req = new java("io.soluble.pjb.servlet.VoidInputHttpServletRequest", $req);
$req = new java("php.java.servlet.VoidInputHttpServletRequest", $req);

$res = java_context()->getHttpServletResponse();
$res = new java("io.soluble.pjb.servlet.RemoteHttpServletResponse", $res);
$res = new java("php.java.servlet.RemoteHttpServletResponse", $res);

$req->getRequestDispatcher($path)->include($req, $res);
if ($return) return $res->getBufferContents();
Expand Down Expand Up @@ -390,7 +390,7 @@ if(!function_exists("java_get_base")) {
* ByteArrayOutputStream out;
* OutputStreamWriter writer;
* e.getContext().setWriter(writer=new OutputStreamWriter(out=new ByteArrayOutputStream()));
* Object res=e.eval(new io.soluble.pjb.script.URLReader(new URL("http://localhost/calculateSales.php")));
* Object res=e.eval(new php.java.script.URLReader(new URL("http://localhost/calculateSales.php")));
* System.err.println(((Invocable)e).invokeFunction("calculateSales", new Object[]{month}));
* ((Closeable)e).close();
* System.err.println("PHP exit() code:" + String.valueOf(res));
Expand Down

0 comments on commit bd91060

Please sign in to comment.