You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by moeshroom <ga...@gmail.com> on 2009/12/11 05:10:18 UTC

Can RequestDispatcher forward long-polled requests? (Comet)

If so, how?

On BEGIN events I am storing the HttpServletRequest, HttpServletResponse,
and the ServletContext associated with the request.

>From my MessageSender thread I am successfully able to write to my stored
HttpServletResponses.  But I can't figure out how to forward them to a JSP. 
I have tried using not only the stored ServletContext but also the implicit
getServletContext to create my RequestDispatcher as well as calling
getRequestDispatcher on my stored HttpServletResponse, but these doesn't
work either.  Neither does sendRedirect().  The behavior for all is that no
response is ever sent back to the client.

I would be grateful if you glanced at my code.  There's LobbyServlet.java as
well as lobby.jsp in case my Ajax is suspect.

Thanks!

http://old.nabble.com/file/p26738401/LobbyServlet.java LobbyServlet.java 
http://old.nabble.com/file/p26738401/lobby.jsp lobby.jsp 
-- 
View this message in context: http://old.nabble.com/Can-RequestDispatcher-forward-long-polled-requests--%28Comet%29-tp26738401p26738401.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Can RequestDispatcher forward long-polled requests? (Comet)

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
On 12/10/2009 09:10 PM, moeshroom wrote:
> If so, how?
>
> On BEGIN events I am storing the HttpServletRequest, HttpServletResponse,
> and the ServletContext associated with the request.
>
> > From my MessageSender thread I am successfully able to write to my stored
> HttpServletResponses.  But I can't figure out how to forward them to a JSP.
> I have tried using not only the stored ServletContext but also the implicit
> getServletContext to create my RequestDispatcher as well as calling
> getRequestDispatcher on my stored HttpServletResponse, but these doesn't
> work either.  Neither does sendRedirect().  The behavior for all is that no
> response is ever sent back to the client.
>
> I would be grateful if you glanced at my code.  There's LobbyServlet.java as
> well as lobby.jsp in case my Ajax is suspect.
>
> Thanks!
>
> http://old.nabble.com/file/p26738401/LobbyServlet.java LobbyServlet.java
> http://old.nabble.com/file/p26738401/lobby.jsp lobby.jsp
>    
ok, I haven't tried it, but it would look like

event.close();
getRequestDispatcher().include(....);

you have to close the event before you start doing regular servlet stuff

Filip



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