vgritsenko 02/02/05 07:08:32
Modified: src/java/org/apache/cocoon/components/language/markup/xsp
XSPSessionHelper.java
src/java/org/apache/cocoon/components/language/markup/xsp/java
session.xsl
Log:
Add get-session-id
Change prefix to xsp-session
Revision Changes Path
1.5 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/XSPSessionHelper.java
Index: XSPSessionHelper.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/XSPSessionHelper.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSPSessionHelper.java 4 Feb 2002 12:22:23 -0000 1.4
+++ XSPSessionHelper.java 5 Feb 2002 15:08:32 -0000 1.5
@@ -73,7 +73,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a>
- * @version CVS $Id: XSPSessionHelper.java,v 1.4 2002/02/04 12:22:23 cziegeler Exp $
+ * @version CVS $Id: XSPSessionHelper.java,v 1.5 2002/02/05 15:08:32 vgritsenko Exp
$
*/
public class XSPSessionHelper {
@@ -81,7 +81,7 @@
* FIXME (VG): Remove
*/
private static final String URI = "http://apache.org/xsp/session/2.0";
- private static final String PREFIX = "session";
+ private static final String PREFIX = "xsp-session";
/**
* Sets the given session attribute value
1.5 +56 -38
xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/session.xsl
Index: session.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/session.xsl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- session.xsl 3 Feb 2002 06:13:26 -0000 1.4
+++ session.xsl 5 Feb 2002 15:08:32 -0000 1.5
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<!--
+
============================================================================
The Apache Software License, Version 1.1
============================================================================
@@ -46,17 +47,16 @@
on behalf of the Apache Software Foundation and was originally created by
Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
-->
<!-- written by Ricardo Rocha "[EMAIL PROTECTED]" -->
<!-- ported by Berin Loritsch "[EMAIL PROTECTED]" -->
-
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsp="http://apache.org/xsp"
- xmlns:session="http://apache.org/xsp/session/2.0">
+ xmlns:xsp-session="http://apache.org/xsp/session/2.0">
+ <!-- *** ServletSession Templates *** -->
<xsl:template match="xsp:page">
<xsl:copy>
@@ -70,25 +70,46 @@
<!-- *** ServletSession Templates *** -->
- <xsl:template match="session:get-attribute">
+ <xsl:template match="xsp-session:get-session-id">
+ <xsl:variable name="as">
+ <xsl:call-template name="value-for-as">
+ <xsl:with-param name="default" select="'string'"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$as = 'string'">
+ <xsp:expr>
+ (XSPSessionHelper.getSessionId(objectModel))
+ </xsp:expr>
+ </xsl:when>
+ <xsl:when test="$as = 'xml'">
+ <!-- <xsp-session:session-id> -->
+ <xsp:element name="xsp-session:session-id">
+ <xsp:logic>
+ (XSPSessionHelper.getSessionId(objectModel))
+ </xsp:logic>
+ </xsp:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="xsp-session:get-attribute">
<xsl:variable name="name">
<xsl:call-template name="value-for-name"/>
</xsl:variable>
-
<xsl:variable name="as">
<xsl:call-template name="value-for-as">
<xsl:with-param name="default" select="'object'"/>
</xsl:call-template>
</xsl:variable>
-
<xsl:variable name="default">
<xsl:call-template name="value-for-default">
</xsl:call-template>
</xsl:variable>
-
<xsl:choose>
<xsl:when test="$as = 'xml'">
- <xsp:element name="session:attribute">
+ <xsp:element name="xsp-session:attribute">
<xsp:expr>
XSPSessionHelper.getSessionAttribute(objectModel,
String.valueOf(<xsl:copy-of select="$name"/>),
@@ -106,7 +127,7 @@
</xsl:choose>
</xsl:template>
- <xsl:template match="session:get-attribute-names">
+ <xsl:template match="xsp-session:get-attribute-names">
<xsl:variable name="as">
<xsl:call-template name="value-for-as">
<xsl:with-param name="default" select="'array'"/>
@@ -119,10 +140,10 @@
List v = XSPSessionHelper.getSessionAttributeNames(objectModel);
</xsp:logic>
- <xsp:element name="session:attribute-names">
+ <xsp:element name="xsp-session:attribute-names">
<xsp:logic>
for (int i = 0; i < v.size(); i++) {
- <xsp:element name="session:attribute-name">
+ <xsp:element name="xsp-session:attribute-name">
<xsp:expr>v.get(i)</xsp:expr>
</xsp:element>
}
@@ -138,7 +159,7 @@
</xsl:choose>
</xsl:template>
- <xsl:template match="session:get-creation-time">
+ <xsl:template match="xsp-session:get-creation-time">
<xsl:variable name="as">
<xsl:call-template name="value-for-as">
<xsl:with-param name="default" select="'long'"/>
@@ -147,7 +168,7 @@
<xsl:choose>
<xsl:when test="$as = 'xml'">
- <xsp:element name="session:creation-time">
+ <xsp:element name="xsp-session:creation-time">
<xsp:expr>
new Date(XSPSessionHelper.getSessionCreationTime(objectModel))
</xsp:expr>
@@ -166,7 +187,7 @@
</xsl:choose>
</xsl:template>
- <xsl:template match="session:get-id">
+ <xsl:template match="xsp-session:get-id">
<xsl:variable name="as">
<xsl:call-template name="value-for-as">
<xsl:with-param name="default" select="'string'"/>
@@ -175,7 +196,7 @@
<xsl:choose>
<xsl:when test="$as = 'xml'">
- <xsp:element name="session:id">
+ <xsp:element name="xsp-session:id">
<xsp:expr>XSPSessionHelper.getSessionId(objectModel)</xsp:expr>
</xsp:element>
</xsl:when>
@@ -185,7 +206,7 @@
</xsl:choose>
</xsl:template>
- <xsl:template match="session:get-last-accessed-time">
+ <xsl:template match="xsp-session:get-last-accessed-time">
<xsl:variable name="as">
<xsl:call-template name="value-for-as">
<xsl:with-param name="default" select="'long'"/>
@@ -194,7 +215,7 @@
<xsl:choose>
<xsl:when test="$as = 'xml'">
- <xsp:element name="session:last-accessed-time">
+ <xsp:element name="xsp-session:last-accessed-time">
<xsp:expr>
new Date(XSPSessionHelper.getSessionLastAccessedTime(objectModel))
</xsp:expr>
@@ -213,7 +234,7 @@
</xsl:choose>
</xsl:template>
- <xsl:template match="session:get-max-inactive-interval">
+ <xsl:template match="xsp-session:get-max-inactive-interval">
<xsl:variable name="as">
<xsl:call-template name="value-for-as">
<xsl:with-param name="default" select="'int'"/>
@@ -222,7 +243,7 @@
<xsl:choose>
<xsl:when test="$as = 'xml'">
- <xsp:element name="session:max-inactive-interval">
+ <xsp:element name="xsp-session:max-inactive-interval">
<xsp:expr>
XSPSessionHelper.getSessionMaxInactiveInterval(objectModel)
</xsp:expr>
@@ -242,13 +263,13 @@
</xsl:choose>
</xsl:template>
- <xsl:template match="session:invalidate">
+ <xsl:template match="xsp-session:invalidate">
<xsp:logic>
XSPSessionHelper.invalidateSession(objectModel);
</xsp:logic>
</xsl:template>
- <xsl:template match="session:is-new">
+ <xsl:template match="xsp-session:is-new">
<xsl:variable name="as">
<xsl:call-template name="value-for-as">
<xsl:with-param name="default" select="'boolean'"/>
@@ -258,7 +279,7 @@
<xsp:expr>
<xsl:choose>
<xsl:when test="$as = 'xml'">
- <xsp:element name="session:is-new">
+ <xsp:element name="xsp-session:is-new">
<xsp:expr>XSPSessionHelper.isSessionNew(objectModel)</xsp:expr>
</xsp:element>
</xsl:when>
@@ -274,7 +295,7 @@
</xsp:expr>
</xsl:template>
- <xsl:template match="session:remove-attribute">
+ <xsl:template match="xsp-session:remove-attribute">
<xsl:variable name="name">
<xsl:call-template name="value-for-name"/>
</xsl:variable>
@@ -286,7 +307,7 @@
</xsp:logic>
</xsl:template>
- <xsl:template match="session:set-attribute">
+ <xsl:template match="xsp-session:set-attribute">
<xsl:variable name="name">
<xsl:call-template name="value-for-name"/>
</xsl:variable>
@@ -300,34 +321,31 @@
<xsp:logic>
XSPSessionHelper.setSessionAttribute(objectModel,
String.valueOf(<xsl:copy-of select="$name"/>),
- <xsl:copy-of select="$content"/>
- );
+ <xsl:copy-of select="$content"/>);
</xsp:logic>
</xsl:template>
- <xsl:template match="session:set-max-inactive-interval">
+ <xsl:template match="xsp-session:set-max-inactive-interval">
<xsl:variable name="interval">
<xsl:choose>
<xsl:when test="@interval">"<xsl:value-of
select="@interval"/>"</xsl:when>
- <xsl:when test="session:interval">
+ <xsl:when test="xsp-session:interval">
<xsl:call-template name="get-nested-content">
- <xsl:with-param name="content" select="session:interval"/>
+ <xsl:with-param name="content" select="xsp-session:interval"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsp:logic>
- request.getSession().setMaxInactiveInterval(
- Integer.parseInt(
- String.valueOf(<xsl:copy-of select="$interval"/>)
- ));
+ XSPSessionHelper.setSessionMaxInactiveInterval(objectModel,
+ Integer.parseInt(String.valueOf(<xsl:copy-of select="$interval"/>)));
</xsp:logic>
</xsl:template>
<!-- encode an URL with the session ID -->
- <xsl:template match="session:encode-url">
+ <xsl:template match="xsp-session:encode-url">
<xsl:variable name="href">"<xsl:value-of
select="@href"/>"</xsl:variable>
@@ -343,7 +361,7 @@
</xsl:template>
<!-- encode an URL with the session ID as a form-->
- <xsl:template match="session:form-encode-url">
+ <xsl:template match="xsp-session:form-encode-url">
<xsl:variable name="action">"<xsl:value-of
select="@action"/>"</xsl:variable>
<xsl:variable name="method">"<xsl:value-of
@@ -368,12 +386,13 @@
</xsp:element>
</xsl:template>
+
<xsl:template name="value-for-name">
<xsl:choose>
<xsl:when test="@name">"<xsl:value-of select="@name"/>"</xsl:when>
- <xsl:when test="session:name">
+ <xsl:when test="xsp-session:name">
<xsl:call-template name="get-nested-content">
- <xsl:with-param name="content" select="session:name"/>
+ <xsl:with-param name="content" select="xsp-session:name"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
@@ -409,5 +428,4 @@
<xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
-
</xsl:stylesheet>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]