users@grizzly.java.net

Re: Problem with Bayeux Servlet Client in GlassFish V3

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Mon, 19 Jan 2009 13:56:39 -0500

Salut,

Jeanfrancois Arcand wrote:
> Salut,
>
> sgorrela wrote:
>> Hi Jean,
>>
>> Thanks much for your response. Its great to know that you are
>> implementihng
>> this today or tomorrow. We have tried for source code of the
>> DeliverResponse.setFinished in
>> grizzly-module.jar comes with GlassfishV3, grizzly-module-1.9.0.jar and
>> grizzly-cometd-webserver-1.8.1-SNAPSHOT.jar.
>
> I see. But you are looking for a version that works with GlassFish v2,
> right?

OK I confused myself :-) You are looking for a solution in GF v3? It
should be there as of now. Take a look at this example:

https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/bayeux/BayeuxExternalServlet.html

It must have been included with 1.9.0 or the latest nightly of v3, which
use 1.9.4. The complete demo an be downloaded from here:

http://download.java.net/maven/2/com/sun/grizzly/samples/grizzly-cometd-bayeux/

A+

-- Jeanfrancois


>
> A+
>
> -- jeanfrancois
>
>
>>
>> Thanks,
>> Somesh
>>
>>
>> Jeanfrancois Arcand-2 wrote:
>>> Salut,
>>>
>>> sgorrela wrote:
>>>> Hi Jean,
>>>>
>>>> I am sorry to bother you again. Do you any time frame by which this
>>>> feature
>>>> can be implemented in 1.0.23. We are kind of struck and could not
>>>> proceed
>>>> due to this.
>>> Today or tomorrow.
>>>
>>>> Also, could you please let us know which version of jar contains
>>>> DeliverResponse.setFinished method so that our team look to try of work
>>>> around. We have downloaded 3 or 4 versions of grizzly jars and could
>>>> not
>>>> find this method in them.
>>> You means 1.0.x or 1.9.x?
>>>
>>> Thanks
>>>
>>> -- Jeanfrancois
>>>
>>>> I appreciate your help.
>>>>
>>>> Thanks,
>>>> Somesh
>>>>
>>>>
>>>> Jeanfrancois Arcand-2 wrote:
>>>>> Salut,
>>>>>
>>>>> sgorrela wrote:
>>>>>> Hi Jean,
>>>>>>
>>>>>> I have submitted issue. Could you please suggest any work around move
>>>>>> ahead
>>>>>> with this issues.
>>>>> Unfortunately, there seems to be no workaround unless 1.0.23 is
>>>>> released, with the backport inside it.
>>>>>
>>>>> Thanks
>>>>>
>>>>> -- Jeanfrancois
>>>>>
>>>>>> Thanks,
>>>>>> Somesh
>>>>>>
>>>>>> Jeanfrancois Arcand-2 wrote:
>>>>>>> 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
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>>
>>>>>>> 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
>