[AWS] Reading the body of a POST as a String

Pascal Obry pascal at obry.net
Fri Jun 3 09:06:00 CEST 2011


Phil,

> Thanks Pascal - I have tried this function before but gnat did not seem
> to recognise that overload (the one which accepts a parameter of
> AWS.Status.Data and returns a String or an Unbounded_String) - I may
> have an error elsewhere though so it's probably something simple.

I see, that's because it is overloaded and can be ambiguous in some 
cases, but for this you can use a qualified expression:

    MB : constant String := String'(AWS.Response.Message_Body (R));

Or if you have two procedure:


    procedure P (M : String);
    procedure P (M : Unbounded_String);

P (String'(AWS.Response.Message_Body (R)));

Note that if the message body is expected to be large it is better to 
use the Unbounded_String version to avoid a stack overflow.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B



More information about the AWS mailing list