cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <vadim.gritse...@verizon.net>
Subject RE: Cocoon & Session
Date Wed, 13 Mar 2002 15:04:32 GMT
Use org.apache.cocoon.environment.Session instead of HttpSession.

See samples:

http://cvs.apache.org/viewcvs.cgi/xml-cocoon2/src/webapp/docs/samples/xs
p/sessionpage.xsp?rev=1.2&content-type=text/vnd.viewcvs-markup

http://cvs.apache.org/viewcvs.cgi/xml-cocoon2/src/webapp/docs/samples/xs
p/session.xsp?rev=1.4&content-type=text/vnd.viewcvs-markup

And documentation:

http://cvs.apache.org/viewcvs.cgi/xml-cocoon2/src/documentation/xdocs/us
erdocs/xsp/session.xml?rev=1.5&content-type=text/vnd.viewcvs-markup

(Note that these files are from latest Cocoon, and had changed since
last Cocoon release. For example, create-session="true" attribute on
xsp:page element was introduced after Cocoon 2.0.1 release and will be
included into Cocoon 2.0.2 release)

Vadim

> -----Original Message-----
> From: Stefano Bonnin [mailto:shpr@libero.it]
> Sent: Wednesday, March 13, 2002 9:44 AM
> To: cocoon-users@xml.apache.org
> Subject: Cocoon & Session
> 
> Hi,
> 
> I have an old C1 application where I use the HttpSession interface.
> 
> I'd like to adapt this application to C2 but when I run it on C2 I
receive
> an
> "HttpSession not found" error.
> 
> 
> Now, this application works with C1.
> How can I resolve this error?
> 
> This is my xsp document:
> 
> *******************
> <?xml version="1.0"?>
> <xsp:page
>  language="java"
>  xmlns:xsp="http://apache.org/xsp"
>  xmlns:xi="http://www.w3.org/2001/XInclude">
> 
> <xsp:structure>
>  <xsp:include>java.text.*</xsp:include>
>  <xsp:include>smit.vmi.ConfVmi</xsp:include>
>  <xsp:include>smit.vmi.UserProfile</xsp:include>
>  <xsp:include>smit.vmi.util.*</xsp:include>
> </xsp:structure>
> 
> <xsp:logic>
>  ConfVmi vmiProperties = new ConfVmi();
>  String ipAddress = vmiProperties.getProperty("address");
> </xsp:logic>
> 
> <page>
> <xsp:logic>
>         VMIdbProperty map = new VMIdbProperty();
>         UserProfile userP = new UserProfile();
>         userP.initUser(request.getParameter("user"),
> request.getParameter("password"),map);
> 
>  if (userP.userFound()) {
>  //Session initialization
>  try {
>                 boolean set = false;
>                 Date date = new Date();
>   long millisecond = date.getTime();
>   HttpSession ses = request.getSession(true); // here here here
*******
>                 ses.setMaxInactiveInterval(500);
>
System.out.println("=====>>>"+ses.getMaxInactiveInterval());
>    if ((ses.isNew()) &amp;&amp;
> (request.getParameter("user").compareTo("root") != 0)) {
>    if ((millisecond - userP.getUserSessionTime()) >
> ses.getMaxInactiveInterval()*1000) {
>     userP.setUserSessionTime(millisecond);}
>    else {
>                         set = true;
>    response.sendRedirect(response.encodeURL("error/moreses.xml"));
>                         ses.invalidate();}
>   }
>                 if (!set) {
>   System.out.println("VMI>>> User Session =
"+request.getSession().getId());
>   ses.setAttribute("Profile", userP);
>   response.sendRedirect(response.encodeURL("select_services.xml"));
>                 }
>           }
>   catch(Exception e) {
>                 System.out.println("ERRORE: "+e.getMessage());
>   System.out.println("Fatal Error");
>   }
>  }
> else
{response.sendRedirect(response.encodeURL("error/introerror.xml"));
> }
> </xsp:logic>
> </page>
> </xsp:page>
> **************
> 
> 
> ---
> Outgoing mail is certified Virus Free. (CopyRight FLASHH!)
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.330 / Virus Database: 184 - Release Date: 28/02/02
> 
> 
> ---------------------------------------------------------------------
> 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