Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How does websnap / page producer handle images? More options

23 views
Skip to first unread message

Alex p

unread,
Feb 25, 2007, 11:07:46 PM2/25/07
to

The question is do I have to handle image requests from my
Webdispatcher if I am using the page producer?

I am using websnap with the web dispatcher, instead of page dispatcher


I have the images set up in the webappdebugger path; so thats not it


here some sample code.. of what I am trying to do:


I want to dynamically locate the file being requsted and load into a
page producer and send the content stream out. What happens when I use
the webapp debuger and I dont specify a file just root request (/)
the page gets displayed with images, looks fine, and I only get one
request for the page.


When I request /index.html I get request for index.html and every
single image in the html file.


Do I also need to implement support for handling the images aswell as
the pages?


Doesnt the page producer handle the image requests?


Any help / info on this is appreciated


Thanks


procedure TWebAppDataModule2.FindView(PathInfo:string);
begin
ModulePath:=ExtractFilePath(ModuleFilename);
PagePath:='Pages'+StringReplace(Pathinfo,'/','\',[rfreplaceAll]);
if Copy(PagePath,1,1)='\' then Pagepath:=ContentPath
+'\'+Copy(Pagepath,2,Length(PagePath));


if PathInfo='/' then
begin
pp.htmlfile:=Modulepath+'pages\index.html';
Webcontext.Response.Content:=pp.content
end
else
begin
if Pos('.html',Pagepath)>0 then
if FileExists(ModulePath+Pagepath) then
pp.HTMLFile:=Modulepath+Pagepath;
WebContext.Response.Content:=pp.content;


end;
end;


procedure TWebAppDataModule2.WebDispatcherBeforeDispatch(Sender:
TObject; Request: TWebRequest; Response: TWebResponse; var Handled:
Boolean);
begin
Handled:=true;
FindView(Request.InternalPathinfo);;
end;

0 new messages