From 2dcefadba853c9ad0ab5e908894213826ec3b43a Mon Sep 17 00:00:00 2001 From: Jens Geyer Date: Thu, 25 Feb 2021 09:42:52 +0100 Subject: THRIFT-5370 Haxe 4 compatibility incl TConfiguration & MAX_MESSAGE_SIZE Client: haxe Patch: Jens Geyer This closes #2349 --- tutorial/haxe/Tutorial.hxproj | 4 ++-- tutorial/haxe/php-web-server.hxml | 2 +- tutorial/haxe/php.hxml | 2 +- tutorial/haxe/src/CalculatorHandler.hx | 2 +- tutorial/haxe/src/Main.hx | 35 ++++++++++++++++++++++------------ 5 files changed, 28 insertions(+), 17 deletions(-) (limited to 'tutorial') diff --git a/tutorial/haxe/Tutorial.hxproj b/tutorial/haxe/Tutorial.hxproj index 796f648a5..44e0efdbb 100644 --- a/tutorial/haxe/Tutorial.hxproj +++ b/tutorial/haxe/Tutorial.hxproj @@ -4,7 +4,7 @@ - + @@ -17,7 +17,7 @@ - + diff --git a/tutorial/haxe/php-web-server.hxml b/tutorial/haxe/php-web-server.hxml index 395a8521e..88007c18f 100644 --- a/tutorial/haxe/php-web-server.hxml +++ b/tutorial/haxe/php-web-server.hxml @@ -27,7 +27,7 @@ #PHP target -php bin/php-web-server/ ---php-front Main-debug.php +-D php-front=Main-debug.php #defines -D phpwebserver diff --git a/tutorial/haxe/php.hxml b/tutorial/haxe/php.hxml index c2f68878e..42bbf7424 100644 --- a/tutorial/haxe/php.hxml +++ b/tutorial/haxe/php.hxml @@ -27,7 +27,7 @@ #PHP target -php bin/php/ ---php-front Main-debug.php +-D php-front=Main-debug.php #Add debug information -debug diff --git a/tutorial/haxe/src/CalculatorHandler.hx b/tutorial/haxe/src/CalculatorHandler.hx index e9752db9f..fcb06d196 100644 --- a/tutorial/haxe/src/CalculatorHandler.hx +++ b/tutorial/haxe/src/CalculatorHandler.hx @@ -31,7 +31,7 @@ import tutorial.*; import shared.*; -class CalculatorHandler implements Calculator { +class CalculatorHandler implements Calculator_service { private var log = new IntMap(); diff --git a/tutorial/haxe/src/Main.hx b/tutorial/haxe/src/Main.hx index 6bebe7164..a56549f8c 100644 --- a/tutorial/haxe/src/Main.hx +++ b/tutorial/haxe/src/Main.hx @@ -32,6 +32,7 @@ import shared.*; enum Prot { binary; json; + compact; } enum Trns { @@ -112,12 +113,12 @@ class Main { #if ! (flash || js) private static function GetHelp() : String { - return Sys.executablePath()+" modus trnsOption transport protocol\n" + return Sys.programPath+" modus layered transport protocol\n" +"Options:\n" - +" modus: client, server (default: client)\n" - +" trnsOption: framed, buffered (default: none)\n" - +" transport: socket, http (default: socket)\n" - +" protocol: binary, json (default: binary)\n" + +" modus: client, server (default: client)\n" + +" layered: framed, buffered (default: none)\n" + +" transport: socket, http (default: socket)\n" + +" protocol: binary, json, compact (default: binary)\n" +"\n" +"All arguments are optional.\n"; } @@ -160,6 +161,9 @@ class Main { } else if ( arg == "json") { prot = json; ++step; + } else if ( arg == "compact") { + prot = compact; + ++step; } else { throw "Unknown protocol "+arg; } @@ -217,6 +221,9 @@ class Main { case json: trace("- JSON protocol"); protocol = new TJSONProtocol( transport); + case compact: + trace("- compact protocol"); + protocol = new TCompactProtocol( transport); default: throw "Unhandled protocol"; } @@ -232,7 +239,7 @@ class Main { var client = ClientSetup(); try { - client.ping(); + client.ping(); trace("ping() successful"); } catch(error : TException) { trace('ping() failed: $error'); @@ -310,11 +317,12 @@ class Main { #else trace("- http transport"); transport = new TWrappingServerTransport( - new TStreamTransport( - new TFileStream("php://input", Read), - new TFileStream("php://output", Append) - ) - ); + new TStreamTransport( + new TFileStream("php://input", Read), + new TFileStream("php://output", Append), + null + ) + ); #end default: @@ -341,11 +349,14 @@ class Main { case json: trace("- JSON protocol"); protfactory = new TJSONProtocolFactory(); + case compact: + trace("- compact protocol"); + protfactory = new TCompactProtocolFactory(); default: throw "Unhandled protocol"; } - var handler = new CalculatorHandler(); + var handler : Calculator_service = new CalculatorHandler(); var processor = new CalculatorProcessor(handler); var server = new TSimpleServer( processor, transport, transfactory, protfactory); #if phpwebserver -- cgit v1.2.1