skip to main content

Appendices : HTTPHandler class (com.iscobol.rts.HTTPHandler) : Constructor and methods : accept

accept
Receives parameters from the HTTP.
General format
void accept( params )
Syntax rules
1.
params is a level 01 data item for which the IS IDENTIFIED clause has been used.
General rules
1.
params elements name matches with the name of the parameter passed by the HTTP client.
2.
o
the file is stored in the folder identified by the iscobol.http.upload.directory * configuration property, whose default is the server temp directory
o
i.
ii.
iii.
iv.
v.
Example
Consider the following HTML form:
<form action="servlet/isCobol(PROG1)" enctype="multipart/form-data" method="post">
<input type="text" name="textline" size="30"><br>
<input type="file" name="datafile" size="40"><br>
<input type="submit" value="Send">
The user types data into the text area and browse for a file on disk.
When the ‘Send’ button is clicked, the COBOL program ‘PROG1’ is called. In order to intercept fields content, PROG1 should be written as follows:
       CONFIGURATION SECTION.
       REPOSITORY.
           CLASS WEB-AREA AS "com.iscobol.rts.HTTPHandler"
       WORKING-STORAGE SECTION.
       01 http-data identified by "http_data".
          03  identified by "textline".
              05 w-textline pic x any length.
          03  identified by "datafile".
              05 w-datafile pic x any length.
       LINKAGE SECTION.
       01 LNK-AREA OBJECT REFERENCE WEB-AREA.
       PROCEDURE DIVISION USING LNK-AREA.
           LNK-AREA:>accept(http-data).
After the accept() invokation, w-textline is set to the text typed by the user in the text area of the HTML form, while w-datafile is set to the name of the uploaded file in the format of <server_folder>/<random_id>_<filename>.

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left