RE: session and xsl
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:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 2:08 PM To: [EMAIL PROTECTED] 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:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 9:19 AM To: [EMAIL PROTECTED] Subject: RE: session and xsl I use C1.8.2 and have the following code to access the session: HttpSession theUserSession = request.getSession(); String theLoginName = (String) theUserSession.getAttribute("loginName"); marty > -Original Message- > From: Mark S. Kent [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, October 16, 2001 3:06 PM > To: [EMAIL PROTECTED] > Subject: RE: session and xsl > > > This is what I have in C1 in my XSP code: > > > 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 ); > } > > > 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:[EMAIL PROTECTED]] > Sent: Tuesday, October 16, 2001 1:35 PM > To: [EMAIL PROTECTED]; 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:[EMAIL PROTECTED]] > > 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 > &
Re: session and xsl
Mark: AFAIK, Tomcat does not by default share session across web applications. If you want that, you need Tomcat 4.0 and then you need to put all web applications in the same Realm object. You might want to take a look at the description of the tag in the Tomcat 4.0 documentation. If you don't have it on your machine, you can view mine at http://galatea.com/docs/tomcat40/config/host.html. Look for the section on "Single Sign On". Hope that helps. Lajos galatea.com Mark S. Kent wrote: > 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:[EMAIL PROTECTED]] > Sent: Thursday, October 18, 2001 9:19 AM > To: [EMAIL PROTECTED] > Subject: RE: session and xsl > > > I use C1.8.2 and have the following code to access the session: > HttpSession theUserSession = request.getSession(); > String theLoginName = (String) theUserSession.getAttribute("loginName"); > > > marty > > >>-Original Message- >>From: Mark S. Kent [mailto:[EMAIL PROTECTED]] >>Sent: Tuesday, October 16, 2001 3:06 PM >>To: [EMAIL PROTECTED] >>Subject: RE: session and xsl >> >> >>This is what I have in C1 in my XSP code: >> >> >>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 ); >>} >> >> >>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:[EMAIL PROTECTED]] >>Sent: Tuesday, October 16, 2001 1:35 PM >>To: [EMAIL PROTECTED]; 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 :-) >> >> >> >>>Fro
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:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 9:19 AM To: [EMAIL PROTECTED] Subject: RE: session and xsl I use C1.8.2 and have the following code to access the session: HttpSession theUserSession = request.getSession(); String theLoginName = (String) theUserSession.getAttribute("loginName"); marty > -Original Message- > From: Mark S. Kent [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, October 16, 2001 3:06 PM > To: [EMAIL PROTECTED] > Subject: RE: session and xsl > > > This is what I have in C1 in my XSP code: > > > 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 ); > } > > > 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:[EMAIL PROTECTED]] > Sent: Tuesday, October 16, 2001 1:35 PM > To: [EMAIL PROTECTED]; 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:[EMAIL PROTECTED]] > > 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 > [EMAIL PROTECTED] > 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: <[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/faqs.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/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>
RE: session and xsl
I use C1.8.2 and have the following code to access the session: HttpSession theUserSession = request.getSession(); String theLoginName = (String) theUserSession.getAttribute("loginName"); marty > -Original Message- > From: Mark S. Kent [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, October 16, 2001 3:06 PM > To: [EMAIL PROTECTED] > Subject: RE: session and xsl > > > This is what I have in C1 in my XSP code: > > > 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 ); > } > > > 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:[EMAIL PROTECTED]] > Sent: Tuesday, October 16, 2001 1:35 PM > To: [EMAIL PROTECTED]; 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:[EMAIL PROTECTED]] > > 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 > [EMAIL PROTECTED] > 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: <[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/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>