DontPush OzoneLayer

Hi,

today I have integrate DontPush OzoneLayer in my Vaadin Webapp. I’m using exactly the same configuration as in the demo sources from the Add-on page.
When running the application, I see the following warning:

org.vaadin.dontpush.server.AtmosphereDontPushHandler - You have set an infinite timeout for your comet connection this is not recommended

How can I set the timeout for the comet connection?
More generally, where can I find a description of all that can be configured when using the add-on DontPush OzoneLayer?

Thank you,
Sabina

Hi,

I faced same issue : [You have set an infinite timeout for your comet connection this is not recommended]

Not yet to know how to solve it.

Same problem here with Tomcat 7.0.27. I got to work the DontPush demo but not my application… Maybe other addons are messing DontPush? I tried TPT and SessionGuard and they were both ok… Any fresh ideas?

Hi,

I think this is actually nothing critical actually as the gwt atmosphere example does exactly the same thing:
https://github.com/Atmosphere/atmosphere/blob/master/samples/gwt-demo/src/main/java/org/atmosphere/samples/server/AtmosphereHandler.java#L63

If you want to get this resolved you should tease Pierre Havelaar and Jean Francois Arcand on
atmosphere mailing list
. OzoneLayer is currently bit behind the rapidly moving Atmosphere Framework, but it quickly looks this particular thing hasn’t changed. GWT parts have lately progressed a bit so we might actually get a proper web socket support for Firefox as well nowadays.

cheers,
matti

Hello Matti,

I think I finally found the real problem. I am getting a “Custom Layout not Found” error. I am using a customLayout and so the servlet must get a theme resource (a html file). The problem here is that the BroadcasterVaadinSocket implements the Callback interface like this:

protected Callback callBack = new Callback() {

        public void criticalNotification(Request request, Response response,
                String cap, String msg, String details, String outOfSyncURL)
                throws IOException {
            // TODO Auto-generated method stub

        }

        public String getRequestPathInfo(Request request) {
            // TODO Auto-generated method stub
            return null;
        }

        public InputStream getThemeResourceAsStream(String themeName,
                String resource) throws IOException {
            // TODO Auto-generated method stub
            return null;
        }
    };

and when I use the AbstractCommunicationManager it calls the callback like this:

 int resourceIndex = 0;
        for (final Iterator<Object> i = paintTarget.getUsedResources()
                .iterator(); i.hasNext();) {
            final String resource = (String) i.next();
            InputStream is = null;
            try {
                is = callback.getThemeResourceAsStream(getTheme(window),
                        resource);
            } catch (final Exception e) {
                // FIXME: Handle exception
                logger.log(Level.FINER, "Failed to get theme resource stream.",
                        e);
            }
            if (is != null) {
             ...
            } else {
                // FIXME: Handle exception
                logger.severe("CustomLayout not found: " + resource);
            }

which will get a return value of null.

the proper implementation for the Callback interface is on the CommunicationManager:

private static class AbstractApplicationServletWrapper implements Callback {

        private final AbstractApplicationServlet servlet;

        public AbstractApplicationServletWrapper(
                AbstractApplicationServlet servlet) {
            this.servlet = servlet;
        }

        public void criticalNotification(Request request, Response response,
                String cap, String msg, String details, String outOfSyncURL)
                throws IOException {
            servlet.criticalNotification(
                    (HttpServletRequest) request.getWrappedRequest(),
                    (HttpServletResponse) response.getWrappedResponse(), cap,
                    msg, details, outOfSyncURL);
        }

        public String getRequestPathInfo(Request request) {
            return servlet.getRequestPathInfo((HttpServletRequest) request
                    .getWrappedRequest());
        }

        public InputStream getThemeResourceAsStream(String themeName,
                String resource) throws IOException {
            return servlet.getServletContext().getResourceAsStream(
                    "/" + AbstractApplicationServlet.THEME_DIRECTORY_PATH
                            + themeName + "/" + resource);
        }

    }

which needs access to the AbstractApplicationServlet. Is there any way to access it inside the BroadcasterVaadinSocket? That way I could use the Callback implementation inside CommunicationManager.

Regards
Bruno

HI,

I practically never use custom layouts so I haven’t faced this by myself, but indeed that looks like it could happen like that. You could add a ticket to the project page so this don’t get forgotten.

In the mean time I could suggest a workaround. There is a newer alternative method to “string key pointing to theme resources” for providing templates for theme resources. You can also provide template as input stream via this constructor:

public CustomLayout(InputStream templateStream)

The input stream method is IMO much better as you can locate templates next to classes that actually use them or to any other place you want. Then loading them e.g. like this:

getClass().getResourceAsStream("mytemplate.html")

It also paves way to e.g. build your templates dynamically with tools like Apache Velocity.

cheers,
matti

Hi Matti,

Great I’ll try that. Now I am having another issue… I dont know how this one happened… Im getting this error:

Couldn’t establish connection, no CM found for this session 242b0396-b8da-4b98-b845-f898b7fa4f92

I see one session being saved but when the debug session returns again to the handler I have a new session :S. Why could this happen?

Regards
Bruno

Hello again Matti,

Just to let you know that the CustomLayout Hack worked great and my last post was due to syncing issues on my code during its deployment. Now everything is OK. This is a great addon :slight_smile: hope it will be used on Vaadin 7 as planned. I also used the GzipFilter from ehcache and so my app is blazing fast!! (well comparing with a regular Vaadin app…)

Thanx a lot
Bruno