You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by yesidredondo <ye...@www.ismgroupwwp.com> on 2006/06/08 06:55:15 UTC

Response is already committed!!! HELP!!!! NEWBIE

Hi, i've a problem that don't know how to fix.

A "java.lang.IllegalStateException: Response is already committed!" exception
is beeing thrown when i set the content type to ms-excel in the
pagebeginrender method of a page:

// This is the code i'm using to set the content type on the pageBeginRender

HttpServletResponse responses =
this.getPage().getRequestCycle().getRequestContext().getResponse();
		try {
			responses.setContentType("application/vnd.ms-excel");
		        responses.setHeader("Content-disposition",
		          "inline; filename=report.xls");
		        responses.setContentType("application/vnd.ms-excel");
		        responses.flushBuffer();
		} catch (IOException e) {
			e.printStackTrace();
		}

and this is the full stacktrace:

java.lang.IllegalStateException: Response is already committed! at
com.evermind[Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0)].server.http.EvermindHttpServletResponse.setContentType(EvermindHttpServletResponse.java:1049)at
org.apache.tapestry.request.ResponseOutputStream.open(ResponseOutputStream.java:182)at
org.apache.tapestry.request.ResponseOutputStream.write(ResponseOutputStream.java:270)
at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)at
sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:427)at
sun.nio.cs.StreamEncoder.close(StreamEncoder.java:160)at
java.io.OutputStreamWriter.close(OutputStreamWriter.java:222)at
java.io.BufferedWriter.close(BufferedWriter.java:244)	at
java.io.PrintWriter.close(PrintWriter.java:137)	at
org.apache.tapestry.AbstractMarkupWriter.close(AbstractMarkupWriter.java:492)
at
org.apache.tapestry.engine.AbstractEngine.renderResponse(AbstractEngine.java:764)at
org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(AbstractEngine.java:476)at
org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:931)at
org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:198)at
org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:159)	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)at
com.evermind[Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)


any help would be really appreciated. Thanks.

Hermann Yesid Redondo Eslava
Ingeniería de Sistemas
IT-GROUP LTDA.
Bogotá D.C., Colombia.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Response is already committed!!! HELP!!!! NEWBIE

Posted by yesidredondo <ye...@www.ismgroupwwp.com>.
the finishLoad method didn't work, how should i use a listener method approach?

Hermann Yesid Redondo Eslava
Ingeniería de Sistemas
IT-GROUP

---------- Original Message -----------
From: Ivano Pagano <i....@mclink.it>
To: Tapestry users <us...@tapestry.apache.org>
Sent: Thu, 08 Jun 2006 19:08:24 +0200
Subject: Re: Response is already committed!!! HELP!!!! NEWBIE

> Maybe the page finishLoad(cycle, loader, specification) method?
> 
> Jesse Kuhnert wrote:
> 
> > This is getting sewwious. (sorry, if you have kids you'll know ;))
> >
> > pageBeginRender() is a method that means rendering content back to the
> > browser has already started, at which point it is too late to set the
> > content type of your response.
> >
> > You might try a listener method approach instead, or use a hivemind
> > service
> > to do it directly.
> >
> > On 6/8/06, yesidredondo <ye...@www.ismgroupwwp.com> wrote:
> >
> >>
> >> Hi, i've a problem that don't know how to fix.
> >>
> >> A "java.lang.IllegalStateException: Response is already committed!"
> >> exception
> >> is beeing thrown when i set the content type to ms-excel in the
> >> pagebeginrender method of a page:
> >>
> >> // This is the code i'm using to set the content type on the
> >> pageBeginRender
> >>
> >> HttpServletResponse responses =
> >> this.getPage().getRequestCycle().getRequestContext().getResponse();
> >>                 try {
> >>                         responses.setContentType
> >> ("application/vnd.ms-excel");
> >>                         responses.setHeader("Content-disposition",
> >>                           "inline; filename=report.xls");
> >>                         responses.setContentType
> >> ("application/vnd.ms-excel");
> >>                         responses.flushBuffer();
> >>                 } catch (IOException e) {
> >>                         e.printStackTrace();
> >>                 }
> >>
> >> and this is the full stacktrace:
> >>
> >> java.lang.IllegalStateException: Response is already committed! at
> >> com.evermind[Oracle Application Server Containers for J2EE 10g
> >> (9.0.4.0.0)].server.http.EvermindHttpServletResponse.setContentType(
> >> EvermindHttpServletResponse.java:1049)at
> >> org.apache.tapestry.request.ResponseOutputStream.open(
> >> ResponseOutputStream.java:182)at
> >> org.apache.tapestry.request.ResponseOutputStream.write(
> >> ResponseOutputStream.java:270)
> >> at
> >> sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)at
> >> sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:427)at
> >> sun.nio.cs.StreamEncoder.close(StreamEncoder.java:160)at
> >> java.io.OutputStreamWriter.close(OutputStreamWriter.java:222)at
> >> java.io.BufferedWriter.close(BufferedWriter.java:244)   at
> >> java.io.PrintWriter.close(PrintWriter.java:137) at
> >> org.apache.tapestry.AbstractMarkupWriter.close(AbstractMarkupWriter.java
> >> :492)
> >> at
> >> org.apache.tapestry.engine.AbstractEngine.renderResponse(
> >> AbstractEngine.java:764)at
> >> org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(
> >> AbstractEngine.java:476)at
> >> org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java
> >> :931)at
> >> org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java
> >> :198)at
> >> org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:159)
> >>
> >> at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:740)at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)at
> >> com.evermind[Oracle Application Server Containers for J2EE 10g
> >> (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(
> >> ServletRequestDispatcher.java:765)
> >>
> >>
> >> any help would be really appreciated. Thanks.
> >>
> >> Hermann Yesid Redondo Eslava
> >> Ingeniería de Sistemas
> >> IT-GROUP LTDA.
> >> Bogotá D.C., Colombia.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
> 
> --
> Ivano Pagano
> 
> **
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
------- End of Original Message -------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Response is already committed!!! HELP!!!! NEWBIE

Posted by Ivano Pagano <i....@mclink.it>.
Maybe the page finishLoad(cycle, loader, specification) method?

Jesse Kuhnert wrote:

> This is getting sewwious. (sorry, if you have kids you'll know ;))
>
> pageBeginRender() is a method that means rendering content back to the
> browser has already started, at which point it is too late to set the
> content type of your response.
>
> You might try a listener method approach instead, or use a hivemind 
> service
> to do it directly.
>
> On 6/8/06, yesidredondo <ye...@www.ismgroupwwp.com> wrote:
>
>>
>> Hi, i've a problem that don't know how to fix.
>>
>> A "java.lang.IllegalStateException: Response is already committed!"
>> exception
>> is beeing thrown when i set the content type to ms-excel in the
>> pagebeginrender method of a page:
>>
>> // This is the code i'm using to set the content type on the
>> pageBeginRender
>>
>> HttpServletResponse responses =
>> this.getPage().getRequestCycle().getRequestContext().getResponse();
>>                 try {
>>                         responses.setContentType
>> ("application/vnd.ms-excel");
>>                         responses.setHeader("Content-disposition",
>>                           "inline; filename=report.xls");
>>                         responses.setContentType
>> ("application/vnd.ms-excel");
>>                         responses.flushBuffer();
>>                 } catch (IOException e) {
>>                         e.printStackTrace();
>>                 }
>>
>> and this is the full stacktrace:
>>
>> java.lang.IllegalStateException: Response is already committed! at
>> com.evermind[Oracle Application Server Containers for J2EE 10g
>> (9.0.4.0.0)].server.http.EvermindHttpServletResponse.setContentType(
>> EvermindHttpServletResponse.java:1049)at
>> org.apache.tapestry.request.ResponseOutputStream.open(
>> ResponseOutputStream.java:182)at
>> org.apache.tapestry.request.ResponseOutputStream.write(
>> ResponseOutputStream.java:270)
>> at 
>> sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)at
>> sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:427)at
>> sun.nio.cs.StreamEncoder.close(StreamEncoder.java:160)at
>> java.io.OutputStreamWriter.close(OutputStreamWriter.java:222)at
>> java.io.BufferedWriter.close(BufferedWriter.java:244)   at
>> java.io.PrintWriter.close(PrintWriter.java:137) at
>> org.apache.tapestry.AbstractMarkupWriter.close(AbstractMarkupWriter.java
>> :492)
>> at
>> org.apache.tapestry.engine.AbstractEngine.renderResponse(
>> AbstractEngine.java:764)at
>> org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(
>> AbstractEngine.java:476)at
>> org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java
>> :931)at
>> org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java
>> :198)at
>> org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:159) 
>>
>> at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:740)at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)at
>> com.evermind[Oracle Application Server Containers for J2EE 10g
>> (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(
>> ServletRequestDispatcher.java:765)
>>
>>
>> any help would be really appreciated. Thanks.
>>
>> Hermann Yesid Redondo Eslava
>> Ingeniería de Sistemas
>> IT-GROUP LTDA.
>> Bogotá D.C., Colombia.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>

--
Ivano Pagano

**

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Response is already committed!!! HELP!!!! NEWBIE

Posted by Jesse Kuhnert <jk...@gmail.com>.
This is getting sewwious. (sorry, if you have kids you'll know ;))

pageBeginRender() is a method that means rendering content back to the
browser has already started, at which point it is too late to set the
content type of your response.

You might try a listener method approach instead, or use a hivemind service
to do it directly.

On 6/8/06, yesidredondo <ye...@www.ismgroupwwp.com> wrote:
>
> Hi, i've a problem that don't know how to fix.
>
> A "java.lang.IllegalStateException: Response is already committed!"
> exception
> is beeing thrown when i set the content type to ms-excel in the
> pagebeginrender method of a page:
>
> // This is the code i'm using to set the content type on the
> pageBeginRender
>
> HttpServletResponse responses =
> this.getPage().getRequestCycle().getRequestContext().getResponse();
>                 try {
>                         responses.setContentType
> ("application/vnd.ms-excel");
>                         responses.setHeader("Content-disposition",
>                           "inline; filename=report.xls");
>                         responses.setContentType
> ("application/vnd.ms-excel");
>                         responses.flushBuffer();
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 }
>
> and this is the full stacktrace:
>
> java.lang.IllegalStateException: Response is already committed! at
> com.evermind[Oracle Application Server Containers for J2EE 10g
> (9.0.4.0.0)].server.http.EvermindHttpServletResponse.setContentType(
> EvermindHttpServletResponse.java:1049)at
> org.apache.tapestry.request.ResponseOutputStream.open(
> ResponseOutputStream.java:182)at
> org.apache.tapestry.request.ResponseOutputStream.write(
> ResponseOutputStream.java:270)
> at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)at
> sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:427)at
> sun.nio.cs.StreamEncoder.close(StreamEncoder.java:160)at
> java.io.OutputStreamWriter.close(OutputStreamWriter.java:222)at
> java.io.BufferedWriter.close(BufferedWriter.java:244)   at
> java.io.PrintWriter.close(PrintWriter.java:137) at
> org.apache.tapestry.AbstractMarkupWriter.close(AbstractMarkupWriter.java
> :492)
> at
> org.apache.tapestry.engine.AbstractEngine.renderResponse(
> AbstractEngine.java:764)at
> org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(
> AbstractEngine.java:476)at
> org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java
> :931)at
> org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java
> :198)at
> org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:159)
> at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:740)at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)at
> com.evermind[Oracle Application Server Containers for J2EE 10g
> (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(
> ServletRequestDispatcher.java:765)
>
>
> any help would be really appreciated. Thanks.
>
> Hermann Yesid Redondo Eslava
> Ingeniería de Sistemas
> IT-GROUP LTDA.
> Bogotá D.C., Colombia.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.