JBoss kills
threca Oct 26, 2004 11:32 AMI'm using jboss-3.2.6 with its jbossweb-tomcat50.sar.
Now i'm testing gzip-compression of http-requests...
Using this web.xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>3</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>3</param-value> </init-param> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <filter> <filter-name>Compress</filter-name> <filter-class>com.jspbook.GZIPFilter</filter-class> </filter> <filter-mapping> <filter-name>Compress</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Compress</filter-name> <url-pattern>*.html</url-pattern> </filter-mapping> <!-- Struts Tag Library Descriptors --> <taglib> <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri> <taglib-location>/WEB-INF/struts-bean.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri> <taglib-location>/WEB-INF/struts-html.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri> <taglib-location>/WEB-INF/struts-logic.tld</taglib-location> </taglib> </web-app>
this is my com.jspbook.GZIPFilter:
/*
* Copyright 2003 Jayson Falkner (jayson@jspinsider.com)
* This code is from "Servlets and JavaServer pages; the J2EE Web Tier",
* http://www.jspbook.com. You may freely use the code both commercially
* and non-commercially. If you like the code, please pick up a copy of
* the book and help support the authors, development of more free code,
* and the JSP/Servlet/J2EE community.
*/
package com.jspbook;
import java.io.*;
import java.util.Enumeration;
import javax.servlet.*;
import javax.servlet.http.*;
public class GZIPFilter implements Filter {
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {
if (req instanceof HttpServletRequest) {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
System.out.println("-------------------------------------------------------------------------------------");
System.out.println("Http-Request: "+ request.getRequestURI());
for (Enumeration e = request.getHeaderNames(); e.hasMoreElements(); )
{
String headerName = (String)e.nextElement();
System.out.println("Header '" + headerName + "': '" + request.getHeader(headerName) + "'");
}
for (Enumeration e = request.getAttributeNames(); e.hasMoreElements(); )
{
String attributeName = (String)e.nextElement();
System.out.println("Attributes '" + attributeName + "': '" + request.getHeader(attributeName) + "'");
}
System.out.println("AuthTyp: " + request.getAuthType());
System.out.println("CharacterEncoding: " + request.getCharacterEncoding());
System.out.println("Method: " + request.getMethod());
System.out.println("Protocol: " + request.getProtocol());
System.out.println("QueryString: " + request.getQueryString());
System.out.println("Scheme: " + request.getScheme());
String ae = request.getHeader("accept-encoding");
if (ae != null && ae.indexOf("gzip") != -1) {
System.out.println("GZIP supported, compressing.");
GZIPResponseWrapper wrappedResponse =
new GZIPResponseWrapper(response);
chain.doFilter(req, wrappedResponse);
wrappedResponse.finishResponse();
return;
}
chain.doFilter(req, res);
}
}
public void init(FilterConfig filterConfig) {
// noop
}
public void destroy() {
// noop
}
}
Now, if I use jboss with tomcat I get this sysout-logs:
17:07:35,186 INFO [STDOUT] Http-Request: /ImageBrowser/TestGZIP.jsp 17:07:35,186 INFO [STDOUT] Header 'accept': 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*' 17:07:35,186 INFO [STDOUT] Header 'referer': 'http://localhost:8080/ImageBrowser/TestGZIP.jsp' 17:07:35,186 INFO [STDOUT] Header 'accept-language': 'de' 17:07:35,206 INFO [STDOUT] Header 'content-type': 'application/x-www-form-urlencoded' 17:07:35,206 INFO [STDOUT] Header '---------------': '----- -------' 17:07:35,206 INFO [STDOUT] Header 'user-agent': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)' 17:07:35,206 INFO [STDOUT] Header 'host': 'localhost:8080' 17:07:35,206 INFO [STDOUT] Header 'content-length': '60' 17:07:35,206 INFO [STDOUT] Header 'connection': 'Keep-Alive' 17:07:35,206 INFO [STDOUT] Header 'cache-control': 'no-cache' 17:07:35,206 INFO [STDOUT] Header 'cookie': 'JSESSIONID=F966E4735EDF169F90FA45F9FB7F8A1B; JSESSIONID=BB1A785FCD8C58DCF2E2AFF9CED4FD87' 17:07:35,206 INFO [STDOUT] AuthTyp: null 17:07:35,206 INFO [STDOUT] CharacterEncoding: null 17:07:35,206 INFO [STDOUT] Method: POST 17:07:35,206 INFO [STDOUT] Protocol: HTTP/1.1 17:07:35,206 INFO [STDOUT] QueryString: null 17:07:35,206 INFO [STDOUT] Scheme: http
But if I use a standalone tomcat 5, I get this:
Http-Request: /ImageBrowser/TestGZIP.jsp Header 'accept': '*/*' Header 'referer': 'http://localhost:7777/ImageBrowser/TestGZIP.jsp' Header 'accept-language': 'de' Header 'content-type': 'application/x-www-form-urlencoded' Header 'accept-encoding': 'gzip, deflate' Header 'user-agent': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)' Header 'host': 'localhost:7777' Header 'content-length': '63' Header 'connection': 'Keep-Alive' Header 'cache-control': 'no-cache' Header 'cookie': 'JSESSIONID=1573AC233C47BF7D21A8F606B11B24D0; JSESSIONID=BB1A785FCD8C58DCF2E2AFF9CED4FD87' AuthTyp: null CharacterEncoding: null Method: POST Protocol: HTTP/1.1 QueryString: null Scheme: http GZIP supported, compressing.
Why loose jboss that Header 'accept-encoding': 'gzip, deflate'???