Kbase P98104: How to send CLOB or BLOB objects in a web stream using the WebSpeed
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/20/2008 |
|
Status: Unverified
GOAL:
How to send CLOB or BLOB objects in a web stream using the WebSpeed
GOAL:
What is the easiest way to output binary file using the WebSpeed
GOAL:
How to offer CLOB or BLOB data type objects for the download with WebSpeed application
FACT(s) (Environment):
OpenEdge 10.x
All Supported Operating Systems
FIX:
OpenEdge release 10 introduced CLOB and BLOB data type objects that
can be stored in the database, or created as variables in 4GL.
With WebSpeed application it is very often required that binary objects
are being presented in the user's browser, or otherwise provided for download.
Example of cgi wrapper procedure that does this:
1. In the 'Definitions' section define variable:
DEFINE VARIABLE cDownLoadFileName AS CHARACTER NO-UNDO.
cDownLoadFileName = "MyDocument.pdf" .
2. Modify the 'outputHeader' procedure:
RUN OutputHttpHeader IN web-utilities-hdl ("content-disposition", "attachment~; filename=" + cDownLoadFileName) .
output-content-type ("application/x-download").
3. Put the following code in the procedure 'process-web-request':
RUN outputHeader.
DEFINE VARIABLE mObject AS MEMPTR NO-UNDO.
COPY-LOB FILE cDownLoadFileName TO mObject .
{&OUT-LONG} mObject .
SET-SIZE(mObject) = 0 .