BBjHttpResponse::setFile (Deprecated)

BBjHttpResponse::setFile is deprecated for BBj 21.00 and higher. Instead, files can be uploaded using the ServletOutputStream retrieved by BBxServletResponse::getOutputStream.

Description

In BBj 14.00 and higher, this method sets a file for download.

Syntax

Return Value

Method

void

setFile(string fileName)

Parameters

Parameter

Description

fileName

the full/path/to/the/file

Return Value

None.

Remarks

The example below shows setting a file to be sent within a BBjServlet.

Example

rem 'Obtain the instance of the BBjAPI object

let myAPI! = BBjAPI()
MyServlet! = new MyServlet()

data!.setCallback(data!.ON_WEB_CONNECTION, myServlet!, "myMethod")

process_events
class public MyServlet
    method public void myMethod(BBjServletEvent p_event!)
        request! = p_event!.getHttpRequest()
        response! = p_event!.getHttpResponse()
        response!.setFile("/tmp/foo.txt")
        response!.setHeader( "Content-Disposition", "attachment;filename = foo.txt")
        response!.setContentType("text/plain")
    methodend
classend

See Also

BBjAPI

BBjServletEvent

BBjHttpRequest

BBjHttpResponse