The question is that I don't need to forward to a JSP. The controller takes the HttpServletResponse and writes in it, and that is the response to the user. Before that I put the image as an attribute in the request, and in a JSP template I recovered it form the request, and wrote it, but the tomcat always said that the Output stream had already been closed.
Is there anyway to return a image to the user using a controller without using a JSP? -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Benedict Sent: Tuesday, August 21, 2007 18:18 PM To: Struts Users Mailing List Subject: Re: Tiles: definition without path I don't understand why you haven't provided a path attribute on the definition. Definitions need to resolve to a resource. I don't see a JSP listed. On 8/21/07, Jose Luis Martinez Avial <[EMAIL PROTECTED]> wrote: > > I'm using Struts 1.3.9, with Tiles. I've one action that calls to a > definition > struts-config.xml > <action path="/customer/verGraphPortfolio" > forward="verGraphPortfolio.pantalla"/> > > riles-def..xml > <definition name=" verGraphPortfolio.pantalla" > controllerClass="com.bpi.isis.customer.web.vista.PortfolioValGraphContro > ller"/> > > In the PortfolioValGraphController I have this code > > .... > response.setHeader("Content-Disposition", "inline"); > response.setHeader("Cache-Control", "no-cache"); > response.setHeader("Cache-Control", "no-store"); > response.setHeader("Cache-Control", "must-revalidate"); > response.getOutputStream().write(baos.toByteArray()); > response.getOutputStream().flush(); > response.getOutputStream().close(); > response.setStatus(HttpServletResponse.SC_OK); > baos.close(); > baos = null; > ..... > > If I don't put the path attribute in the definition, the controller is > not invocated and the user doesn't see the image. In the logs your can > see this: > > 21 Aug 2007 13:11:36,711 DEBUG > org.apache.struts.tiles.ComponentDefinition - Controller created : > [EMAIL PROTECTED] > 21 Aug 2007 13:11:36,711 DEBUG > org.apache.struts.tiles.commands.TilesPreProcessor - no uri computed, > so pass to next command > 21 Aug 2007 13:11:36,711 DEBUG > org.apache.struts.chain.commands.ActionCommandBase - Executing > org.apache.struts.chain.commands.servlet.PerformForward > 21 Aug 2007 13:11:36,711 DEBUG org.apache.struts.util.RequestUtils - > No actionId found for verGraphPortfolio.pantalla > 21 Aug 2007 13:11:36,711 DEBUG > org.apache.struts.chain.commands.ExceptionCatcher - Attempting to > handle a thrown exception > 21 Aug 2007 13:11:36,711 DEBUG > org.apache.struts.chain.commands.ExceptionCatcher - Calling > exceptionCommand 'servlet-exception' > 21 Aug 2007 13:11:36,711 DEBUG > org.apache.struts.chain.commands.ActionCommandBase - Executing > org.apache.struts.chain.commands.servlet.ExceptionHandler > 21 Aug 2007 13:11:36,711 DEBUG > org.apache.struts.chain.commands.AbstractExceptionHandler - See if > actionConfig > ActionConfig[cancellable=false,path=/customer/verGraphPortfolio,validate > =true,forward=verGraphPortfolio.pantalla,scope=session has an > exceptionConfig for java.lang.IllegalArgumentException > 21 Aug 2007 13:11:36,711 DEBUG org.apache.struts.config.ActionConfig - > findException: look locally for java.lang.IllegalArgumentException > 21 Aug 2007 13:11:36,711 DEBUG org.apache.struts.config.ActionConfig - > findException: look globally for java.lang.IllegalArgumentException > 21 Aug 2007 13:11:36,711 DEBUG org.apache.struts.config.ActionConfig - > findException: look locally for java.lang.RuntimeException > 21 Aug 2007 13:11:36,711 DEBUG org.apache.struts.config.ActionConfig - > findException: look globally for java.lang.RuntimeException > 21 Aug 2007 13:11:36,711 DEBUG org.apache.struts.config.ActionConfig - > findException: look locally for java.lang.Exception > 21 Aug 2007 13:11:36,711 DEBUG org.apache.struts.config.ActionConfig - > findException: look globally for java.lang.Exception > 21 Aug 2007 13:11:36,711 DEBUG org.apache.struts.config.ActionConfig - > findException: look locally for java.lang.Throwable > 21 Aug 2007 13:11:36,711 DEBUG org.apache.struts.config.ActionConfig - > findException: look globally for java.lang.Throwable > 21 Aug 2007 13:11:36,711 DEBUG org.apache.struts.config.ActionConfig - > findException: look locally for java.lang.Object > 21 Aug 2007 13:11:36,711 DEBUG org.apache.struts.config.ActionConfig - > findException: look globally for java.lang.Object > 21 Aug 2007 13:11:36,711 WARN > org.apache.struts.chain.commands.AbstractExceptionHandler - Unhandled > exception > java.lang.IllegalArgumentException: Path verGraphPortfolio.pantalla does > not start with a "/" character > at > org.apache.catalina.core.ApplicationContext.getRequestDispatcher(Applica > tionContext.java:379) > at > org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(A > pplicationContextFacade.java:195) > at > org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward( > PerformForward.java:107) > at > org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformF > orward.java:96) > > > > > If I put path = "", then the controller is invocated, and the user see > the image, but you see this logs > 21 Aug 2007 13:11:28,320 INFO > org.apache.struts.tiles.commands.TilesPreProcessor - Tiles process > complete; forward to > 21 Aug 2007 13:11:28,320 DEBUG > org.apache.struts.chain.commands.ExceptionCatcher - Attempting to > handle a thrown exception > 21 Aug 2007 13:11:28,320 DEBUG > org.apache.struts.chain.commands.ExceptionCatcher - Calling > exceptionCommand 'servlet-exception' > 21 Aug 2007 13:11:28,320 DEBUG > org.apache.struts.chain.commands.ActionCommandBase - Executing > org.apache.struts.chain.commands.servlet.ExceptionHandler > 21 Aug 2007 13:11:28,320 DEBUG > org.apache.struts.chain.commands.AbstractExceptionHandler - See if > actionConfig > ActionConfig[cancellable=false,path=/divisas/verGraphExchRate,validate=t > rue,forward=verGraphExchRate.pantalla,scope=session has an > exceptionConfig for java.lang.IllegalArgumentException > 21 Aug 2007 13:11:28,320 DEBUG org.apache.struts.config.ActionConfig - > findException: look locally for java.lang.IllegalArgumentException > 21 Aug 2007 13:11:28,320 DEBUG org.apache.struts.config.ActionConfig - > findException: look globally for java.lang.IllegalArgumentException > 21 Aug 2007 13:11:28,320 DEBUG org.apache.struts.config.ActionConfig - > findException: look locally for java.lang.RuntimeException > 21 Aug 2007 13:11:28,320 DEBUG org.apache.struts.config.ActionConfig - > findException: look globally for java.lang.RuntimeException > 21 Aug 2007 13:11:28,320 DEBUG org.apache.struts.config.ActionConfig - > findException: look locally for java.lang.Exception > 21 Aug 2007 13:11:28,320 DEBUG org.apache.struts.config.ActionConfig - > findException: look globally for java.lang.Exception > 21 Aug 2007 13:11:28,320 DEBUG org.apache.struts.config.ActionConfig - > findException: look locally for java.lang.Throwable > 21 Aug 2007 13:11:28,320 DEBUG org.apache.struts.config.ActionConfig - > findException: look globally for java.lang.Throwable > 21 Aug 2007 13:11:28,320 DEBUG org.apache.struts.config.ActionConfig - > findException: look locally for java.lang.Object > 21 Aug 2007 13:11:28,320 DEBUG org.apache.struts.config.ActionConfig - > findException: look globally for java.lang.Object > 21 Aug 2007 13:11:28,320 WARN > org.apache.struts.chain.commands.AbstractExceptionHandler - Unhandled > exception > java.lang.IllegalArgumentException: Path does not start with a "/" > character > at > org.apache.catalina.core.ApplicationContext.getRequestDispatcher(Applica > tionContext.java:379) > at > org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(A > pplicationContextFacade.java:195) > at > org.apache.struts.tiles.commands.TilesPreProcessor.getRequiredDispatcher > (TilesPreProcessor.java:274) > at > org.apache.struts.tiles.commands.TilesPreProcessor.doForward(TilesPrePro > cessor.java:257) > at > org.apache.struts.tiles.commands.TilesPreProcessor.execute(TilesPreProce > ssor.java:217) > at > org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) > at > org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.jav > a:304) > > Do I need to put a JSP in the path? An empty JSP? Is there any way to > avoid this? > > > Internet communications are not secure and therefore Banco > Santander International does not accept legal responsibility for > the contents of this message. Any views or opinions presented are > solely those of the author and do not necessarily represent those > of Banco Santander International unless otherwise specifically > stated. > > Las comunicaciones via Internet no son seguras y por lo tanto > Banco Santander International no asume responsabilidad legal ni > de ningun otro tipo por el contenido de este mensaje. Cualquier > opinion transmitida pertenece unicamente al autor y no > necesariamente representa la opinion del Banco Santander > International a no ser que este expresamente detallado. > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > Internet communications are not secure and therefore Banco Santander International does not accept legal responsibility for the contents of this message. Any views or opinions presented are solely those of the author and do not necessarily represent those of Banco Santander International unless otherwise specifically stated. Las comunicaciones via Internet no son seguras y por lo tanto Banco Santander International no asume responsabilidad legal ni de ningun otro tipo por el contenido de este mensaje. Cualquier opinion transmitida pertenece unicamente al autor y no necesariamente representa la opinion del Banco Santander International a no ser que este expresamente detallado. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]