com.HttpRequest.doFileRequest
Performs the request by sending data contained in a file.
Syntax
doFileRequest(
filename STRING )
- filename defines the file containing the data to be sent.
Usage
Performs the request by sending data contained in the file passed as parameter. The data is sent as is without any further conversion.
If not defined by the programmer, the HTTP headers are automatically set as follows:
Content-Type
is defined based on the filename extension. If the file extension is not recognized,Content-Type
defaults toapplication/octet-stream
.Note:File extensions to
Content-Type
mapping can be customized in the file $FGLDIR/lib/wse/mime.cfg.Content-Disposition
is set with the base name of the given filename as follows:attachment; filename="basename"
.
CALL request.doFileRequest( "/opt/myapp/resources/logo.jpg" )
Content-Type: image/jpeg
Content-Disposition: attachment; filename="logo.jpg"
In HTTP 1.1, if the body size is greater than 32k, the request will be sent in several chunks of the same size.
This HTTP request method is non-blocking. It returns immediately after the call. Use the com.HttpRequest.getResponse method, to perform a synchronous HTTP request, suspending the program flow until the response returns from the server. If the program must keep going, use the com.HttpRequest.getAsyncResponse method, to check if a response is available.
In case of error, the method throws an exception and sets the
status
variable. Depending on the error, a human-readable description of the
problem is available in the sqlca.sqlerrm
register. See Error handling in GWS calls (status).
The int_flag variable is checked during GWS API call to handle program interruptions, for more details, see Interruption handling in GWS calls (int_flag)