NAME

Net::AS2::PSGI::FileHandler - Provides methods to handle files being sent and received

METHODS

= $self->receiving( $content, $receiving_dir )

This method is called when $content is being received.

By default, this method stores the given content into a filename in the RECEIVING directory as given by $self->file($receiving_dir).

Note This method must not be used to send an MDN response. It is called immediately after the request has been received and before the response has been sent back to the partner.

= $self->received( $receiving_file, $received_dir, $message )

This method is called when the content of $receiving_file has been received. $message is an object of class Net::AS2::Message.

By default, this method renames the given $receiving_file to a file in the RECEIVED directory, calculated by $self->file($received_dir, $ext). If the transfer was not successful, a file extension is calculated from the state of the $message object:

         State             Extension
 $message->is_success()     None
 $message->is_error()       .error
 $message->is_failure()     .failed

The received Content-Disposition header filename attribute is available for use as $message->filename().

Note This method must not be used to send an MDN response. It is called immediately after the request has been received and before the response has been sent back to the partner.

= $self->sending( $content, $sending_file )

This method is called when $content is being sent.

By default, this method stores the given content into the $sending_file, which is calculated by $self->file($sending_dir).

= $self->sent( $sending_file, $sent_dir, $successful )

This method is called when the content of $sending_file has been sent. $successful is either a true or false value depending upon whether the content was received by the partner successfully or not.

By default, this method renames the given $sending_file to a file in the SENT directory, calculated by $self->file($sent_dir, $ext). If the transfer was not successful, a file extension, ".failed" is used for $ext.