File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Compression Filters and static content Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Compression Filters and static content" Watch "Compression Filters and static content" New topic
Author

Compression Filters and static content

Juarez Alvares Barbosa Junior
Ranch Hand

Joined: Mar 18, 2002
Posts: 80
Hi,
I am running jboss-3.2.1 with tomcat-4.1.24 and have configured the following filter scheme in my web.xml:
<web-app>
<filter>
<filter-name>UISCompressionFilter</filter-name>
<filter-class>com.unisys.framework.control.UISCompressionFilter</filter-class>
<init-param>
<param-name>compressed</param-name>
<param-value>true</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>UISCompressionFilter</filter-name>
<servlet-name>LongServlet</servlet-name>
</filter-mapping>

<filter-mapping>
<filter-name>UISCompressionFilter</filter-name>
<url-pattern>/TesteDPR.html</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>UISCompressionFilter</filter-name>
<url-pattern>/long.jsp</url-pattern>
</filter-mapping>
...
My filter works fine when accessing a servlet or jsp page but when I try
to get html files, the following exception is thrown:
Please Help !!!
15:24:50,624 ERROR [Engine] StandardWrapperValve[default]: Servlet.service() for servlet default thr
ew exception
java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOu
tputBuffer.java:668)
at org.apache.coyote.http11.filters.IdentityOutputFilter.doWrite(IdentityOutputFilter.java:1
60)
at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:523)
at org.apache.coyote.Response.doWrite(Response.java:524)
at org.apache.coyote.tomcat4.OutputBuffer.realWriteBytes(OutputBuffer.java:384)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:439)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:359)
at org.apache.coyote.tomcat4.OutputBuffer.writeBytes(OutputBuffer.java:411)
at org.apache.coyote.tomcat4.OutputBuffer.write(OutputBuffer.java:398)
at org.apache.coyote.tomcat4.CoyoteOutputStream.write(CoyoteOutputStream.java:110)
at org.apache.catalina.servlets.DefaultServlet.copyRange(DefaultServlet.java:1996)
at org.apache.catalina.servlets.DefaultServlet.copy(DefaultServlet.java:1745)
at org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:1073)
at org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:506)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
ava:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at com.unisys.framework.control.UISCompressionFilter.doFilter(UISCompressionFilter.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
ava:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Standar
dPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Standar
dPipeline.java:643)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Standar
dPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Standar
dPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Standar
dPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Standar
dPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Standar
dPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Standar
dPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11P
rotocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:534)
Thank you !
Juarez Alvares Barbosa Junior
Ranch Hand

Joined: Mar 18, 2002
Posts: 80
Just in time, take a look at what servlet 2.3 spec says about filters and static content...
"Filters can be associated with groups of servlets and static content using the url-pattern style of filter mapping:
<filter-mapping>
<filter-name>Logging Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Here the Logging Filter is applied to all the servlets and static content pages in the web application, because every request URI matches the ‘/*’ URL pattern. When processing a filter-mapping element using the url-pattern style, the container must determine whether the url-pattern matches the request URI using the path mapping rules defined in Chapter SRV.11.
Thanks, Juarez
Juarez Alvares Barbosa Junior
Ranch Hand

Joined: Mar 18, 2002
Posts: 80
Hi,
Problem was fixed, Thks a lot !
Juarez
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compression Filters and static content
 
Similar Threads
Stuts forwarding does not work
does jboss3.2.3 supports servlet filters?
cannot find servlet - errors
Tomcat 4.1.x java.net.SocketException
intermittent nullpointer using response.encodeURL error anyone know how to solve it