cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefano Bonnin" <s...@libero.it>
Subject Cocoon & Session
Date Wed, 13 Mar 2002 14:43:43 GMT
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>


Mime
View raw message