You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2006/02/28 21:45:49 UTC
Service service() being called twice
Hello there! I have a service and it's service(IrequestCycle cycle) method
is being called twice...
I enter the url:
http://localhost:8080/mgjug/app?service=newsService&newsId=2
and the method:
public void service(IRequestCycle cycle) throws IOException {
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
Long id = Long.valueOf(cycle.getParameter("newsId"));
News news = newsService.getNews(id);
PrintWriter writer = response.getWriter();
writer.write("<news>");
writer.write("<id>"+news.getId()+"</id>");
writer.write("<content>"+news.getContent()+"</content>");
writer.write("</news>");
}
is called twice. I've checked the cycle.isRewinding() but it always outputs
false. What could be wrong here?
Regards
Re: Service service() being called twice
Posted by Vinicius Carvalho <ja...@gmail.com>.
What happened is that I forgot to close the PrintWriter ... sorry. But I
wonder why does it calls the service() twice if the writer was not
closed/flushed ?
Regards
Re: Service service() being called twice
Posted by Martin Strand <ma...@entcap.se>.
I had the same problem once because I had a Firefox extension that tried
to be clever - it sent two partial requests, hoping that it would get the
content faster.
Seems weird for an extension to do that, I doubt the server's bandwidth
per request is ever an issue for clients.
On Tue, 28 Feb 2006 21:45:49 +0100, Vinicius Carvalho
<ja...@gmail.com> wrote:
> Hello there! I have a service and it's service(IrequestCycle cycle)
> method
> is being called twice...
>
> I enter the url:
> http://localhost:8080/mgjug/app?service=newsService&newsId=2
> and the method:
> public void service(IRequestCycle cycle) throws IOException {
> response.setContentType("text/xml");
> response.setHeader("Cache-Control", "no-cache");
> Long id = Long.valueOf(cycle.getParameter("newsId"));
> News news = newsService.getNews(id);
> PrintWriter writer = response.getWriter();
> writer.write("<news>");
> writer.write("<id>"+news.getId()+"</id>");
> writer.write("<content>"+news.getContent()+"</content>");
> writer.write("</news>");
> }
>
> is called twice. I've checked the cycle.isRewinding() but it always
> outputs
> false. What could be wrong here?
>
> Regards
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org