Hello there! I'm experience some problems dealing with ajax + tapestry 4.0.2 (and I do know I'm the reason of the problems :) )
Ok, the scenario: A page that polls at each 2 seconds using xmlhttprequest a tapestry page. The problems: 1- number of HTTPSessions growing in a linear way to the number of requests (I believe its because of my persistent properties) 2 - invocations to the business method seems to be multiplied by a huge factor (not at every 2 seconds) I believe I misunderstanding the whole lifecycle of services/components/pages here 3- Mozilla is closing after few seconds So I've created a component, and a special service to handle all the stuff: It's some amount of code, and I'll not post it here, if someone gets interested I can send it in another message: public void service(IRequestCycle cycle) throws IOException { String pageName = cycle.getParameter(ServiceConstants.PAGE); String componentId = cycle.getParameter(ServiceConstants.COMPONENT); IPage componentPage = cycle.getPage(pageName); IComponent component = componentPage.getNestedComponent(componentId); ChatListener chatListener = (ChatListener)component; String[] params = cycle.getParameters(ServiceConstants.PARAMETER); cycle.setListenerParameters(params); chatListener.trigger(cycle); Object[] args = cycle.getListenerParameters(); Collection messages = (Collection)args[0]; PrintWriter writer = response.getPrintWriter(new ContentType("text/xml")); response.setHeader("Cache-Control", "no-cache"); writer.write(generateMessageOutput(messages)); writer.flush(); } on my page I have a listener: public void onMessageReceive(IRequestCycle cycle){ cycle.setListenerParameters(new Object[]{getChatServer().deQueueMessage(getParticipante())}); Participante participante = getParticipante(); participante.setUltimaSolicitacao(Calendar.getInstance()); setParticipante(participante); } Ok, so the component has a javascrip that renders the correct url for it. My idea was: Service->PageListener->Service As you can see, the listener is the one that does the trick (removing messages from a queue), the problem is that its been called many times more that once at each 2 seconds, is there another cycle here that I'm missing? The httpsession problem was detected on the tomcat manager. My Chat page I have persistent properties (the user logged) which are injected as state objects. It seems that when I call the setter, instead of replacing the user it's adding a new one (equals and hash code are implemented) The third problem happens even if I take off tapestry as the url for the component to query. I decided to create a simple servlet that would handle the requests, there I noticed that calling the plain servlet lead to only 1 invocation at each 2 seconds. But, the browser is still closing abruptly. As said on other emails this was a JSF app that is being migrated. The JSF version (that calls the servlet) does not hangs the browser, also I've tried to create a simple web app with the exact same javascript, a jsp and a servlet (a dumb one always giving back the same message), I tried this just to see if the error was on the javascript. I know this is very odd, and probably hard to find out, but is there anything on tapestry lifecycle that could interfere on a tapestry page invoking a servlet? I'm sorry for so many stuff in such bad English :) Hope to hear something from you guys :) Best Regards --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]