cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Liam Morley" <lmor...@WPI.EDU>
Subject RE: session and xsl
Date Fri, 19 Oct 2001 11:10:47 GMT
If you look at the Java API for Cocoon, you'll notice that it has its
own Session object (org.apache.cocoon.environment.Session), which does
not inherit from or otherwise have much to do with
javax.servlet.http.HttpSession other than the fact that they have many
similar methods. (Actually, I didn't look carefully, but I think the
only difference between the two sessions is that Cocoon does not include
the deprecated methods from the original Java implementation.)

I don't know if that helps at all...
Quick links for javadoc:
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/
http://xml.apache.org/cocoon2/apidocs/

Liam Morley

-----Original Message-----
From: Mark S. Kent [mailto:mark.kent@vistyx.com] 
Sent: Thursday, October 18, 2001 2:08 PM
To: cocoon-users@xml.apache.org
Subject: RE: session and xsl

Marty,

I tried your suggestion, but it didn't work.  Although cocoon is seeing
a session, it does not appear to be the same one that Tomcat(?) created
when the user logged in.  I put a "session.getId()" call into my JSP
page and also one in the XML file and both returned different values.

Now, I assumed (and I know what that means!) that since Tomcat created
the session when the user logged in, and Cocoon runs under Tomcat, that
both would be the same.  Not the case.

Can anyone shed light on how these "sessions" are being defined?  From
looking at what "process" is serving the file (Tomcat=JSP, Cocoon=XML),
it seems a new session ID value is created for each one.  Does that
sound right?

Or, is the session ID related to where these files reside within a
folder structure (webapps\myapp vs. webapps\cocoon) and each call to a
different "alias" in apache starts a new session?  I'm confused. I
thought Tomcat was handling them all.

Mark

-----Original Message-----
From: Marty McClelland [mailto:mmcclelland@eduprise.com]
Sent: Thursday, October 18, 2001 9:19 AM
To: cocoon-users@xml.apache.org
Subject: RE: session and xsl


I use C1.8.2 and have the following code to access the session:
<xsp:logic>HttpSession theUserSession = request.getSession(); 
String theLoginName = (String) theUserSession.getAttribute("loginName");
</xsp:logic>

marty 

> -----Original Message-----
> From: Mark S. Kent [mailto:mark.kent@vistyx.com]
> Sent: Tuesday, October 16, 2001 3:06 PM
> To: cocoon-users@xml.apache.org
> Subject: RE: session and xsl
> 
> 
> This is what I have in C1 in my XSP code:
> 
> <xsp:logic>
>     EmployeeData employeeData = null;
>     try
>     {
>       employeeData = (EmployeeData)session.getAttribute( "employee" );
>     }
>     catch( ClassCastException e ) {}
> 
>     Integer empID = null;
>     if( employeeData != null )
>     {
>       System.out.println( "Data ID: " + 
> employeeData.getEmployee_id() );
>       empID = employeeData.getEmployee_id();
>     }
>     else
>     {
>       System.out.println( "Data ID: none" );
>       empID = new Integer( -1 );
>     }
> </xsp:logic>
> 
> The line:
> 
>       employeeData = (EmployeeData)session.getAttribute( "employee" );
> 
> is exactly how I do it in my JSP pages.  When I test for "null" on the
> employeeData object, however, it is always "null".  It may be a C1
> limitation.  We are looking at C2 because of the additional features.
> 
> Is there a "request" object for the session variable?  
> Currently I retrieve
> session variables as above and have only done "requests" for form/URL
> variables.
> 
> Mark
> 
> -----Original Message-----
> From: Christian Haul [mailto:haul@dvs1.informatik.tu-darmstadt.de]
> Sent: Tuesday, October 16, 2001 1:35 PM
> To: cocoon-users@xml.apache.org; Mark Kent
> Subject: Re: session and xsl
> 
> 
> On 16.Oct.2001 -- 09:14 AM, Mark S. Kent wrote:
> > I also have an interest on retrieving session values in my 
> XML file to
> help
> > build the XML data.  I thought that XSP would be able to 
> read them as my
> JSP
> > pages do since both run under Tomcat, but am having trouble 
> seeing them
> from
> > the XML document.
> 
> Mark, accessing session attributes from XSP ist piece of cake :-)
> There's a logicsheet aka taglib for it. Otherwise use the request
> object and access the data through ordinary java.
> 
> > Chris, is the solution you mention below only available in C2?
> 
> Which one of the two alternatives? Honestly, I don't know about C1,
> there might be a session taglib but passing parameters from a non
> existant sitemap won't do :-)
> 
> 
> > From: Christian Haul [mailto:haul@dvs1.informatik.tu-darmstadt.de]
> > On 15.Oct.2001 -- 04:35 PM, Mohamed Ramzy wrote:
> > > hi all,
> > > i'm trying to read session variables through .xsl
> > > file, if you have any idea how to do that, please tell
> >
> > No way. At least from a stylesheet. Pass parameters from sitemap
> > instead. For a taglib, just use session taglib within your taglib.
> 
> 	Chris.
> 
> --
> C h r i s t i a n       H a u l
> haul@informatik.tu-darmstadt.de
>     fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08
> 
> 
> ---------------------------------------------------------------------
> 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>
> 
> 

---------------------------------------------------------------------
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>


---------------------------------------------------------------------
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