I had the answer. It is posible. I made a <xsp-session:getxml> to work. It 
takes me like 3 days ans his nights. But it works now!

I will check the lastest CVS and send you the files directly as soon as I can 
. I am happy that someone will use this code. :)

It works with Cocoon 2.1-CVS. edition.

Regards,

Antonio Gallardo



El Miércoles, 02 de Octubre de 2002 04:06, Katzigas Dimitris escribió:
> Hi there,
>
> I want to get the username from the authentication session with which i
> authenticated and use it in a sql query.
> I manage to get the data from the authentication context with some code
> that i added to my
> xsp file that i read in a Antonio's Gallardo Rivera posting.
>
> My xsp file is:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <xsp:page
>           language="java"
>           xmlns:xsp="http://apache.org/xsp";
>           xmlns:xsp-request="http://apache.org/xsp/request/2.0";
>           xmlns:xsp-session="http://apache.org/xsp/session/2.0";
>           xmlns:esql="http://apache.org/cocoon/SQL/v2";>
>
>
> <xsp:structure>
>
> <xsp:include>org.apache.cocoon.webapps.session.context.SimpleSessionContext
>< /xsp:include>
>   <xsp:include>org.w3c.dom.DocumentFragment</xsp:include>
>   <xsp:include>org.apache.cocoon.xml.dom.DOMUtil</xsp:include>
> </xsp:structure>
>
>   <page>
>
>   <xsp:logic>
>     SimpleSessionContext a =
> ((SimpleSessionContext)<xsp:expr><xsp-session:get-attribute
> name="org.apache.cocoon.webapps.auth
> entication.SessionContext"/></xsp:expr>);
>     DocumentFragment uname =
> a.getXML("/atl-handler/authentication/data/username");
>     String d = DOMUtil.createText(uname);
>   </xsp:logic>
>
>     <content>
>       <esql:connection>
>         <esql:driver>oracle.jdbc.driver.OracleDriver</esql:driver>
>         <esql:dburl>jdbc:oracle:thin:@adis:1521:mis</esql:dburl>
>         <esql:username>some_user</esql:username>
>         <esql:password>some_password</esql:password>
>         <esql:execute-query>
>           <esql:query>
>             call
> atl.atlenvpack.set_user(<esql:parameter><xsp:expr>uname</xsp:expr></esql:pa
>r ameter>)
>           </esql:query>
>         </esql:execute-query>
>         <esql:execute-query>
>           <esql:query>
>             select sys_context('ATLENV','CUR_USER',10) username  from dual
>           </esql:query>
>           <esql:results>
>             <esql:row-results>
>               <contcount><esql:get-string column="username"/></contcount>
>             </esql:row-results>
>           </esql:results>
>         </esql:execute-query>
>       </esql:connection>
>
>     </content>
>   </page>
> </xsp:page>
>
> The problem is that the variable "uname" doesn't got a value by the time
> the expression <xsp:expr>uname</xsp:expr> is evaluated.
> This problem occures only if i use the expression
> <xsp:expr>uname</xsp:expr> inside a <esql:connection> tag. If i use it
> somewhere else in the xsp file, i get the username with which i
> authenticated.
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
> For additional commands, e-mail:   <[EMAIL PROTECTED]>

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

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to