On 1/9/09, Frank Hamilton <[email protected]> wrote:
> Thanks solprovider,
> I used Lenya 2.0.3 version.
Disclaimer: I have little experience with Lenya 2.
> I think that Read DOM Session Transformer is not valid for resolve my
> problem because I set "MyUser" object in session in a .java class and not
> from the WriteDomSession.
The documentation states, "The ReadDOMSessionTransformer is a
standalone component, you don't need to use it in combination with the
WriteDOMSessionTransformer." You could look at how
WriteDOMSessionTransformer adds objects to the session and use the
same method.
> I think that I need get 'MyUser.getName()' in a pipeline and then get it
> in a xsl file.
> For example, with the "chosenlanguage" parameter:
> "Sitemap.xmap "
> <map:transform
> src="fallback://lenya/modules/sitetree/xslt/navigation/sitetree2nav.xsl"
> label="navtree">
> <map:parameter name="chosenlanguage"
> value="{request-param:language}"/>
> <map:parameter name="defaultlanguage"
> value="{page-envelope:default-language}"/>
> <map:parameter name="extension" value="html"/>
> </map:transform>
> and then in "example.xsl" I can get "choselanguage" parameter:
> <td><input type="text" name="language" value="{$chosenlanguage}"
> size="5"/></td>
Does getName() return the standard Lenya id or name? The
AccessControlInputModule can return those values:
http://solprovider.com/lenya/variablescommon#access-control
> Any ideas are grateful.
Have you researched the SessionModule?
http://cocoon.apache.org/2.1/userdocs/concepts/modules-ref.html#N102E9
Andreas suggests the JXPathMetaModule. Should be similar to the
SessionModule but more generic.
Finally, an XSP is Java code to create XML and so can access any Java
objects to create precisely the XML desired. May not be future-proof
as Cocoon may not support XSPs in releases after 2.1. When I was very
new to Lenya and Cocoon, I created an XSP to add the current visitor's
id, name, email, groups, and roles as XML to add security checks in
XSLTs. (My current work is to integrate language translations and
security so well that everybody can almost forget about them.)
solprovider
> solprovider wrote:
> > You might try the "Read DOM Session Transformer":
> > http://cocoon.apache.org/2.1/userdocs/readdomsession-transformer.html
> >
> > I have not used this Transformer. I created an XSP to generate user
> > information and aggregated for processing with XSL. Better methods
> > are likely.
> >
> > Which version of Lenya is being used? The answer is very likely to
> > affect possible solutions.
> >
> > solprovider
> >
> > On 1/8/09, Frank Hamilton <[email protected]> wrote:
> >> I´m create an usecase that put "myUser" object in to
> >> org.apache.cocoon.environment.Session. This is for my own login task in
> >> Lenya. This usecase create "myUser" object from my own BD (if the user
> >> exist in BD), and put it in Session.
> >>
> >> My question is: Can I get myUser.getName() from session in
> >> page2htmlHome.xsl
> >> (for example)?. I need this to put the name of loger user in the header
> >> of
> >> my publication.
> >>
> >> Thanks, and excuse my poor English.