为什么@GZIP在jboss7.1.0 eap中不返回响应

时间:2019-09-24 19:53:19

标签: java spring rest java-8 jboss

我正试图从Postman那里得到答复,我已将war文件部署在JBoss7.1.0 eap服务器中。但是邮递员没有任何回应。日志中没有错误。 我在响应中使用@GZIP,听说JBoss不支持GZIP,也许这就是为什么它没有给出响应。 相同的war文件正在旧的JBoss5.1 Server中给出响应而没有问题 我有什么解决此问题的选择。 如果我评论// @ GZIP,那么花费的时间是巨大的,导致Postman本身崩溃。 如何在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;
    }

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

1 个答案:

答案 0 :(得分:0)

该问题已使用googlecode网络实用程序解决。 在pom.xml中添加了依赖项,并在web.xml中添加了过滤器

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

在web.xml中,我们添加了压缩过滤器:

<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>
相关问题