users@grizzly.java.net

Re: Problem with Bayeux Servlet Client in GlassFish V3

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Wed, 14 Jan 2009 11:36:52 -0500

Salut,

sgorrela wrote:
> Hi Jean,
>
> We have tried based on Shing Wai's blog and it didn't work. Could you please
> let me know how can I file this issue.
>
> Thanks much for your help.

Here:

https://grizzly.dev.java.net/issues/

Thanks

-- Jeanfrancois


> Somesh
>
>
> Jeanfrancois Arcand-2 wrote:
>> Salut,
>>
>> sgorrela wrote:
>>> Hi Jean,
>> no middle name in Quebec :-) So Jeanfrancois :-)
>>
>>> We are having the same issue as described below and we are using the
>>> Glassfishv2 and grizzly1.0.22.jar which do not contain
>>> deliverResponse.setFinished(true) method. Could you please suggest any
>>> alternate solution to overcome this problem.
>> I guess I need to prepare a patch for both of you so you can at least
>> test it. But the original blog from Shing Wai should work:
>>
>> http://blogs.sun.com/swchan/entry/java_api_for_cometd
>>
>> or does it fail? Let me know. If that doesn't work, then just file an
>> issue and I will prepare a backport.
>>
>> Thanks
>>
>> -- Jeanfrancois
>>
>>
>>
>>> Thanks,
>>> Somesh
>>>
>>>
>>> Jeanfrancois Arcand-2 wrote:
>>>> Salut,
>>>>
>>>> MichaƂ Orzechowski wrote:
>>>>> Hello,
>>>>>
>>>>> I'm trying to develop simple app that:
>>>>> 1. Allows clients to subscribe to a channel. The index.html page
>>>>> is
>>>>> a client's page where new data should be published.
>>>>> Client logic is implemented using Dojo Toolkit v 1.1.1 (standard
>>>>> subscribe method)
>>>>>
>>>>> 2. Publish new data using the servlet. The post.html is a admin page
>>>>> from witch I send data to the servlet.
>>>>> Servlet's logic is implemented with Grizzly Comet/Bayeux
>>>>> (default
>>>>> GlassFish V3 components ...)
>>>>>
>>>>> Here is what i do:
>>>>>
>>>>> 1. Open client page in browser A
>>>>> 2. Open client page in browser B (tab 1)
>>>>> 3. Open admin page in browser B (tab 2)
>>>>> 4. Send data from admin page to servlet ...
>>>>> .. and nothing happens .. clients aren't notified until i open
>>>>> new client page in browser B in tab 3 (or browser A in tab 2 - no
>>>>> matter)!
>>>>>
>>>>> It looks like server is holding the data and i really don't know
>>>>> why. Its really strange and i hope maybe some would be able to help
>>>>> me?
>>>>>
>>>>> Servlet code :
>>>>>
>>>>> public class DataServlet extends HttpServlet {
>>>>>
>>>>> CometContext context;
>>>>>
>>>>> @Override
>>>>> public void init(ServletConfig config) throws ServletException {
>>>>> super.init(config);
>>>>> String contextPath = "/CometApp/cometd";
>>>>> CometEngine cometEngine = CometEngine.getEngine();
>>>>> context = cometEngine.register(contextPath);
>>>>> context.setExpirationDelay(60 * 1000);
>>>>> }
>>>>>
>>>>> protected void processRequest(HttpServletRequest request,
>>>>> HttpServletResponse response)
>>>>> throws ServletException, IOException {
>>>>> String channel = "/my/demo";
>>>>> String messageDataName = "text";
>>>>> String messageDataValue = request.getParameter("newinfo");
>>>>>
>>>>> if (messageDataValue != null) {
>>>>> Map<String, Object> map = new HashMap<String, Object>();
>>>>> map.put(messageDataName,
>>>>> dummyBussinesLogic(messageDataValue));
>>>>> Data data = new Data();
>>>>> data.setMapData(map);
>>>>>
>>>>> DeliverResponse deliverResponse = new DeliverResponse();
>>>>> deliverResponse.setChannel(channel);
>>>>> deliverResponse.setData(data);
>>>>> deliverResponse.setLast(true);
>>>>> deliverResponse.setFollow(true);
>>>> Just add:
>>>>
>>>> deliverResponse.setFinished(true);
>>>>
>>>> and I suspect it will works.
>>>>
>>>> Thanks
>>>>
>>>> -- Jeanfrancois
>>>>
>>>>
>>>>> context.notify(deliverResponse);
>>>>>
>>>>> out.println("Data is sent.");
>>>>> } else {
>>>>> out.println("No data is sent.");
>>>>> }
>>>>>
>>>>> response.sendRedirect("post.html");
>>>>> }
>>>>>
>>>>> @Override
>>>>> protected void doGet(HttpServletRequest request, HttpServletResponse
>>>>> response)
>>>>> throws ServletException, IOException {
>>>>> processRequest(request, response);
>>>>> }
>>>>>
>>>>> @Override
>>>>> protected void doPost(HttpServletRequest request,
>>>>> HttpServletResponse
>>>>> response)
>>>>> throws ServletException, IOException {
>>>>> processRequest(request, response);
>>>>> }
>>>>>
>>>>> private String dummyBussinesLogic(String s) {
>>>>> return s.toUpperCase();
>>>>> }
>>>>> }
>>>>>
>>>>> Thanks
>>>>> Michal Orzechowski
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>
>>
>>
>