cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Klein" <kle...@web.de>
Subject Re: Actions and Session
Date Tue, 16 Sep 2003 07:39:20 GMT
Giancarlo,

the SessionModule that you access by {session:...} only provides general info about the session
like session-id etc. You need to use the SessionAttributeModule to access  attributes. like
your username. Use {session-attr:username} instead (if you haven't changed the module name
to something else than "session-attr" in your cocoon.xconf which I suppose you haven't)

Stefan



users@cocoon.apache.org schrieb am 15.09.03 16:32:50:

Hi,

I'm just trying to figure out the differences between Parameter and 
ObjectModelHelper; using authentication framework with 
DatabaseAuthenticatorAction, i put a var (username) into session:
<select dbcol="username" request-param="username" to-session="username"/>
Then i try to access this var in an action, but i don't know where to find 
it; in my sitemap i use <map:parameter name="username" 
value="{session:username}"/>, but session var username is empty.
Here is my sitemap:

	<map:resources>
		<map:resource name="composite">
			<map:act type="checkstatus">
				<map:parameter name="id" value="{session:id}"/>
				<map:parameter name="username" value="{session:username}"/>
				<map:aggregate element="site">
					<map:part src="cocoon:/menu/{../../0}"/>
					<map:part src="cocoon:/content/{../../0}" label="content"/
>
				</map:aggregate>
				<!-- nella trasformazione, viene passata l'informazione sullo 
stato della connessione -->
				<map:transform src="style/site2html.xsl">
					<map:parameter name="status" value="{status}"/>
				</map:transform>
				<map:serialize/>
			</map:act>
		</map:resource>
	</map:resources>
	<!-- ========= -->
	<!-- PIPELINES -->
	<!-- ========= -->
	<map:pipelines>
		<map:component-configurations>
			<authentication-manager>
				<handlers>
					<handler name="login_handler">
						<redirect-to uri="cocoon://login"/>
						<authentication uri="cocoon:/authenticate"/>
					</handler>
				</handlers>
			</authentication-manager>
			<global-variables/>
		</map:component-configurations>
		<map:pipeline>
			<map:match pattern="">
				<map:redirect-to uri="login"/>
			</map:match>
			<map:match pattern="login">
				<map:act type="auth-loggedIn">
					<map:parameter name="handler" value="login_handler"/>
					<map:redirect-to uri="home"/>
				</map:act>
				<map:call resource="composite"/>
			</map:match>
			<map:match pattern="do-login">
				<map:act type="auth-login">
					<map:parameter name="handler" value="login_handler"/>
					<map:parameter name="parameter_name" value="{request-
param:username}"/>
					<map:parameter name="parameter_password" value="{request-
param:password}"/>
					<map:redirect-to uri="home"/>
				</map:act>
				<!-- in caso di errore redirige su login ancora -->
				<map:redirect-to uri="auth_err"/>
			</map:match>
			<map:match pattern="home">
				<map:act type="auth-protect">
					<map:parameter name="handler" value="login_handler"/>
					<map:call resource="composite"/>
				</map:act>
				<!-- in caso di errore redirige su login ancora -->
				<map:redirect-to uri="login"/>
			</map:match>
			<map:match pattern="do-logout">
				<map:act type="auth-protect">
					<map:parameter name="handler" value="login_handler"/>
					<map:act type="auth-logout"/>
				</map:act>
				<map:redirect-to uri="login"/>
			</map:match>
			<map:match pattern="auth_err">
				<map:call resource="composite"/>
			</map:match>
		</map:pipeline>
		<map:pipeline internal-only="true">
			<map:match pattern="content/login">
				<map:generate src="content/static/index.xml"/>
				<map:serialize/>
			</map:match>
			<map:match pattern="menu/login">
				<map:generate src="content/static/menu.xml"/>
				<map:transform src="style/menu2html.xsl"/>
				<map:serialize/>
			</map:match>
			<map:match pattern="content/auth_err">
				<map:generate src="content/static/auth_err.xml"/>
				<map:serialize/>
			</map:match>
			<map:match pattern="menu/auth_err">
				<map:generate src="content/static/menu.xml"/>
				<map:transform src="style/menu2html.xsl"/>
				<map:serialize/>
			</map:match>
			<map:match pattern="content/*">
				<map:generate type="serverpages" src="content/dynamic/
index.xsp"/>
				<map:serialize/>
			</map:match>
			<map:match pattern="menu/*">
				<map:generate type="serverpages" src="content/dynamic/
menu.xsp"/>
				<map:transform src="style/menu2html.xsl">
					<map:parameter name="status" value="{status}"/>
				</map:transform>
				<map:serialize/>
			</map:match>
			<map:match pattern="authenticate">
				<map:act type="db-authenticator">
          <map:parameter name="descriptor" value="context://content/defs/
auth-def.xml"/>
          <!-- se l'autenticazione ha avuto esito positivo: -->
          <map:generate type="serverpages" src="content/dynamic/
auth_ok.xsp"/>
          <map:serialize type="xml"/>
        </map:act>
        <!-- altrimenti restituisce un messaggio d'errore -->
			</map:match>
		</map:pipeline>
	</map:pipelines>
-- 
Ing. Giancarlo Rosso  
     MCR Srl
 rossog@overweb.it  

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



______________________________________________________________________________
Die Besten ihrer Klasse! WEB.DE FreeMail (1,7) und WEB.DE Club (1,9) -
bei der Stiftung Warentest - ein Doppelsieg! http://f.web.de/?mc=021184


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


Mime
View raw message