You are not logged in.
Pages: 1
Hi,
I have a function in a TMVCApplication which produce a PDF with fastReport, and then keep it for a while as temp file. I'd like to avoid temp file and send the pdf directly as stream over HTTP.
To do so, does there is a way to access http header/content from TMVCApp method or function? Or should I necesseraly use an interface/method-service?
Thanks!
Offline
You have access to the ServiceContext threadvar, AFAIK.
See http://synopse.info/files/html/Synopse% … l#TITL_107
Online
Thanks, indeed I havn't seen I could access it from here.
So i've been trying to implement it, with Request.ReturnBlob or Request.Call.OutHead ... But couldn't figure out how to do, so if someone could point me in the right direction it would be greatly appreciated.
Should i send my stream from a procedure? A function? MVC command?
I have my interface and TMVCApp declared as such:
ICustWebApp = interface(IMVCApplication)
[...]
function GetReportDoc(const ID: RawUTF8): TMVCAction;
procedure Reports(const link: RawUTF8; var Scope: Variant);
end;
TCustWebApp = class(TMVCApplication, ICustWebApp)
[...]
function GetReportDoc(const ID: RawUTF8): TMVCAction;
procedure Reports(const link: RawUTF8; var Scope: Variant);
end;
When I click in a link in the Reports.html page, it call GetReportDoc which generate then, theorically, send the report.
I've been trying to replace the return value of my GetReportDoc by TServiceCustomAnswer, but by doing so I need a GetReportDoc.html (dont want to) file and i can see my header and content, but as json when I go to root/GetReportDoc/json?ID=1, not in the HTTP header
Offline
Pages: 1