[AWS] html : <img ...> doesn't find the image

Jeremy Piffret j.piffret at gmail.com
Mon Mar 9 20:49:36 CET 2009


Hi,

I can't get an image in a html file using AWS.
I made a small example :

makefile:
=========
build:
    gnatmake -O2 -P test
clean:
    rm test *.ali *.o
====================


test.gpr:
=========
with "aws";
Project test is
   for Main use ("test.adb");
end test;
====================


test.adb:
=========
with Ada.Text_IO;
with Ada.Integer_Text_IO;

with AWS.Response;
with AWS.Server;
with AWS.Status;

procedure Test is

   WS : AWS.Server.HTTP;

   function Main_CB (Request : in AWS.Status.Data)
                  return AWS.Response.Data
   is
      URI : constant String := AWS.Status.URI (Request);

   begin
      return AWS.Response.Build ("text/html", "<img src=aws.png>");
   end Main_CB;                               -- or src=/aws.png

   Port : Integer := 8078;

begin
   Ada.Text_IO.Put ("http://localhost:");
   Ada.Integer_Text_IO.Put (Port, 0);
   Ada.Text_IO.New_Line;

   Ada.Text_IO.Put_Line ("press <Enter> to quit");

   AWS.Server.Start
     (WS, "test <img>", Main_CB'Unrestricted_Access, Port => Port);

   Ada.Text_IO.Skip_Line;
end Test;
====================

A file test.html with just
<img src=aws_logo.png>
works well.

aws_logo.png is an image found on the examples/ directory of AWS.
It's attached to the message (don't know if it works on the mailing list).

I don't understand where is the problem.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: aws_logo.png
Type: image/png
Size: 1994 bytes
Desc: not available
Url : /pipermail/aws/attachments/20090309/e78448b7/attachment.png 


More information about the AWS mailing list