You need not click on the hyperlink to do anything. This hyperlink can open
another window very similar to post.jsp. I think this post.jsp is sufficient
for sending messages.
If you really are interested in making the hyperlink working you need to
copy the javascript function openWindow in post.jsp. Something like this but
I am not sure:

<Script Language="JavaScript">
function openWindow(url,w,h,tb,stb,l,mb,sb,rs,x,y){
var t=(document.layers)? ',screenX='+x+',screenY='+y: ',left='+x+',top='+y;
//A LITTLE CROSS-BROWSER CODE FOR WINDOW POSITIONING
tb=(tb)?'yes':'no'; stb=(stb)?'yes':'no'; l=(l)?'yes':'no';
mb=(mb)?'yes':'no'; sb=(sb)?'yes':'no'; rs=(rs)?'yes':'no';
var x=window.open(url, 'newWin'+new Date().getTime(),
'scrollbars='+sb+',width='+w+',height='+h+',toolbar='+tb+',status='+stb+',menubar='+mb+',links='+l+',resizable='+rs+t);
x.focus();
}
</Script>

But making something to work I think, you need only the post.jsp and some
modification in ChatServlet.java.
I have modified the ChatServlet.java such that  begin(request, response,
event); line gets executed in case of the block where "login".equals(action)
== true. This method will register the user.

This begin method needs to be executed otherwise for loop of MessageSender
will not be working.

Hope this helps.

 

Tony Winslow wrote:
> 
> Thank you! Things are moving now, but I still cannot see any actual effect
> yet!
> When I click the hyper-link Click to open chat
> window<javascript:openWindow('http://127.0.0.1:8080/examples/jsp/chat/chat',
> 640,
> 480 ,0 ,0 ,0 ,0 ,0 ,1 ,10 ,10 )>, the browser says there is error!
> 
> 2007/6/22, Ritesh Kumar <[EMAIL PROTECTED]>:
>>
>>
>> To Tony:
>>
>> You need to use NIO Connectors.
>> In your conf/server.xml file you need to replace the old Connector with
>> NIO
>> Connector. Replace with this:
>>
>> <Connector port="8080" protocol="
>> org.apache.coyote.http11.Http11NioProtocol"
>>                 maxThreads="150" connectionTimeout="20000"
>>                 redirectPort="8443" />
>>
>>
>> Hope this helps.
>>
>>
>> Tony Winslow wrote:
>> >
>> > I visited http://localhost:8080/examples/jsp/chat/login.jsp and type
>> > whatever Nickname it requires, but what I get is a page saying "Chat
>> > example
>> > only supports Comet processing". Then I checked the ChatServlet class
>> and
>> > I
>> > know why I get that response which is written in service().
>> > So what I want to know is how can I use it?
>> >
>> >
>> > 2007/6/22, Ritesh Kumar <[EMAIL PROTECTED]>:
>> >>
>> >>
>> >> To Tony:
>> >> For running this e.g start Tomcat. Type URL:
>> >> http://localhost:8080/examples/jsp/chat/login.jsp
>> >>
>> >>
>> >> Running this example on Tomcat 6.0.13 has not proved of any assistance
>> to
>> >> me.
>> >> It would be very nice if more explanation of this e.g is available.
>> >>
>> >> I have made one change in this e.g. It seems that if this e.g is
>> executed
>> >> then the line
>> >>         begin(event, request, response); is never reached.
>> >> So I shifted this line so that in case block "login".equals(action) is
>> >> true
>> >> begin method gets called (before return).
>> >> I have some doubts regarding this e.g.
>> >>
>> >> 1) In what scenarios CometEvent.close() method should be called?
>> >>
>> >> 2) Some times when NullPointerException is not thrown, "error" event
>> gets
>> >> generated. This happens at the time I post a message in the post.jsp
>> >> page.
>> >> Why was this "error" event gets generated is not clear to me?
>> >>
>> >>
>> >> Thanks
>> >> Ritesh
>> >>
>> >>
>> >>
>> >> Tony Winslow wrote:
>> >> >
>> >> > Could anybody make it detailed about the ChatServer sample?
>> >> > I even don't know how to run it! Thank you!
>> >> >
>> >> > 2007/6/22, Reich, Matthias <[EMAIL PROTECTED]>:
>> >> >>
>> >> >> There have been a lot of things fixed and enhanced in the Comet
>> area
>> >> >> since version 6.0.10.
>> >> >> You should better try with version 6.0.13.
>> >> >>
>> >> >> Regards,
>> >> >> Matthias
>> >> >>
>> >> >> > -----Original Message-----
>> >> >> > From: Ritesh Kumar [mailto:[EMAIL PROTECTED]
>> >> >> > Sent: Thursday, June 21, 2007 11:43 AM
>> >> >> > To: users@tomcat.apache.org
>> >> >> > Subject: Comet example Tomcat 6 not working.
>> >> >> >
>> >> >> >
>> >> >> > Hi,
>> >> >> >
>> >> >> > I am trying to run the comet sample given along with tomcat.
>> >> >> > The sample is
>> >> >> > not working correctly most of the time. I am using NIO
>> >> >> > connectors and Tomcat
>> >> >> > version is 6.0.10.
>> >> >> > I have some doubts also:
>> >> >> >
>> >> >> > 1)  In the ChatServer example, a thread (using a Runnable
>> >> >> > MessageSender) is
>> >> >> > sending responses the clients. Is it possible to write
>> >> >> > multiple times to the
>> >> >> > same response. Because when we do writer.flush() then that
>> >> >> > response is sent
>> >> >> > to the client.
>> >> >> >
>> >> >> > 2) The READ event is never invoked in my example. whenever I
>> >> >> > send a request
>> >> >> > only BEGIN event is getting called. I thought, for the first
>> >> >> > time only BEGIN
>> >> >> > event should get called, and for further requests by the same
>> >> >> > client, READ
>> >> >> > event should get called.
>> >> >> >
>> >> >> > 3) I am getting exception at the line where the thread which
>> >> >> > is trying to
>> >> >> > write to response stream is calling the flush method.
>> >> >> > The code (from tomcat example) is:
>> >> >> >
>> >> >> >                      for (int i = 0; i < connections.size(); i++)
>> {
>> >> >> >                         try {
>> >> >> >                             PrintWriter writer =
>> >> >> > connections.get(i).getWriter();
>> >> >> >                             String toBeFlushed = "";
>> >> >> >                             for (int j = 0; j <
>> >> >> > pendingMessages.length; j++)
>> >> >> > {
>> >> >> >                                 // FIXME: Add HTML filtering
>> >> >> >                                 writer.println(pendingMessages[j]
>> +
>> >> >> > "<br/>");
>> >> >> >                             }
>> >> >> >                             writer.println("Random message 1"
>> >> >> > + "<br/>");
>> >> >> >                             writer.println("Random message 2"
>> >> >> > + "<br/>");
>> >> >> >                             System.out.println("writer will flush
>> >> now.
>> >> >> > writer is null?=" + writer == null);
>> >> >> >                             writer.flush();
>> >> >> >                         } catch (IOException e) {
>> >> >> >                             log("IOExeption sending message", e);
>> >> >> >                         }
>> >> >> >                     }
>> >> >> >
>> >> >> > And the error message I am getting is:
>> >> >> >
>> >> >> > Exception in thread "MessageSender[/CometTestApp]"
>> >> >> > java.lang.NullPointerException
>> >> >> >         at
>> >> >> > org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(Inter
>> >> >> > nalNioOutputBuffer.java:607)
>> >> >> >         at
>> >> >> > org.apache.coyote.http11.InternalNioOutputBuffer.commit(Intern
>> >> >> > alNioOutputBuffer.java:600)
>> >> >> >         at
>> >> >> > org.apache.coyote.http11.Http11NioProcessor.action(Http11NioPr
>> >> >> > ocessor.java:1010)
>> >> >> >         at org.apache.coyote.Response.action(Response.java:183)
>> >> >> >         at org.apache.coyote.Response.sendHeaders(Response.java
>> :379)
>> >> >> >         at
>> >> >> > org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffe
>> >> >> > r.java:305)
>> >> >> >         at
>> >> >> > org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.
>> >> >> > java:288)
>> >> >> >         at
>> >> >> >
>> org.apache.catalina.connector.CoyoteWriter.flush(CoyoteWriter.java
>> >> :95)
>> >> >> >         at
>> >> >> > com.headstrong.test.ChatServlet$MessageSender.run(ChatServlet.
>> >> >> > java:276)
>> >> >> >         at java.lang.Thread.run(Thread.java:595)
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > View this message in context:
>> >> >> > http://www.nabble.com/Comet-example-Tomcat-6-not-working.-tf39
>> >> >> > 57585.html#a11229741
>> >> >> > Sent from the Tomcat - User mailing list archive at Nabble.com.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> ---------------------------------------------------------------------
>> >> >> > To start a new topic, e-mail: users@tomcat.apache.org
>> >> >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> >> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To start a new topic, e-mail: users@tomcat.apache.org
>> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Comet-example-Tomcat-6-not-working.-tf3957585.html#a11248825
>> >> Sent from the Tomcat - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To start a new topic, e-mail: users@tomcat.apache.org
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Comet-example-Tomcat-6-not-working.-tf3957585.html#a11250310
>> Sent from the Tomcat - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Comet-example-Tomcat-6-not-working.-tf3957585.html#a11255052
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to