Icon View Incident Report

Serious Serious
Reported By: Alvaro Rodriquez Botti
Reported On: 12/4/2012
For: Version 1.01 Build 2
# 3703 Custom Web Module Content Being Cached by the Web Browser and Cache-Control Headers Don't Work

I'm working on a module EWB to generate reports. I'm developing on Delphi XE, Win7 32 and use Rave Reports component that includes native Delphi XE. (Version 9). Exporting to PDF. Tested with External Web Server with 4 browsers: FireFox, Google Chrome and Safari (all latest versions) and IE9. And also from the IDE with Local Web Server.

The outline is as follows:
EWB application that calls the module passing some parameters.
The module solves the report generating and records it in the folder / pdfs configured on the Web Server.
Up to this point all Ok. PDF File record successfully. For now always recorded with the same name. The idea is that it is recorded in the name of the user who requested the report generation.

The problem I have is as follows:
The first time you generate the PDF, you can read in the application EWB Ok.
When you rebuild PDF with others or not parameters, the reading is always in the first PDF created ... even though the folder / pdfs, a new PDF file generated overwritten by the new invocation of the module.
It seems that saved "cache" the first PDF generated and then always read the same.

I added a Cache-Control header to the response from the module, but it did not work.

The call to the module:
TForm1.Button9Click procedure (Sender: TObject);
var
TempRequest: TServerRequest;
begin
   Plugin1.Visible: = false;
   Plugin1.MimeType: ='';
   TempRequest: = MyRequestQ.GetNewRequest;
   TempRequest.URL: = 'http://jalsoftware.sytes.net/modules/calcula';
   TempRequest.Params.Add ('value1 =' + Edit8.Text);
   TempRequest.Params.Add ('value2 =' + Edit9.Text);
   TempRequest.ResponseContent.LineSeparator: = # 10;
   TempRequest.OnComplete: = RequestComplete;
   MyRequestQ.AddRequest (TempRequest);
end;

Reading the PDF:
TForm1.RequestComplete procedure (Request: TServerRequest);
begin
  if (Request.StatusCode = 200) then
    begin
      Plugin1.MimeType: = 'application / pdf';
      Plugin1.URL: = 'http://jalsoftware.sytes.net/pdfs/prueba.pdf';
      Plugin1.Visible: = true;
    end
  else
    EError.Create raise ('Response Error:' + Request.StatusText);
end;

The OnExecute Module:
TEWBModule1.EWBModuleExecute procedure (Request: TEWBServerRequest);
var
valu: Integer;
cont: String;
MyProject: TRaveProjectManager;
MyReport: TRaveReport;
MyPage: TRavePage;
MyText1: TRaveText;
MyText2: TRaveText;
begin
  RvProject1.open;
  MyProject: = RVProject1.Projman;
  MyReport: = RVProject1.Projman.FindRaveCOmponent ('Report1', nil) as TRaveReport;
  MyPage: = RVProject1.Projman.FindRaveComponent ('Page1' MyReport) as TRavePage;
  MyText1: = RVProject1.Projman.FindRaveComponent ('Text4' MyPage) as TRaveText;
  MyText1.Text: = Request.RequestParams.Values ['value1'];
  MyText2: = RVProject1.Projman.FindRaveComponent ('text5' MyPage) as TRaveText;
  MyText2.Text: = Request.RequestParams.Values ['value2'];

  RvSystem1.DefaultDest: = rdFile;
  RvSystem1.DoNativeOutput: = false;
  RvSystem1.RenderObject: = RvRenderPDF1;
  RvSystem1.OutputFileName: = 'd: \ EWBServer \ www \ images \ prueba.pdf';
  RVProject1.ExecuteReport ('Report1');
  valu: = 1;
  Request.ResponseHeaders.Add('Cache-Control: no-cache'); // Added line
  Request.SendCustomContent (IntToStr (valu),'','');
end;



Comments Comments
The problem was that any custom response headers created by the web modules were not being sent back to the web server properly, and subsequently were never sent to the web browser.


Resolution Resolution
Fixed Problem on 12/15/2012 in version 1.01 build 3


Products Affected Products Affected
Elevate Web Builder
Elevate Web Builder Trial
Elevate Web Builder Modules

Image