[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [xmlblaster] More than one applet in one page problems



Hi Marcel,

	Thanks for your opinion. I will take it in my considerations. Personally I don't use static variables often but for the design that I chose for this application it was, in my opinion, the best solution.

Best regards,
Eduardo Catarino

PS: Sorry for not using the mailing list in the last email



-----Original Message-----
From: Marcel Ruff [mailto:mr at marcelruff.info] 
Sent: quinta-feira, 27 de Outubro de 2005 16:19
To: Eduardo Catarino
Subject: Re: [xmlblaster] More than one applet in one page problems

Eduardo Catarino wrote:

>Hi Marcel,
>
>	After running your examples and checking that everything was OK with them I started to test my own application. However I was still having problems.
>After some debuging and thinking I found the cause of the problems. Since I will probably need to use the xmlBlaster for different purposes I developed some classes that wrap the access to the xmlBlaster so for the next times the programming effort would be much smaller. The idea was to have only one connection object for different subscribers (I'm only using subscribers now) so I used the singleton design pattern approach (for a static variable that implemented the connection). The problem now wasn't the multi applet support but not knowing that static variables are seen by all the applets in the same browser. Initially I thought that for each applet I would have a different connection but all the applets were using the same static variable and therefore the same connection. (as I said in my previous email I'm really not an expert in this area)
>  
>
Hi again,

i personally never use static objects, they dont't scale as they are 
instantiated with loading of the class,
so you loose important control.
I would drop this approach,

just my two cents,
Marcel

PS: Please use the mailing list so that others benefit from our discussion.

>	After this I decided to maintain the singleton approach and the all the applets using the same connection, which is different solution for this problem. Because of that I'm sharing this point of view with you first for having your opinion about it and check if there are some drawbacks with it, and secondly if it is a good solution maybe good for someone else.
>
>Best regards,
>Eduardo Catarino
>
>	
>
>-----Original Message-----
>From: owner-xmlblaster at server.xmlBlaster.org [mailto:owner-xmlblaster at server.xmlBlaster.org] On Behalf Of Marcel Ruff
>Sent: segunda-feira, 24 de Outubro de 2005 16:59
>To: xmlblaster at server.xmlBlaster.org
>Subject: Re: [xmlblaster] More than one applet in one page problems
>
>Ola again,
>
>if have added now multiple applet support in one session.
>Please check out the newest code from xmlBlaster svn
>and compile it with:
>
>   build all deploy_war
>
>regards,
>Marcel
>
>
>Marcel Ruff wrote:
>
>  
>
>>Hi Eduardo,
>>
>>i can reproduce this here.
>>The problem is that all three applets use the same session-id
>>and the servlet gets confused as it thinks it talks to one applet.
>>
>>If we find a way to force the three applets so that each keeps
>>its own session id it should work (the servlet handles this).
>>
>>The two optional parameters, /path/ and /domain/, are used to restrict
>>the scope of a cookie.
>>
>>Here is our same cookie for all three applets:
>>Name: JSESSIONID
>>Value: 2EC1E3B981517888E8597EB5C9034F67
>>Domain/Path: localhost/xmlBlaster
>>Expires: Session
>>
>>As a workaround you could have three tomcats running on three
>>ports and each applet uses its own url (Domain/Path).
>>
>>Or find another clever way to distinguish the three applets in the
>>Domain/Path.
>>Probably registering the servlet three times and set
>>a different Path?
>>Or by passing
>><PARAM NAME = "xmlBlaster/servletUrl"
>>VALUE="http://localhost:8080/xmlBlaster/AppletServlet1"; />
>>and AppletServlet2, AppletServlet3? (the xmlBlaster/servletUrl is used
>>by the applet as the URL to connect)
>>
>>The proper way is probably:
>>If you need multi applet support in the same frameset you
>>would need to extend the xmlBlaster applet library and servlet library
>>to handle session management with applet specific cookies.
>>Like this, the main servlet session contains sub-scopes for each applet.
>>
>>Another solution could be to have only one communication applet
>>and all other applets contact the communication applet (if this is
>>possible).
>>
>>Any simpler idea around?
>>
>>regards
>>Marcel
>>
>>
>>Eduardo Catarino wrote:
>>
>>    
>>
>>>Hi,
>>>
>>>I'm developing small applications where I need to have 3 applets in 
>>>the same html file (each one in a different frame). The problem is 
>>>that I'm having (sometimes) an access denied problem. For checking 
>>>purposes I used this simple test that reproduces my problem (the 
>>>SystemInfoApplet.html is the one that comes with the xmlblaster 
>>>distribution). As you can see the applet gets stuck after subscribing 
>>>a message)
>>>
>>>Help will be appreciated.
>>>
>>><html>
>>>
>>><head>
>>>
>>><base target="_self">
>>>
>>></head>
>>>
>>><frameset rows="33%,33%,34%">
>>>
>>><frame name="alerts" src="SystemInfoApplet.html" scrolling="no" 
>>>target="_self">
>>>
>>><frame name="alert" src=" SystemInfoApplet.html " scrolling="no" 
>>>target="_self">
>>>
>>><frame name="freeText" src="SystemInfoApplet.html" scrolling="no" 
>>>target="_self">
>>>
>>></frameset>
>>>
>>><noframes>
>>>
>>><body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
>>>
>>><p>Esta página utiliza frames, mas o seu browser não as suporta.</p>
>>>
>>></body>
>>>
>>></noframes>
>>>
>>></frameset>
>>>
>>></html>
>>>
>>>      
>>>
>>
>>    
>>
>
>
>  
>