cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Parolini" <t...@employer.com.br>
Subject RE: Cocoon and threads
Date Fri, 01 Jun 2001 20:13:53 GMT
> Could you put the code in your mail where you retrieve the session object
> itself?

I made a logicsheet for this. It declare the DBUser object.

<!--
  ******************************************************************** -->
<!--	Create and set a DBUser to the correct user if connected-->
<xsl:template match="tlsystem:GetUser">
	<xsp:logic>
		// Define a initial default user that is anonymous
		 XUser DBUser = new XUser() ;
		<!--If the cast is not correct, the page have been recompiled -->
		<!-- So we do a logoff and we ask for restart tomcat-->
		if ((session.getAttribute("user") != null) &amp;&amp;
(!(session.getAttribute("user") instanceof XUser)))
		{
			session.removeAttribute("user") ;
			<xsp:content>Error: Need  to Restart Tomcat!</xsp:content>
		}
		else
		{	<!-- Testing if the user is logged -->
			if ((session.getAttribute("user") != null) )
			{
				DBUser = (XUser) session.getAttribute("user") ;
			}
		}
	</xsp:logic>
</xsl:template>


then I use it like
<page>
	<tlsystem:GetUser/>
	Welcome <xsp:expr>DBUser.name</xsp:expr>
	Your employee number is <xsp:expr>DBUser.ID</xsp:expr>
</page>


> Pages aren't synchronized because this introduces a bottleneck,
> and because they don't need to be. Just be carefull with your variable
> declarations.

If the pages aren't synchronized, i'm curious to now how you declare and use
your classes variables in a thread safe manner.

-tony


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message