I just wanted to share information about using GZIP compression with HTTPInvoker. This may be common knowledge but I did not find it from reference, API or from this forum.
GZIP compression support is present in CommonsHttpInvokerRequestExecutor. This Executor just needs be used by client side HttpInvokerProxyFactoryBean:
Then we need to include Apache HttpClient into classpatch. Note that new HttpClient 4.x is not yet supported so we need to use older 3.1 version. commos-codec is also required (I use version 1.4 but I dont know what version is correct for HttpClient 3.1).Code:<bean id="clientService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"> <property name="serviceUrl" value="http://domain.com:port/clientService/ClientService"/> <property name="serviceInterface" value="my.program.clientService.ClientService"/> <property name="httpInvokerRequestExecutor"> <bean class="org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor"/> </property> </bean>
GZIP conpression needs to enabled on server for Java Serialized Object data. I use Tomcat server so the required configration in server.xml is following (compression config in bold):
Code:<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" compression = "on" compressableMimeType="application/x-java-serialized-object" compressionMinSize="2048"/>


Reply With Quote
