You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Leo Sakhvoruk <le...@gmail.com> on 2006/06/01 02:06:34 UTC

PageRedirectException problem inside the service() method.

I'm working on getting a service working which provides a page with a 
link to an audio file. When the link is clicked the service() method 
connects to the audio url on another server and basically pipes the data 
stream to the requesting page. The service is also supposed to display 
an error on the current page if there is something wrong with the 
stream, etc.

Well, all seems to be ok until I start plugging PageRedirectExceptions 
in the catch clauses of try/catch at which point I get the lovely Tomcat 
IllegalStateException due to the getOutputStream being called twice. 
I've looked at the example in the Tap 4 book and it seems that my code 
is fairly close to that. Again, the code appears to work unless there is 
an exception caught which requires a PageRedirectException.

I'm a bit lost at this point so any hints would be great.

Thanks

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


Re: PageRedirectException problem inside the service() method.

Posted by Leo Sakhvoruk <le...@gmail.com>.
Got it fixed,

Moved the call to getOutputStream() to a place right before it's 
actually needed so that most initialization try/catch(ing) would be done 
before that and if an error was caught the PageRedirectException is 
processed without any issues since getOutputStream() is not called yet.

Haven't tested all try/catch scenarios yet, but I think this will work.

Cheers.

Leo Sakhvoruk wrote:
> I'm working on getting a service working which provides a page with a 
> link to an audio file. When the link is clicked the service() method 
> connects to the audio url on another server and basically pipes the 
> data stream to the requesting page. The service is also supposed to 
> display an error on the current page if there is something wrong with 
> the stream, etc.
>
> Well, all seems to be ok until I start plugging PageRedirectExceptions 
> in the catch clauses of try/catch at which point I get the lovely 
> Tomcat IllegalStateException due to the getOutputStream being called 
> twice. I've looked at the example in the Tap 4 book and it seems that 
> my code is fairly close to that. Again, the code appears to work 
> unless there is an exception caught which requires a 
> PageRedirectException.
>
> I'm a bit lost at this point so any hints would be great.
>
> Thanks
>

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