GWT RPC data format

EDIT: Brian Slesinsky just documented the protocol (by reverse-engineering the code): https://docs.google.com/document/d/1eG0YocsYYbNAtivkLtcaiEE5IOF5u4LUol8-LL0TIKU/edit First, GWT-RPC protocol is asymmetric so that it’s always optimized for the client-side: fast to deserialize something coming from the server, and fast to serialize something to send to it. It’s obviously not binary, as you suspected, but text-based. client-to-server protocol is pipe-delimited … Read more

Reasons to include function in protocol definition vs. only defining it in the extension?

Declaring the function as part of the protocol definition instructs the compiler to use dynamic dispatch when calling the function, as the compiler would expect types implementing the protocol to give an implementation for that function. This is called a method requirement. Now, if the type doesn’t define the method, then the runtime resolves the … Read more

What is the easiest way to use the HEAD command of HTTP in PHP?

You can do this neatly with cURL: <?php // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, “http://www.example.com/”); // This changes the request method to HEAD curl_setopt($ch, CURLOPT_NOBODY, true); // grab URL and pass it to the browser curl_exec($ch); // Edit: Fetch the HTTP-code (cred: @GZipp) … Read more

Returning constrained generics from functions and methods

I think the key to understanding what is going on here is distinguishing between things that are determined dynamically at runtime, and things that are determined statically at compile time. It doesn’t help that, in most languages like Java, protocols (or interfaces) are all about getting polymorphic behavior at run time, whereas in Swift, protocols … Read more

How to I send data from JavaScript to PHP and vice versa? [duplicate]

If you wish to submit this data via a form, you don’t need to create the form with Javascript. Simply create an invisible form with HTML, populate the hidden field with Javascript, and automatically submit whenever you’re ready. <form method=”post” action=”process.php”> <input type=”hidden” name=”data” id=”data” /> </form> document.getElementById(“data”).value = “foo”; If you want to send … Read more