gpt4 book ai didi

java - 为什么@GZIP在jboss7.1.0 eap中没有返回响应

转载 作者:行者123 更新时间:2023-12-02 00:16:27 24 4
gpt4 key购买 nike

我正在尝试从 Postman 那里获得响应,我已经在 J​​Boss7.1.0 eap 服务器中部署了 war 文件。但我在 postman 中没有收到任何回复。日志中没有错误。我在响应中使用了 @GZIP ,我听说 JBoss 不支持 GZIP ,也许这就是它不给出响应的原因。相同的 war 文件在旧的 JBoss5.1 服务器中给出响应,没有问题我有什么选择来解决这个问题。如果我评论//@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 服务器中的日志

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

最佳答案

该问题已使用 googlecode webutilities 解决。在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>

关于java - 为什么@GZIP在jboss7.1.0 eap中没有返回响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58087309/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com