Using context filters
You can use the SendCommandContextFilter interface to define a context filter for the context object that is associated with a SendCommand object. Filters are useful if the application that you're using to send content has restrictions on the size or type of content that it receives. For example, if an application can accept text of a certain length only, you can define a filter that shortens strings in the context object if they exceed a specific character limit so that the application can accept and send the content.
You can create a class that acts as a filter by implementing the SendCommandContextFilter interface and implementing filterContext(). This method changes the context object of a specified SendCommand object according to filtering criteria that you specify, and returns the altered context object. The run() method of the SendCommand object uses the altered context object to send the content from your application. You can register a context filter for a SendCommand object by invoking setSendCommandContextFilter().