You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jose Ramon Diaz <jo...@aranzadi.es> on 2004/06/03 11:32:57 UTC
Filters and forwards...
Hi all,
I am trying to wrap the HttpServletResponse to apply gzip compression on
data sent to the client when gzip is supported. I'm using a filter,wrapper
and custom ServletOutputStream based on published code.
It seems to work except when I chain actions. If I call one action which
executes a forward to a JSP, I get the exception attached.
We have the filter applied only to *.do in <url-pattern> from web.xml, so we
thought the filter is applied to the actions, and the JSP.
We know this question has been asked several times, but we have not found a
good solution for us. what could I be doing that would cause the stream to
be closed? Can?t we put a filter to compress if we use forwards from
actions?
Thanks a lot,
============ Exception ==============
java.io.IOException: This output stream has already been closed
at
es.aranzadi.filtros.CompressionResponseStream.close(CompressionResponseStrea
m.java:187)
at
es.aranzadi.filtros.CompressionResponseStream.close(CompressionResponseStrea
m.java:205)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.
java:253)
at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:10
69)
at
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProces
sor.java:455)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at
es.aranzadi.filtros.CompressionFilter.doFilter(CompressionFilter.java:243)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.j
ava:560)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDis
patcher.java:306)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.
java:240)
at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:10
69)
at
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProces
sor.java:455)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
2EE].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at
es.aranzadi.filtros.CompressionFilter.doFilter(CompressionFilter.java:243)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.j
ava:560)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDis
patcher.java:306)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:
767)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja
va:803)
at java.lang.Thread.run(Thread.java:479)
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: DynaActionForm + ActionForm problem.
Posted by Miquel Angel SeguĂ Munar <ma...@sidiem.com>.
Tamas, thank you very much, the problem was the DOCTYPE definition. Now I
have to deal with an error from the Action class, but I thing I can handly
it.
Miquel Angel SeguĂ Munar
-----Mensaje original-----
De: Tamas Szabo [mailto:szabtam@gmail.com]
Enviado el: martes, 26 de julio de 2005 18:06
Para: Struts Users Mailing List
Asunto: Re: DynaActionForm + ActionForm problem.
Hi,
>I've been writting applications with Struts 1.1 + Tomcat 5.5.9 + Eclipse
for
>a year. Until now, I've been using ActionForm. Now I want to move to
>DynaActionForm. ?Is there any problem in using DynaActionForm and
ActionForm
>in the same application (in the same struts-config.xml file)?
>
> What I did was to replace a ActionForm definition in my struts-config.xml
>file by a DynaActionForm definition, but I got this error:
>"
>GRAVE: Parse Error at line 12 column -1: Element "form-bean" does not allow
>"form-property" here.
>org.xml.sax.SAXParseException: Element "form-bean" does not allow
>"form-property" here.
> at org.apache.crimson.parser.Parser2.error(Parser2.java:3160)
>...
>
>
You probably have this DOCTYPE definition in your struts-config.xml
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
Try to change it to
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
or
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://struts.apache.org/dtds/struts-config_1_2.dtd">
Support for DynaActionForms was added only in Struts 1.1.
Tamas
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: DynaActionForm + ActionForm problem.
Posted by Tamas Szabo <sz...@gmail.com>.
Hi,
>I've been writting applications with Struts 1.1 + Tomcat 5.5.9 + Eclipse for
>a year. Until now, I've been using ActionForm. Now I want to move to
>DynaActionForm. ?Is there any problem in using DynaActionForm and ActionForm
>in the same application (in the same struts-config.xml file)?
>
> What I did was to replace a ActionForm definition in my struts-config.xml
>file by a DynaActionForm definition, but I got this error:
>"
>GRAVE: Parse Error at line 12 column -1: Element "form-bean" does not allow
>"form-property" here.
>org.xml.sax.SAXParseException: Element "form-bean" does not allow
>"form-property" here.
> at org.apache.crimson.parser.Parser2.error(Parser2.java:3160)
>...
>
>
You probably have this DOCTYPE definition in your struts-config.xml
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
Try to change it to
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
or
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://struts.apache.org/dtds/struts-config_1_2.dtd">
Support for DynaActionForms was added only in Struts 1.1.
Tamas
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
DynaActionForm + ActionForm problem.
Posted by Miquel Angel <ma...@sidiem.com>.
Hi all.
I've been writting applications with Struts 1.1 + Tomcat 5.5.9 + Eclipse for
a year. Until now, I've been using ActionForm. Now I want to move to
DynaActionForm. ?Is there any problem in using DynaActionForm and ActionForm
in the same application (in the same struts-config.xml file)?
What I did was to replace a ActionForm definition in my struts-config.xml
file by a DynaActionForm definition, but I got this error:
"
GRAVE: Parse Error at line 12 column -1: Element "form-bean" does not allow
"form-property" here.
org.xml.sax.SAXParseException: Element "form-bean" does not allow
"form-property" here.
at org.apache.crimson.parser.Parser2.error(Parser2.java:3160)
...
"
That's my ActionForm definition in struts-config.xlm:
<form-beans>
<form-bean name="CobrosEmpresasGridForm"
type="org.apache.struts.action.DynaActionForm">
<form-property name="msgerror" type="java.lang.String"/>
</form-bean>
<form-bean name="LoginForm"
type="com.sidiem.aplicaciones.seguridad.actionform.LoginForm"/>
...
</form-beans>
I would apreciate your help.
Thanks in advance.
Miquel Angel Segui
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org