Delphi: How to register the ZLibCompression filter in a datasnap-xe server
Question
PROBLEM:
I'm using a ZLibCompression filter in DataSnap-XE server.
The client always gives the follow error the message:
"Borland.Data.TDBXError:Communication filter ZLibCompression is not registered. Filter class needs to be registered in order to communicate with the server"
QUESTION: 1
How do I register ZLibCompression filter ?
EDIT
QUESTION: 2
How do I get the Datasnap-Connection in the DataExplorer to link to this server?
Solution
Just add the DbxCompressionFilter
unit to the uses clause of the client (as also discussed in my Delphi XE DataSnap courseware manual, and I believe it's also in the old DataSnap white paper that I wrote last year).
The DbxCompressionFilter unit already contains the following code:
initialization
TTransportFilterFactory.RegisterFilter(TTransportCompressionFilter);
finalization
TTransportFilterFactory.UnregisterFilter(TTransportCompressionFilter);
end.
OTHER TIPS
Call the TTransportFilterFactory.RegisterFilter method in order to register a filter.
Documentation (Filtering DataSnap) says:
A filter needs to be registered with the TTransportFilterFactory singleton. The recommended way to register a filter is through the unit initialization and finalization sections, but it can be coded through an initialization phase in the user's application. Below is the code snippet registering the compression filter available out of the box:
initialization
TTransportFilterFactory.RegisterFilter(TTransportCompressionFilter);
finalization
TTransportFilterFactory.UnregisterFilter(TTransportCompressionFilter);
Change TTansportcompressionFilter for the name of the class you're using to filter.