Search code examples
javaspringrestjava-8jboss

Why @GZIP is not returning response in jboss7.1.0 eap


I am trying to get a response from Postman where I have deployed the war file in JBoss7.1.0 eap server. But I am not getting any response in Postman. There are no errors in the logs. I have used @GZIP in the response, I heard JBoss doesnot support GZIP , and maybe that is why it is not giving the response. The same war file was giving response in old JBoss5.1 Server without issue What are my options to fix the issue. If I comment the //@GZIP, the time it is taking is huge leading to crash of Postman itself. How to fix this problem in JBoss7.1.0

    @POST

    @Path("/copyCatalog")
    @GZIP
    @Consumes(MediaType.APPLICATION_XML)
    @Produces(MediaType.APPLICATION_XML)
    public com.gee.gecs.cosmos.webservice.autocat.insertupdateresponse.CatalogData getcopyCatalog(CopyCatalogData cd) {

        //CopyCatalogResponse response = new CopyCatalogResponse();
        //CopyCatalogResponse copyCatalogRes =new CopyCatalogResponse();

        com.gee.gecs.cosmos.webservice.autocat.insertupdateresponse.CatalogData copyCatalogRes=
            new com.gee.gecs.cosmos.webservice.autocat.insertupdateresponse.CatalogData();


        try {
            AutoCatRequestProcessorCopyCatalog requestProcessor = new AutoCatRequestProcessorCopyCatalog(cd, copyCatalogRes);
            requestProcessor.processRequest();

        } catch (AutoCatException e) {
            copyCatalogRes.setResponsecode(exceptionMap.get(e.getFaultCode()));
            copyCatalogRes.setResponsestatus(e.getFaultMessage());

        }
        return copyCatalogRes;
    }

The logs in JBoss Server

15:43:06,773 INFO  [com.gee.gecs.cosmos.webservice.autocat.util.AutoCatRequestProcessorCopyCatalog] (default task-2) inside  copy catalog functionality
15:43:30,631 INFO  [com.gee.gecs.cosmos.webservice.autocat.util.AutoCatRequestProcessorCopyCatalog] (default task-2) New Ctlg_ver_in 16479765
15:43:32,470 INFO  [com.gee.gecs.cosmos.webservice.autocat.cache.ICAMAutoCATCacheSingleton] (default task-2) Start: ICAMAutoCATCacheSingleton getICAMAutoCATCache()
15:43:32,471 INFO  [com.gee.gecs.cosmos.webservice.autocat.cache.ICAMAutoCATCacheSingleton] (default task-2) End: ICAMAutoCATCacheSingleton getICAMAutoCATCache()

Postman


Solution

  • The issue was resolved using googlecode webutilities. Added the dependency in pom.xml and the added the filters in web.xml

    <dependency>
        <groupId>com.googlecode.webutilities</groupId>
        <artifactId>webutilities</artifactId>
        <version>0.0.8</version>
    </dependency>
    

    In web.xml we added the compression filter :

    <filter>
            <filter-name>compressionFilter</filter-name>
            <filter-class>com.googlecode.webutilities.filters.CompressionFilter</filter-class>
            <init-param> 
                    <param-name>compressionThreshold</param-name>
                    <param-value>1024</param-value> <!-- compress anything above 1kb -->
            </init-param>
            <init-param> 
                    <param-name>ignoreURLPattern</param-name>
                    <param-value>.*\.(flv|mp3|mpg)</param-value> <!-- regex -->
            </init-param>
            <init-param> 
                    <param-name>ignoreMIMEPattern</param-name>
                    <param-value>image/.*|video/.*|multipart/x-gzip</param-value> <!-- ignore -->
            </init-param>
            <init-param> 
                    <param-name>ignoreUserAgentsPattern</param-name>
                    <param-value>.*MSIE.*</param-value> <!-- regex -->
            </init-param>
     </filter>
    
     <filter-mapping>
       <filter-name>compressionFilter</filter-name>
       <url-pattern>/services/xxx/xxxx</url-pattern>
     </filter-mapping>