GCFApplicationServer and Clean-URLs

GCFApplicationServer provides a neat platform for hosting Qt/GCF components and then accessing objects and their methods from an external system like a browser or remote GCF application. Up until GCF 2.5.0 we have been supporting AJAX style access to objects and their methods (available on GCFApplicationServer).

Over the last week, we have implemented Clean-URL access to objects and their methods. For example, when we launch GCFApplicationServer and click on the system-tray icon, we can see the application server window with information about all the objects and methods available on it. One of the sample server components bundled (as an example) with GCF 2.5, is the FractalService component. This component has objects MengerSquareFractal and SierpinskiTriangleFractal. Both of these objects offer a method called generateFractal, which can take as parameters the iteration count and image-size. Once called, the function returns a fractal-image.

Until 2.5.0, to access the generateFractal method in either FractalService.MengerSquareFractal or FractalService.SierpinskiTriangleFractal; we had to either write a web-application with some javascript that made use of GCFMessage.js to call the method and show its output — OR — we had to write a Qt/GCF desktop application to make an asynchronous call either using GCF::RemoteObject or using GCF::RemoteAppAccessPoint. Now, we have yet another approach: Clean-URL access.

We can now, simply launch a browser and type a URL into the address-box in the format

http://{host}:{port}/{component-name}.{object-name}.{method-name}/{param-1}/{param-2}/{param-3}....

Where,

  • {host} – is the server on GCFApplicationServer is running. localhost if you are testing it on your own computer.
  • {port} – is the port-number on which GCFApplicationServer is running. 4232 by default.

The remaining parts are obvious.

So, if we want to call on FractalService.MengerSquareFractal object, the generateFractal() method with iterations as 6 and image size as 400; we can simply construct a Clean-URL as follows and type it into the browser – and see the result in the browser itself!

http://localhost:4232/FractalService.MengerSquareFractal.generateFractal/6/400

The output would be

The resulting output is a GCF-XML message. This message can then be parsed and used on the client side. On the other-hand if you just need to see the result as output in the browser itself; you can just the following url

http://localhost:4232/RESULT/FractalService.MengerSquareFractal.generateFractal/6/400

Checkout/Update your copy of GCF from the SVN and take a look at this for yourself!


Posted

in

by

Tags: