Finally I can said:

IT WORKS!

Please tell me to whom I need to send my 2 cents (4 days and almost his nights 
of work).

I modified the files:

XSPSessionHelper.java
Session.xsl

And I can said that now it works, again.

Many thanks to Carsten and Gritsenko. They give me tips to get into the 
sources and the architecture inside Cocoon to write this new tag that I am 
sure many people will welcome.

Antonio Gallardo.

El Jueves, 26 de Septiembre de 2002 03:50, Antonio Gallardo Rivera escribió:
> I will try to explain how far I am now in the building of the
> <xsp-session:getxml> for XSP.
>
> As I said I was researching about that, now I can get the values of the
> "authentication" context.
>
> In XSP we can use:
> Namespace: xmlns:xsp-session="http://apache.org/xsp/session/2.0";
>
> 2-Add imports:
> <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>
>
> 3- Logic inside the xsp:page:
>
> <xsp:logic>
> SimpleSessionContext a =
> ((SimpleSessionContext)<xsp:expr><xsp-session:get-attribute
> name="org.apache.cocoon.webapps.authentication.SessionContext"/></xsp:expr>
>); DocumentFragment b = a.getXML("/");
> String d = DOMUtil.createText(b);
> </xsp:logic>
>
> Only for test I used, and it gets the values I need.
>
> <xsp:expr>b</xsp:expr>
>
> After it returns I saw in the generated HTML that there is only one
> context.
>
> <myhandler>
> <authentication>
> <ID>1</ID>
> <role>myrole</role>
> <data>
>       <username>My name</username>
>       <birthday></birthday>
>       .....
> </data>
> </authentication>
> </myhandler>
>
> I am also researching about how to get the authentication context because
> there are two attributes and the name of the handler can be diferent as
> long as I know. Then:
>
> A) adding imports
> <xsp:include>java.util.ArrayList</xsp:include>
> <xsp:include>java.util.HashMap</xsp:include>
>
> B) <xsp:logic>
>
> ArrayList al =
> ((ArrayList)<xsp:expr><xsp-session:get-attribute-names/></xsp:expr>);
>
> String al0 = ((String)al.get(0));
> String al1 = ((String)al.get(1));oot node, does anyone know how
> HashMap hs = ((HashMap)<xsp:expr><xsp-session:get-attribute
> name="org.apache.cocoon.webapps.authentication.Handlers"/></xsp:expr>);
>
> With al. I can make use of the attributesnames of the session, after that I
> can get the names using the variables al0 and al1.
>
> al0 is org.apache.cocoon.webapps.authentication.Handlers
> and
> al1 is org.apache.cocoon.webapps.authentication.SessionContext
>
> About al1 is above a litlle explain that can helps to get directly the
> authentication ID using the Strings:
>
> <xsp:logic>
> SimpleSessionContext a =
> ((SimpleSessionContext)<xsp:expr><xsp-session:get-attribute
> name="org.apache.cocoon.webapps.authentication.SessionContext"/></xsp:expr>
>); DocumentFragment b = a.getXML("/myhandler/authentication/ID");
> </xsp:logic>
>
> After this, the variable b has the value of "/authentication/ID".
>
> About al0 (org.apache.cocoon.webapps.authentication.Handlers) it is a
> ArrayList that contains the names of the attributes.
>
> Some examples using
>
> <p>Key: <xsp:expr>hs.keySet()</xsp:expr></p>
> <p>Value: <xsp:expr>hs.values()</xsp:expr></p>
> <p>Attribute: <xsp:expr>hs.values()</xsp:expr></p>
>
> But I cannot take the Session Context. I was thinking in a get how to get
> away the context and just write a tag like:
>
> <xsp-session:getxml path="/myhandler/authentication"/>
>
> Another question: Can we add this new function to the already xsp-session
> logicsheet?
>
> Comments are welcome :)
>
> Antonio Gallardo
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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