users@grizzly.java.net

Re: (Getting the ProtocolChain instance) Re: Servlet blocking??

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 26 May 2009 20:56:38 -0400

Salut,

César Fernando Henriques wrote:
> Hi,
>
> On Mon, May 25, 2009 at 11:08 PM, Jeanfrancois Arcand
> <Jeanfrancois.Arcand_at_sun.com> wrote:
>> Salut,
>>
>> sorry for the delay. I've just added a test case in Grizzly:
>>
>>
>> Mainly, to get the ProtocolChain, just do:
>>
>>> ProtocolChain pc =
>>> gws.getSelectorThread().getController().getProtocolChainInstanceHandler().poll();
>> From there you can add your ProtocolFilter. I've filled issue:
>>
>> https://grizzly.dev.java.net/issues/show_bug.cgi?id=621
>>
>> and added
>>
>> SelectorThread.getProtocolChain() to make it easier/trivial.
>>
>> and this is fixed in 1.9.16-SNAPSHOT. We are planning to release 1.9.16 this
>> week or early next week.
>
>
> A little doubt, this already fix the
> server.getSelectorThread().getController() returning null if I call
> getController before starting the server?

Yes you still need to start the GWS in order to be allowed to add your
ProtocolFilter. Is it causing an issue?

Thanks

-- jeanfrancois



>
> Thanks
>
> Cesar.-
>
>> Thanks!
>>
>> -- Jeanfrancois
>>
>>
>>
>> César Fernando Henriques wrote:
>>> yeap I found that issue, well I think I will try Grizzly for server
>>> side and netty from client side ;-)
>>>
>>> Thanks Jean,
>>>
>>> Best Regards
>>>
>>> Cesar.-
>>>
>>>
>>>
>>>
>>> On Mon, May 25, 2009 at 8:59 PM, Jeanfrancois Arcand
>>> <Jeanfrancois.Arcand_at_sun.com> wrote:
>>>> Salut,
>>>>
>>>> César Fernando Henriques wrote:
>>>>> Jean,
>>>>>
>>>>> Is there any async http client implementend with grizzly?
>>>> Not yet, unfortunately. We are working on it:
>>>>
>>>> https://grizzly.dev.java.net/issues/show_bug.cgi?id=265
>>>>
>>>> Thanks!
>>>>
>>>> -- Jeanfrancois
>>>>
>>>>> Thanks
>>>>>
>>>>> 2009/5/25 César Fernando Henriques <fuzzball_at_alttab.com.ar>:
>>>>>> Thanks, Jean, I'm still doing tests with both Grizzly and Netty. To be
>>>>>> honest I'm inclined to choose netty at this point, just for the API
>>>>>> simplicity, but I really like Grizzly because it solve all my reqs
>>>>>> with the CometEngine
>>>>>>
>>>>>> My problem is that I don't have a global vision of Grizzly, yet, and
>>>>>> where it's going in terms of versions and features to be supported.
>>>>>>
>>>>>> For example I'm seeing that GrizzlyWebServer in 2.0 doesn't have
>>>>>> access to TCPSelectorHandler, why? Is this beacuse 2.0 doesn't support
>>>>>> comet yet? I don't think it's related to comet (maybe I'm wrong).
>>>>>> Should be nice to have the chance to add ProtocolFilter to GWS in 2.0
>>>>>> release.
>>>>>>
>>>>>>
>>>>>> If you think It will be easy to fix I can take a look at the commet
>>>>>> enabled GWS code.
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Cesar.-
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, May 25, 2009 at 6:14 PM, Jeanfrancois Arcand
>>>>>> <Jeanfrancois.Arcand_at_sun.com> wrote:
>>>>>>> Salut,
>>>>>>>
>>>>>>> César Fernando Henriques wrote:
>>>>>>>> Thanks Jean,
>>>>>>>>
>>>>>>>> I have tried accesing from different browsers and It works perfectly
>>>>>>>> :-)
>>>>>>>>
>>>>>>>>
>>>>>>>> I will keep doing some test, and trying to work around the issue of
>>>>>>>> adding ProtocolFilter on GrizzlyWebServer, do you remember that
>>>>>>>> issue?
>>>>>>>>
>>>>>>>> TCPSelectorHandler tcpHandler = server.getSelectorThread()
>>>>>>>> .getSelectorHandler();
>>>>>>>>
>>>>>>>> getSelectorHandler() return null. If I call getSelectorHandler after
>>>>>>>> gws.start() it return a valid handler but I get a null at
>>>>>>>> tcpHandler.getProtocolChainInstanceHandler();
>>>>>>> Ok this should be easy to fix. Do you want me to take a look or you
>>>>>>> already
>>>>>>> moved to Netty :-) Anyway I will file an issue but if you don't need
>>>>>>> it
>>>>>>> today, I will work on 2.0 release :-)
>>>>>>>
>>>>>>> Thanks!
>>>>>>>
>>>>>>> -- Jeanfrancois
>>>>>>>
>>>>>>>
>>>>>>>> Thanks!
>>>>>>>>
>>>>>>>> Best Regards,
>>>>>>>>
>>>>>>>> Cesar.-
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, May 25, 2009 at 11:58 AM, Jeanfrancois Arcand
>>>>>>>> <Jeanfrancois.Arcand_at_sun.com> wrote:
>>>>>>>>> Salut,
>>>>>>>>>
>>>>>>>>> César Fernando Henriques wrote:
>>>>>>>>>> Hi all, I have been doing some tests with the EchoServer and it
>>>>>>>>>> seems
>>>>>>>>>> to be running ok, my problem is just with GrizzleWebServer, I'm
>>>>>>>>>> really
>>>>>>>>>> newbie ... but I'm suspecting that I have some throuble with the
>>>>>>>>>> AsyncWebFilter.
>>>>>>>>>>
>>>>>>>>>> It's just frustrating... :-(
>>>>>>>>>>
>>>>>>>>>> Any body has seen this erro before?
>>>>>>>>> I think you are running inside Eclipse and the browser doesn't not
>>>>>>>>> allow
>>>>>>>>> more than 2 connections to the same host. This is a well know issue
>>>>>>>>> when
>>>>>>>>> using comet, e.g if your browser opens more than two connections to
>>>>>>>>> the
>>>>>>>>> server, all other connections will be blocked by the browser. This
>>>>>>>>> is
>>>>>>>>> not
>>>>>>>>> a
>>>>>>>>> Grizzly issue :-) Can you try outside Eclipse with 2 different
>>>>>>>>> browser
>>>>>>>>> (like
>>>>>>>>> I'm doing)?
>>>>>>>>>
>>>>>>>>> Thanks!
>>>>>>>>>
>>>>>>>>> -- Jeanfrancois
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Thank you guys!
>>>>>>>>>>
>>>>>>>>>> Saludos
>>>>>>>>>>
>>>>>>>>>> Cesar.-
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 2009/5/23 César Fernando Henriques <fuzzball_at_alttab.com.ar>:
>>>>>>>>>>> Jean,
>>>>>>>>>>>
>>>>>>>>>>> I have been doing some tests, but I'm still getting the same error
>>>>>>>>>>> (The servlet blocks after the first request). This is the output
>>>>>>>>>>> for
>>>>>>>>>>> the first request. If I close the browser ht servlet can serve
>>>>>>>>>>> another
>>>>>>>>>>> request.
>>>>>>>>>>>
>>>>>>>>>>> 23/05/2009 19:17:12 com.sun.grizzly.http.SelectorThread
>>>>>>>>>>> displayConfiguration
>>>>>>>>>>> INFO:
>>>>>>>>>>> Grizzly configuration for port 80
>>>>>>>>>>> Thread Pool: StatsThreadPool[name=http, priority=10,
>>>>>>>>>>> min-threads=5,
>>>>>>>>>>> max-threads=5, max-queue-size=4096, initial-byte-buffer-size=8192,
>>>>>>>>>>> byte-buffer-type=HEAP_VIEW, is-shutdown=false, port=80]
>>>>>>>>>>> ByteBuffer size: 8192
>>>>>>>>>>> maxHttpHeaderSize: 8192
>>>>>>>>>>> maxKeepAliveRequests: 256
>>>>>>>>>>> keepAliveTimeoutInSeconds: 30
>>>>>>>>>>> Static File Cache enabled: true
>>>>>>>>>>> Static resources directory:
>>>>>>>>>>> E:\Users\Cesar\Documentos\Proyectos\WebServer
>>>>>>>>>>> Adapter : com.sun.grizzly.tcp.http11.GrizzlyAdapterChain
>>>>>>>>>>> Asynchronous Request Processing enabled: true
>>>>>>>>>>> 23/05/2009 19:17:16 com.sun.grizzly.http.ProcessorTask
>>>>>>>>>>> parseRequest
>>>>>>>>>>> INFO: SocketChannel request
>>>>>>>>>>> linejava.nio.channels.SocketChannel[connected local=/127.0.0.1:80
>>>>>>>>>>> remote=/127.0.0.1:54798] is: R( /index.html)
>>>>>>>>>>> 23/05/2009 19:17:16 com.sun.grizzly.http.ProcessorTask
>>>>>>>>>>> parseRequest
>>>>>>>>>>> INFO: SocketChannel
>>>>>>>>>>> headersjava.nio.channels.SocketChannel[connected
>>>>>>>>>>> local=/127.0.0.1:80 remote=/127.0.0.1:54798] are: === MimeHeaders
>>>>>>>>>>> ===
>>>>>>>>>>> host = localhost:80
>>>>>>>>>>> user-agent = Mozilla/5.0 (Windows; U; Windows NT 6.1; es-ES;
>>>>>>>>>>> rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10
>>>>>>>>>>> accept =
>>>>>>>>>>> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
>>>>>>>>>>> accept-language = es-es,es;q=0.8,en-us;q=0.5,en;q=0.3
>>>>>>>>>>> accept-encoding = gzip,deflate
>>>>>>>>>>> accept-charset = ISO-8859-1,utf-8;q=0.7,*;q=0.7
>>>>>>>>>>> keep-alive = 300
>>>>>>>>>>> connection = keep-alive
>>>>>>>>>>> cache-control = max-age=0
>>>>>>>>>>>
>>>>>>>>>>> I'm running on Windows 7 64bits and JDK 1.6 U12
>>>>>>>>>>>
>>>>>>>>>>> any help?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Fri, May 22, 2009 at 2:04 PM, Jeanfrancois Arcand
>>>>>>>>>>> <Jeanfrancois.Arcand_at_sun.com> wrote:
>>>>>>>>>>>> Salut,
>>>>>>>>>>>>
>>>>>>>>>>>> César Fernando Henriques wrote:
>>>>>>>>>>>>> Thanks you Jean, will be good if you have a little of free time
>>>>>>>>>>>>> to
>>>>>>>>>>>>> check my code but don't worry, I'm not hurry
>>>>>>>>>>>> (saw your post on Netty ;-))
>>>>>>>>>>>>
>>>>>>>>>>>> For me your code works perfectly (I'm using 1.9.16-SNAPSHOT)
>>>>>>>>>>>>
>>>>>>>>>>>> I did:
>>>>>>>>>>>>> jfarcand_at_jfarcand-desktop:/appserv80/grizzly/gws_comet$ jdebug
>>>>>>>>>>>>> -Dcom.sun.grizzly.enableSnoop=true
>>>>>>>>>>>>> -Dcom.sun.grizzly.displayConfiguration=true -cp
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> /appserv80/grizzly/trunk/modules/bundles/comet/target/grizzly-comet-webserver-1.9.16-SNAPSHOT.jar:.
>>>>>>>>>>>>> ar.com.alttab.webserver.Test
>>>>>>>>>>>>> Listening for transport dt_socket at address: 9009
>>>>>>>>>>>>> 22-May-2009 12:56:24 PM com.sun.grizzly.http.SelectorThread
>>>>>>>>>>>>> displayConfiguration
>>>>>>>>>>>>> INFO: Grizzly configuration for port 8080
>>>>>>>>>>>>> Thread Pool: StatsThreadPool[name=http, priority=10,
>>>>>>>>>>>>> min-threads=5, max-threads=5, max-queue-size=4096,
>>>>>>>>>>>>> initial-byte-buffer-size=8192, byte-buffer-type=HEAP_VIEW,
>>>>>>>>>>>>> is-shutdown=false, port=8080]
>>>>>>>>>>>>> ByteBuffer size: 8192
>>>>>>>>>>>>> maxHttpHeaderSize: 8192
>>>>>>>>>>>>> maxKeepAliveRequests: 256
>>>>>>>>>>>>> keepAliveTimeoutInSeconds: 30
>>>>>>>>>>>>> Static File Cache enabled: true
>>>>>>>>>>>>> Static resources directory:
>>>>>>>>>>>>> /home/jfarcand/workspace/grizzly/gws_comet
>>>>>>>>>>>>> Adapter : com.sun.grizzly.tcp.http11.GrizzlyAdapterChain
>>>>>>>>>>>>> Asynchronous Request Processing enabled: true
>>>>>>>>>>>>> 22-May-2009 12:56:33 PM com.sun.grizzly.http.ProcessorTask
>>>>>>>>>>>>> parseRequest
>>>>>>>>>>>>> INFO: SocketChannel request
>>>>>>>>>>>>> linejava.nio.channels.SocketChannel[connected
>>>>>>>>>>>>> local=/127.0.0.1:8080 remote=/127.0.0.1:39679] is: R( /)
>>>>>>>>>>>>> 22-May-2009 12:56:33 PM com.sun.grizzly.http.ProcessorTask
>>>>>>>>>>>>> parseRequest
>>>>>>>>>>>>> INFO: SocketChannel
>>>>>>>>>>>>> headersjava.nio.channels.SocketChannel[connected
>>>>>>>>>>>>> local=/127.0.0.1:8080 remote=/127.0.0.1:39679] are: ===
>>>>>>>>>>>>> MimeHeaders
>>>>>>>>>>>>> ===
>>>>>>>>>>>>> user-agent = Wget/1.11.4
>>>>>>>>>>>>> accept = */*
>>>>>>>>>>>>> host = 127.0.0.1:8080
>>>>>>>>>>>>> connection = Keep-Alive
>>>>>>>>>>>>>
>>>>>>>>>>>>> Suspending :
>>>>>>>>>>>>> com.sun.grizzly.http.servlet.HttpServletRequestImpl_at_1712651
>>>>>>>>>>>>> 22-May-2009 12:56:53 PM com.sun.grizzly.http.ProcessorTask
>>>>>>>>>>>>> parseRequest
>>>>>>>>>>>>> INFO: SocketChannel request
>>>>>>>>>>>>> linejava.nio.channels.SocketChannel[connected
>>>>>>>>>>>>> local=/127.0.0.1:8080 remote=/127.0.0.1:39680] is: R( /)
>>>>>>>>>>>>> 22-May-2009 12:56:53 PM com.sun.grizzly.http.ProcessorTask
>>>>>>>>>>>>> parseRequest
>>>>>>>>>>>>> INFO: SocketChannel
>>>>>>>>>>>>> headersjava.nio.channels.SocketChannel[connected
>>>>>>>>>>>>> local=/127.0.0.1:8080 remote=/127.0.0.1:39680] are: ===
>>>>>>>>>>>>> MimeHeaders
>>>>>>>>>>>>> ===
>>>>>>>>>>>>> user-agent = Wget/1.11.4
>>>>>>>>>>>>> accept = */*
>>>>>>>>>>>>> host = 127.0.0.1:8080
>>>>>>>>>>>>> connection = Keep-Alive
>>>>>>>>>>>>>
>>>>>>>>>>>>> Suspending :
>>>>>>>>>>>>> com.sun.grizzly.http.servlet.HttpServletRequestImpl_at_6397eb
>>>>>>>>>>>>> 22-May-2009 12:57:04 PM
>>>>>>>>>>>>> com.sun.grizzly.http.SocketChannelOutputBuffer
>>>>>>>>>>>>> flushChannel
>>>>>>>>>>>>> INFO: HTTP/1.1 200 OK
>>>>>>>>>>>>> server: grizzly/1.9.16
>>>>>>>>>>>>> Content-Length: 0
>>>>>>>>>>>>> Date: Fri, 22 May 2009 16:57:04 GMT
>>>>>>>>>>>>> Connection: Keep-Alive
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> 22-May-2009 12:57:23 PM
>>>>>>>>>>>>> com.sun.grizzly.http.SocketChannelOutputBuffer
>>>>>>>>>>>>> flushChannel
>>>>>>>>>>>>> INFO: HTTP/1.1 200 OK
>>>>>>>>>>>>> server: grizzly/1.9.16
>>>>>>>>>>>>> Content-Length: 0
>>>>>>>>>>>>> Date: Fri, 22 May 2009 16:57:23 GMT
>>>>>>>>>>>>> Connection: Keep-Alive
>>>>>>>>>>>> And added the following line in
>>>>>>>>>>>>
>>>>>>>>>>>>> CometResponseHandler handler = new CometResponseHandler();
>>>>>>>>>>>>> handler.attach(arg1);
>>>>>>>>>>>>> context.addCometHandler(handler);
>>>>>>>>>>>>> System.out.println("Suspending : " + arg0);
>>>>>>>>>>>> I do see the Suspended called all the time, and also the
>>>>>>>>>>>> push/notify.
>>>>>>>>>>>> Ho
>>>>>>>>>>>> can
>>>>>>>>>>>> I reproduce your use case?
>>>>>>>>>>>>
>>>>>>>>>>>>> Do you know if there are any plan to release Grizzly Comet Web
>>>>>>>>>>>>> Server
>>>>>>>>>>>>> for nio framework 2.0?
>>>>>>>>>>>> We are targetting June 2009. I will soon work on the Comet
>>>>>>>>>>>> implementation
>>>>>>>>>>>> (after J1).
>>>>>>>>>>>>
>>>>>>>>>>>>> Last question, (already asked on the other thread), is there any
>>>>>>>>>>>>> way
>>>>>>>>>>>>> to add a ProtocolFilter to GrizzlyWebServer, I have been playing
>>>>>>>>>>>>> with
>>>>>>>>>>>>> netty and have the chance to add Custom Handlers to the channel,
>>>>>>>>>>>>> so I
>>>>>>>>>>>>> was thinking to add ProtocolHandler, CompressionHandler and
>>>>>>>>>>>>> CryptoHandler.
>>>>>>>>>>>> Yes, and I've answered:
>>>>>>>>>>>>
>>>>>>>>>>>>> In Grizzly you will do something like:
>>>>>>>>>>>>>
>>>>>>>>>>>>> GrizzlyWebServer.getSelectorThread().getSelectorHandler().
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> getProtocolChain().poll().addFilter(2,yourCustomProtocolParser());
>>>>>>>>>>>>> Another good use of Filters in my case could be to transform
>>>>>>>>>>>>> documents, I'm going to access different content from moble
>>>>>>>>>>>>> phones
>>>>>>>>>>>>> so
>>>>>>>>>>>>> maybe a good service to add in the Daemon could be a
>>>>>>>>>>>>> DocumentTransformationFilter, that extract text/html from pdf,
>>>>>>>>>>>>> doc,
>>>>>>>>>>>>> docx (I already have this implemented in a DTS Service running
>>>>>>>>>>>>> standalone).
>>>>>>>>>>>>>
>>>>>>>>>>>>> What do you think?
>>>>>>>>>>>> I think that could be pretty simple to do that inside a
>>>>>>>>>>>> GrizzlyAdapter
>>>>>>>>>>>> instead of a ProtocolFilter. Inside the grizzlyAdapter all the
>>>>>>>>>>>> headers
>>>>>>>>>>>> will
>>>>>>>>>>>> be parsed for you, and you just have to manipulate the body of
>>>>>>>>>>>> the
>>>>>>>>>>>> request.
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks!
>>>>>>>>>>>>
>>>>>>>>>>>> -- Jeanfrancois
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>
>>>>>>>>>>>>> Cesar.-
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Thu, May 21, 2009 at 10:18 PM, Jeanfrancois Arcand
>>>>>>>>>>>>> <Jeanfrancois.Arcand_at_sun.com> wrote:
>>>>>>>>>>>>>> Salut,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I'm back (was releasing this little monster ->
>>>>>>>>>>>>>> http://is.gd/Cb5Y)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> César Fernando Henriques wrote:
>>>>>>>>>>>>>>> Maybe I'm getting wrong... but is supposed that the request
>>>>>>>>>>>>>>> get
>>>>>>>>>>>>>>> suspened for different client's. In my case the servlet serve
>>>>>>>>>>>>>>> one
>>>>>>>>>>>>>>> client and suspend... that's ok, if I dispacth a comet event
>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>> response is updated with the notify, but I I create another
>>>>>>>>>>>>>>> request
>>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>> the servlet from another client the servlet doesn't respond
>>>>>>>>>>>>>>> until I
>>>>>>>>>>>>>>> close the previuos request (Close the browser).
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I don't think that should be happening... but maybe I'm
>>>>>>>>>>>>>>> totally
>>>>>>>>>>>>>>> confused.
>>>>>>>>>>>>>> No you are correct. I suspect there is not enough threads...but
>>>>>>>>>>>>>> that
>>>>>>>>>>>>>> strange. I will play with the sample (THANKS) to see what's
>>>>>>>>>>>>>> happening.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Apology for the delay.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> -- Jeanfrancois
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Thanks!
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Thu, May 21, 2009 at 6:01 PM, Jeanfrancois Arcand
>>>>>>>>>>>>>>> <Jeanfrancois.Arcand_at_sun.com> wrote:
>>>>>>>>>>>>>>>> Salut,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> César Fernando Henriques wrote:
>>>>>>>>>>>>>>>>> Jean, Yes, the service method is invoked, and the event is
>>>>>>>>>>>>>>>>> dispatched
>>>>>>>>>>>>>>>>> on CometResponseHandler. My problem is that the Servlet
>>>>>>>>>>>>>>>>> running
>>>>>>>>>>>>>>>>> on
>>>>>>>>>>>>>>>>> GrizzlyWebServer is blocking and I just can serve one client
>>>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>>>> time.
>>>>>>>>>>>>>>>> OK but all request gets suspended and that's normal you don't
>>>>>>>>>>>>>>>> get
>>>>>>>>>>>>>>>> any
>>>>>>>>>>>>>>>> response. What are you expecting?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Thanks!
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> -- jeanfrancois
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> I have attached the code.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Thanks you!!!
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On Thu, May 21, 2009 at 5:43 PM, Jeanfrancois Arcand
>>>>>>>>>>>>>>>>> <Jeanfrancois.Arcand_at_sun.com> wrote:
>>>>>>>>>>>>>>>>>> Salut,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Survivant 00 wrote:
>>>>>>>>>>>>>>>>>>> I never did comet stuff yet, but here a snippet that will
>>>>>>>>>>>>>>>>>>> enable
>>>>>>>>>>>>>>>>>>> comet.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> // comet
>>>>>>>>>>>>>>>>>>> if(cometEnabled){
>>>>>>>>>>>>>>>>>>> SelectorThread st = ws.getSelectorThread();
>>>>>>>>>>>>>>>>>>> AsyncHandler asyncHandler = new
>>>>>>>>>>>>>>>>>>> DefaultAsyncHandler();
>>>>>>>>>>>>>>>>>>> asyncHandler.addAsyncFilter(new
>>>>>>>>>>>>>>>>>>> CometAsyncFilter());
>>>>>>>>>>>>>>>>>>> st.setAsyncHandler(asyncHandler);
>>>>>>>>>>>>>>>>>>> st.setEnableAsyncExecution(true);
>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> No this not not needed.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Cesar, is the service method of your GrizzlyAdapter
>>>>>>>>>>>>>>>>>> invoked?
>>>>>>>>>>>>>>>>>> Can
>>>>>>>>>>>>>>>>>> you
>>>>>>>>>>>>>>>>>> send
>>>>>>>>>>>>>>>>>> me
>>>>>>>>>>>>>>>>>> the entire class so I can try?
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> -- Jeanfrancois
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> 2009/5/21 César Fernando Henriques <cesar_at_alttab.com.ar
>>>>>>>>>>>>>>>>>>> <mailto:cesar_at_alttab.com.ar>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Hi guys, I'm runnign the following code and something is
>>>>>>>>>>>>>>>>>>> wrong,
>>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>> servlet is blocking so I just can serve one client at
>>>>>>>>>>>>>>>>>>> time.
>>>>>>>>>>>>>>>>>>> Is
>>>>>>>>>>>>>>>>>>> that
>>>>>>>>>>>>>>>>>>> supposed to work in that way?
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Sorry if this is a silly question.. I'm new to Grizzly.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> GrizzlyWebServer server = new GrizzlyWebServer(80);
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> server.addAsyncFilter(new CometAsyncFilter());
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> server.addGrizzlyAdapter(new ServletAdapter(new
>>>>>>>>>>>>>>>>>>> MyServlet()),
>>>>>>>>>>>>>>>>>>> new String[]{"/"});
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> server.addGrizzlyAdapter(new GrizzlyAdapter() {
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> @Override
>>>>>>>>>>>>>>>>>>> public void service(GrizzlyRequest arg0,
>>>>>>>>>>>>>>>>>>> GrizzlyResponse
>>>>>>>>>>>>>>>>>>> arg1) {
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> CometEngine cometEngine =
>>>>>>>>>>>>>>>>>>> CometEngine.getEngine();
>>>>>>>>>>>>>>>>>>> CometContext cometContext =
>>>>>>>>>>>>>>>>>>> cometEngine.getCometContext("caca");
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> try {
>>>>>>>>>>>>>>>>>>> cometContext.notify("Chatter test has
>>>>>>>>>>>>>>>>>>> joined.");
>>>>>>>>>>>>>>>>>>> } catch (IOException e) {
>>>>>>>>>>>>>>>>>>> // TODO Auto-generated catch block
>>>>>>>>>>>>>>>>>>> e.printStackTrace();
>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>> }, new String[] { "/test" });
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> try {
>>>>>>>>>>>>>>>>>>> server.start();
>>>>>>>>>>>>>>>>>>> } catch (IOException e) {
>>>>>>>>>>>>>>>>>>> // TODO Auto-generated catch block
>>>>>>>>>>>>>>>>>>> e.printStackTrace();
>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Regards.-
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail:
>>>>>>>>>>>>>>>>>>> users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>>>>>>>>>>>>> <mailto:users-unsubscribe_at_grizzly.dev.java.net>
>>>>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>>>>>>> users-help_at_grizzly.dev.java.net
>>>>>>>>>>>>>>>>>>> <mailto:users-help_at_grizzly.dev.java.net>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail:
>>>>>>>>>>>>>>>>>> users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>>>>>> users-help_at_grizzly.dev.java.net
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> ------------------------------------------------------------------------
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail:
>>>>>>>>>>>>>>>>>> users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>>>>>> users-help_at_grizzly.dev.java.net
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>>> To unsubscribe, e-mail:
>>>>>>>>>>>>>>>> users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>>>> users-help_at_grizzly.dev.java.net
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>>> users-help_at_grizzly.dev.java.net
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>> users-help_at_grizzly.dev.java.net
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>>>>>>>>
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>>>>
>>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>>
>>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>