You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ed Wolpert <wo...@radiancegroup.com> on 2000/02/02 00:19:29 UTC

Session Created by XSP? [was RE: redirect]

I just updated my system to try this... but I got behavior that I didn't
expect. Basically, if the user's session doesn't exist (timeout, not 
created,etc) I want to redirect. The XSP technique to redirect works, 
however, now it seems that the session is created after the redirection. 
Does this sound correct? (Is this a feature versus bug versus user error)


-----Original Message-----
From: Mike Engelhart [mailto:mengelhart@earthtrip.com]
Sent: Tuesday, February 01, 2000 4:11 PM
To: cocoon-users@xml.apache.org
Subject: Re: redirect


Ed Wolpert wrote:

> I think I found a bug... I tried the same as below, (Going to
> http://www.yahoo.com/ instead...)
> and I got:
> java.lang.Exception: XSP Java Compiler: Compilation failed for
> _testthis.java
> 23: Type expected.
> response.sendRedirect("http://www.yahoo.com/");
> ^
> 1 error
> 

I just wrote this which works fine. make sure you don't have an old class
file in the repository path that is being accessed:

<?xml version="1.0"?>

<?cocoon-process type="xsp"?>
<xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core">
    <DOCUMENT>
        <xsp:logic>
            response.sendRedirect("http://www.yahoo.com");
        </xsp:logic>
    </DOCUMENT>
</xsp:page>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org

Re: Session Created by XSP? [was RE: redirect]

Posted by Mike Engelhart <me...@earthtrip.com>.
Ed Wolpert wrote:

> I just updated my system to try this... but I got behavior that I didn't
> expect. Basically, if the user's session doesn't exist (timeout, not
> created,etc) I want to redirect. The XSP technique to redirect works,
> however, now it seems that the session is created after the redirection.
> Does this sound correct? (Is this a feature versus bug versus user error)
I was looking through the source code and unfortunately the xsp-java.xsl
file has the following it in it.   I don't understand why this is there
except so that maybe XSP's have access to the session object but why it
creates one for you I don't understand.

Mike


**********from xsp-java.xl********************
    // Make session object readily available
        HttpSession session = request.getSession(true);

        <xsl:for-each
select="/processing-instruction()[not(contains(.,'xsp'))]">
          document.appendChild(
            document.createProcessingInstruction(
              "<xsl:value-of select="name()"/>",
              "<xsl:value-of select="."/>"
            )
          );
        </xsl:for-each>