Sun Java System Web Server 7.0 NSAPI Developer's Guide

sendfile

The sendfile filter method is called when the contents of a file are to be sent. Filters that modify or consume outgoing data can choose to implement the sendfile filter method.

If a filter implements the write filter method but not the sendfile filter method, the server will automatically translate net_sendfile calls to net_write calls. As a result, filters interested in the outgoing data stream do not need to implement the sendfile filter method. However, for performance reasons, it is beneficial for filters that implement the write filter method to also implement the sendfile filter method.

Syntax

int sendfile(FilterLayer *layer, const sendfiledata *data);

Returns

The number of bytes consumed, which may be less than the requested amount if an error occurred.

Parameters

FilterLayer *layer is the filter layer in which the filter is installed.

const sendfiledata *sfd identifies the data to send.

Example

int myfilter_sendfile(FilterLayer *layer, const sendfiledata *sfd)
{
    return net_sendfile(layer->lower, sfd);
}

See Also

net_sendfile, filter_create