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

Re: FW: FW: [xmlblaster] session object erased????



Hi Eduardo,
I now had a closer look to the code and tested. It is indeed true that a
new Http Session is created each time a new applet is created. This is
however outside the control of xmlBlaster, it is the browser which
decides that.

We now have changed the code so that it is possible to pass properties
on the constructor of XmlBlasterAccessRaw. Then all properties which do
start with 'servlet/' will be sent to the servlet. So for example if you
pass the property:
servlet/JSESSION=AAAAAAAAAA it will be passed to the serlvet in the url
as http://localhost:8080/....&JSESSION=AAAAAAAAAA

This way you could force the servlet to use the same http session. Note
the code is in svn. Due to lack of time we are now not able to test
this. It would be nice if you would provide us with such tests.

For the JDBC Stuff I still had not the time to look at it.

Regards
Michele


Eduardo Catarino wrote:
> Hi Michele,
> 
>  	Thanks for replying me so quickly.
>       I've been looking at the code and for XmlBlasterAccessRaw.java and  AppletServlet.java the flag is xmlBlaster/invalidate and for the BlasterHttpProxyServlet.java the flag is xmlBlaster.invalidate. But the main question for me is how can I pass to the applet this parameter? I already tried configuring the web.xml:
> 
> <servlet>
>>  <servlet-name>AppletServlet</servlet-name>
>>  <description>Persistent HTTP connection demo servlet</description>
>>   
>> <servlet-class>org.xmlBlaster.protocol.http.appletproxy.AppletServlet</servlet-class>
>>   <init-param>
>>     <param-name>xmlBlaster/invalidate </param-name>
>>     <param-value>false</param-value>
>>   </init-param> 
> 
> 
> I tried to pass as parameter to the applet like the following lines
> 
> <param name="deliveredParamKeys" 				      				VALUE="protocol,xmlBlaster/logLevels,xmlBlaster/invalidate" />
> <param name="protocol" 				VALUE="SOCKET" />
> <param name="xmlBlaster/logLevels" 		VALUE="ERROR,WARN,INFO" />     <param name="xmlBlaster/invalidate"         	VALUE="false" />
> 
> But nothing worked.
> Can you explain me how to do it?
> 
> Thanks in advanced,
> Best regards,
> Eduardo
> 
> 
> PS: Did you take a look about the DB drivers question?
> 
> -----Original Message-----
> From: owner-xmlblaster at server.xmlBlaster.org [mailto:owner-xmlblaster at server.xmlBlaster.org] On Behalf Of Michele Laghi
> Sent: segunda-feira, 2 de Janeiro de 2006 21:07
> To: xmlblaster at server.xmlBlaster.org
> Subject: Re: FW: FW: [xmlblaster] session object erased????
> 
> 
> Hi Eduardo,
> the flag is handled in the following lines: (current svn code):
> 
> XmlBlasterAccessRaw.java:86
> XmlBlasterAccessRaw.java:87
> ./org/xmlBlaster/protocol/http/BlasterHttpProxyServlet.java:151
> ./org/xmlBlaster/protocol/http/BlasterHttpProxyServlet.java:152
> ./org/xmlBlaster/protocol/http/BlasterHttpProxyServlet.java:154
> ./org/xmlBlaster/protocol/http/appletproxy/AppletServlet.java:224
> ./org/xmlBlaster/protocol/http/appletproxy/AppletServlet.java:225
> 
> Regards
> Michele
> 
> 
> Eduardo Catarino wrote:
>> Hi Marcel,
>>
>> 	I've been reading the code for XmlBlasterAccessRawBase and XmlBlasterAccessRaw and I didn't see any place where the "xmlBlaster/invalidate" is initialized so even if I pass this parameter during the applet initialization this parameter is not passed to the session. 
>>       Can you take a look? 
>>
>> Best regards,
>> Eduardo Catarino
>>
>> -----Original Message-----
>> From: Eduardo Catarino 
>> Sent: sexta-feira, 30 de Dezembro de 2005 9:48
>> To: 'xmlblaster at server.xmlBlaster.org'
>> Subject: RE: FW: [xmlblaster] session object erased????
>>
>> Hi Marcel,
>>
>> 	I added the parameter in the web.xml of my application but the results are the same. I still get my object session erased and replaced by a new one. 
>>       Any other idea?
>>
>> Happy new year,
>> 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: sexta-feira, 23 de Dezembro de 2005 19:10
>> To: xmlblaster at server.xmlBlaster.org
>> Subject: Re: FW: [xmlblaster] session object erased????
>>
>> Eduardo Catarino wrote:
>>> Hi Marcel,
>>>
>>> 	After looking again I tried the following change in the getParameter method of AppletServlet.java:
>>>
>>>    public static final String getParameter(HttpServletRequest req, String name, String defaultVal) {
>>>       if (name == null) {
>>>          return defaultVal;
>>>       }
>>>       
>>> 	//////////Old line////////////////////////////////////////
>>> 	// Object obj = req.getParameter(name);
>>> 	/////////////////////////////////////////////////
>>>
>>> 	////New line
>>> 	Object obj = req.getSession(false).getAttribute(name);
>>>
>>>       if (obj != null) {
>>>          return (String)obj;
>>>       }
>>>       return defaultVal;
>>>    }
>>>
>>> In this way I can in runtime add an attribute to the session object
>>>
>>> 	session.setAttribute("xmlBlaster/invalidate","false");
>>>
>>> and solve the problem in a clear way. 
>>> Is there any other way to do it?
>>>   
>> I think you can set this already in
>>  xmlBlaster/demo/http/WEB-INF/web.xml:
>>
>> <servlet>
>>  <servlet-name>AppletServlet</servlet-name>
>>  <description>Persistent HTTP connection demo servlet</description>
>>   
>> <servlet-class>org.xmlBlaster.protocol.http.appletproxy.AppletServlet</servlet-class>
>>   <init-param>
>>     <param-name>xmlBlaster/invalidate </param-name>
>>     <param-value>false</param-value>
>>   </init-param>
>>   ...
>>
>>
>>> If not will, the code, be changed in a future version? 
>>>   
>> If you send a patch with xmlBlaster  extensions we usually add it (if it 
>> makes sense :-)
>> but in this case i don't think its necessary?
>>
>> regards
>> Marcel
>>> Best regards,
>>> Eduardo
>>>
>>>
>>>
>>>
>>> Hi Marcel,
>>>
>>>
>>> 	After looking into the code of XmlBlasterAccessRaw.java I tried to add the following line to the applet parameters:
>>>
>>>      <param name="xmlBlaster/invalidate"                          VALUE="false" />
>>>
>>> But the problem remains. Any tips?
>>>
>>> Best regards,
>>> Eduardo
>>>
>>> -----Original Message-----
>>> From: Eduardo Catarino 
>>> Sent: quarta-feira, 21 de Dezembro de 2005 14:46
>>> To: 'xmlblaster at server.xmlBlaster.org'
>>> Subject: RE: [xmlblaster] session object erased????
>>>
>>> I Marcel,
>>>
>>> 	I take a look into the AppletServlet.java and added the following lines just to see what was happening:
>>>
>>>          boolean invalidate = getParameter(req, "xmlBlaster/invalidate", false);
>>>
>>> 	 log.info(ME,"GET PARAMETER -> " + req.getParameter("xmlBlaster/invalidate"));
>>> 	 log.info(ME,"GET URI -> " + req.getRequestURI());
>>> 	 log.info(ME,"GET PARAMETER -> " + (String)req.getParameter("xmlBlaster/invalidate"));
>>> 	 log.info(ME,"GET RESULT INV -> " + invalidate);
>>>          if (invalidate == true) {
>>>
>>>             log.info(ME, "Entering servlet 	doGet("+I_XmlBlasterAccessRaw.CONNECT_NAME+"), forcing a new sessionId");
>>>             session.invalidate();   // force a new sessionId
>>>          }
>>>          session = req.getSession(true);
>>>       }
>>>
>>>
>>> And the feedback was:
>>>
>>> [21/Dez/2005 14:35:22 INFO  http-8080-Processor24 org.xmlBlaster.protocol.http.appletproxy.AppletServlet-127.0.0.1-#1req3-dummyToCreateASessionId] GET PARAMETER -> null
>>> [21/Dez/2005 14:35:22 INFO  http-8080-Processor24 org.xmlBlaster.protocol.http.appletproxy.AppletServlet-127.0.0.1-#1req3-dummyToCreateASessionId] GET URI -> /Liaison/XMLBlaster/AppletServlet
>>> [21/Dez/2005 14:35:22 INFO  http-8080-Processor24 org.xmlBlaster.protocol.http.appletproxy.AppletServlet-127.0.0.1-#1req3-dummyToCreateASessionId] GET PARAMETER -> null
>>> [21/Dez/2005 14:35:22 INFO  http-8080-Processor24 org.xmlBlaster.protocol.http.appletproxy.AppletServlet-127.0.0.1-#1req3-dummyToCreateASessionId] GET RESULT INV -> false
>>>
>>>
>>> The page that where I use the xmlblaster applet is called like this:
>>>
>>>         <frame name="alerts" src="../XMLBlaster/operationalAlertScreen.jsp?ActionType=login&xmlBlaster/loginName=operationalAlert&xmlBlaster.passwd=operationalAlert&xmlBlaster/invalidate=false" scrolling="no" target="_self">
>>>
>>>
>>> Additionally I checked in the beginning of the page the contents of the xmlBlaster/invalidate and saw that was false.
>>>
>>> So I'm thinking that I'm passing this parameter in the wrong way. But how can I initialize the AppletServelet in a proper way?
>>>
>>> Best regards,
>>> Eduardo
>>>
>>>
>>>
>>>  
>>>
>>> -----Original Message-----
>>> From: owner-xmlblaster at server.xmlBlaster.org [mailto:owner-xmlblaster at server.xmlBlaster.org] On Behalf Of Marcel Ruff
>>> Sent: terça-feira, 20 de Dezembro de 2005 17:28
>>> To: xmlblaster at server.xmlBlaster.org
>>> Subject: Re: [xmlblaster] session object erased????
>>>
>>> Eduardo Catarino wrote:
>>>   
>>>> Hi Marcel,
>>>>
>>>> 	I changed the '.' to '/' but the results are the same. The data previously saved is erased. 
>>>>   
>>>>     
>>> Hi again,
>>>
>>> please us a debugger and debug into
>>>
>>>    
>>> xmlBlaster/src/java/org/xmlBlaster/protocol/http/appletproxy/AppletServlet.java
>>>
>>> the important parts to watch are
>>>
>>>   req.getSession(true);
>>>   ...
>>>   session.invalidate();   // force a new sessionId
>>>
>>> this code forces under some circumstances a new session,
>>> you should see immediately what is going on,
>>>
>>> regards
>>> Marcel
>>>   
>>>> I launch the applets page like this:
>>>>
>>>>
>>>> ----------------------Start-------------------------------
>>>> <%
>>>> 	session.putValue("xmlBlaster/invalidate", "false");
>>>> 	session.putValue("xmlBlaster/loginName", "eduardo");
>>>> 	session.putValue("xmlBlaster/passwd", "secret");
>>>> %>
>>>> <html>
>>>>
>>>> <head>
>>>> <title>LIAISON</title>
>>>> <base target="_self">
>>>> </head>
>>>>
>>>> <frameset framespacing="0" border="0" frameborder="0" rows="119,*">
>>>> 		<frame name="main" src="second_top.jsp" scrolling="no" target="indice" noresize>
>>>> <frameset cols="460,*" framespacing="2" border="1" frameborder="1">     
>>>>       <frameset rows="33%,33%,34%">
>>>>         <frame name="alerts" src="../XMLBlaster/operationalAlertScreen.jsp" scrolling="no" target="_self">
>>>>         <frame name="alert" src="../XMLBlaster/systemAlertScreen.jsp " scrolling="no" target="_self">
>>>>         <frame name="freeText" src="../XMLBlaster/freeTextScreen.jsp " scrolling="no" target="_self">
>>>>       </frameset>
>>>> 	  <frame name="main" src="" 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>
>>>>
>>>> 	Am I doing something wrong? After the servelet is initialized the others variables, for example I have a variable that stores the application language, are changed to null.
>>>>
>>>> Thanks in advanced,
>>>> And best regards to all,
>>>> Eduardo	
>>>>
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: owner-xmlblaster at server.xmlBlaster.org
>>>> [mailto:owner-xmlblaster at server.xmlBlaster.org] On Behalf Of Marcel Ruff
>>>> Sent: segunda-feira, 19 de Dezembro de 2005 16:09
>>>> To: xmlblaster at server.xmlBlaster.org
>>>> Subject: Re: [xmlblaster] session object erased????
>>>>
>>>> Eduardo Catarino wrote:
>>>>   
>>>>     
>>>>> Hi Marcel and to all XmlBlaster Team,
>>>>>
>>>>> Thanks again for answering me so quickly. However I think I didn't put
>>>>>     
>>>>>       
>>>>   
>>>>     
>>>>> well my question. The problem is that when starting the applet a new 
>>>>> object session (Browser) is created and all the data application is 
>>>>> lost. I think is the xmlblater servelet that changes the session 
>>>>> object. I read in the requirements that the xmlbaster servelet should 
>>>>> be called before any other servelet to prevent this kind of problems.
>>>>>
>>>>> My question is, what should I do in order to xmlblaster applet do not 
>>>>> change the session object when it is initialized?
>>>>>
>>>>>     
>>>>>       
>>>> We use in AppletServlet.java this code:
>>>>
>>>> boolean invalidate = getParameter(req, "xmlBlaster/invalidate", false);
>>>>
>>>> Try to replace the '.' with a '/', this should help,
>>>>
>>>> regards
>>>> Marcel
>>>>   
>>>>     
>>>>> Best regards to all,
>>>>>
>>>>> Eduardo Catarino
>>>>>
>>>>>
>>>>>     
>>>>>       
>>>> ------------------------------------------------------------------------
>>>>   
>>>>     
>>>>> *From:* owner-xmlblaster at server.xmlBlaster.org 
>>>>> [mailto:owner-xmlblaster at server.xmlBlaster.org] *On Behalf Of *Eduardo
>>>>>     
>>>>>       
>>>>   
>>>>     
>>>>> Catarino
>>>>> *Sent:* sexta-feira, 16 de Dezembro de 2005 13:43
>>>>> *To:* xmlblaster at server.xmlBlaster.org
>>>>> *Subject:* [xmlblaster] session object erased????
>>>>>
>>>>> Hello to all,
>>>>>
>>>>> I've developed an applet using the xmlblaster lib for applets I'm now 
>>>>> facing a problem. When the applet is integrated in the real 
>>>>> environment that uses the session object to store application data the
>>>>>     
>>>>>       
>>>>   
>>>>     
>>>>> applet seems to create a new session object and erases all the data 
>>>>> that was previously stored. I have been searching in the requirements 
>>>>> and tried to use the following code:
>>>>>
>>>>> session.putValue("xmlBlaster.invalidate", "false");
>>>>>
>>>>> session.putValue("xmlBlaster.loginName", "eduardo");
>>>>>
>>>>> session.putValue("xmlBlaster.passwd", "secret");
>>>>>
>>>>> in order to prevent this from happening. However this didn't solve the
>>>>>     
>>>>>       
>>>>   
>>>>     
>>>>> problem.
>>>>>
>>>>> Can someone give me a tip how to solve this?
>>>>>
>>>>> Merry Christmas and a Happy new year for all the xmlblaster team.
>>>>>
>>>>>     
>>>>>       
>>>>   
>>>>     
>>>
>>>   
>>
>>
>>
> 
> 
> 
>