accept
Receives parameters from the HTTP.
General format
void accept( params )
Syntax rules
1. params is a data item for which the IS IDENTIFIED clause has been used.
General rules
1. params elements name matches the name of the parameter passed by the HTTP client.
2. If the parameter passed by the HTTP client is a file, then
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 The name of the file is returned to the COBOL program, not the file content. The name is formed by five parts:
i. the folder where the file has been stored
ii. the prefix specified by the configuration property iscobol.http.upload.prefix *, if set
iii. a unique prefix automatically generated by the framework in order to avoid duplicate names
iv. the underscore character
v. the name of the file passed by the client
Example
Consider the following HTML form:
<form action="servlet/isCobol(PROG1)" enctype="multipart/form-data" method="post">
Type some text:<br>
<input type="text" name="textline" size="30"><br>
Choose a file to upload:<br>
<input type="file" name="datafile" size="40"><br>
Send to server<br>
<input type="submit" value="Send">
</form>
The user types data into the text area and browses for a file on disk.
When the ‘Send’ button is clicked, the COBOL program ‘PROG1’ is called. In order to intercept the field's 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.
       MAIN.
           LNK-AREA:>accept(http-data).
After the accept() invocation, 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>.