<!-- Enhydra Java Application Server Copyright 1997-1999 Lutris Technologies, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes Enhydra software developed by Lutris Technologies, Inc. and its contributors. 4. Neither the name of Lutris Technologies nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY LUTRIS TECHNOLOGIES AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LUTRIS TECHNOLOGIES OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> <JDDI JAVAIMPORT> import com.lutris.http.*; import com.lutris.appserver.server.session.*; import demoApp.presentation.utilities.*; import demoApp.DemoApp; </JDDI> <JDDI INCLUDE="../jinc/Setup.jinc"></JDDI> <JDDI JAVADEF> public void CheckCookie(JoltPage page) throws Exception { /* * Check to see if we are authenticated. */ if (page.session.getUser() != null) { page.data.set("isAuthenticated", "true"); page.data.set("sessionCookieValue", page.session.getSessionKey()); } else { page.data.set("isAuthenticated", "false"); } } </JDDI> <JDDI JAVACALL=CheckCookie></JDDI> <HTML> <HEAD> <TITLE>JDDI HTML Example: Restricted Page</TITLE> </HEAD> <JDDI INCLUDE="../jinc/Header.jinc"></JDDI> <BODY> <CENTER> <B><FONT FACE="Arial,Helvetica" SIZE=+3> Restricted Page </FONT></B> </CENTER> </BODY> <JDDI INCLUDE="../jinc/Buttons.jinc"></JDDI> <BODY> <JDDI HTML IFEQ FIELD=isAuthenticated VALUE="true"> <CENTER> <A HREF="HomePage.po" onmouseover="rollOver('Home','../media/home2.gif')" onmouseout="rollOut('Home','../media/home1.gif')"> <IMG SRC="../media/home1.gif" NAME="Home" ALT="Home" BORDER=0></A> </CENTER> </JDDI> <BR> <CENTER> <TABLE COLS=1 WIDTH="60%"> <TR> <TD> <FONT FACE="Arial,Helvetica" SIZE=+1> This page checks session authentication and reports on the validity of your session cookie. </FONT> </TD> </TR> </TABLE> </CENTER> <BR> <JDDI HTML IFEQ FIELD=cgiArgs.help VALUE="on"> <CENTER> <TABLE COLS=1 WIDTH="40%" > <TR> <TD> <FONT FACE="Arial,Helvetica" COLOR=red> The session authentication checking below, is accomplished via embedded Java code that checks for the existence of a session cookie. The cookie is then checked for validity. You can check the source for this file (via the "Source" button above) for the details on how this is done. </FONT> <IMG SRC="../media/arrow.gif" BORDER=0 ANCHOR=BOTTOM ALIGN=LEFT> </TD> </TR> </TABLE> </CENTER> </JDDI> <JDDI HTML IFEQ FIELD=isAuthenticated VALUE="true"> <CENTER> <TABLE COLS=1 WIDTH="60%"> <TR> <TD> <FONT FACE="Arial,Helvetica"> You have a valid session cookie!<P> Your session cookie value is:<P> <CENTER><B><FONT COLOR=red>(@sessionCookieValue@)</FONT></B></CENTER> </FONT> </TD> </TR> </TABLE> </CENTER </JDDI> <BR> <JDDI HTML IFEQ FIELD=isAuthenticated VALUE="false"> <CENTER> <TABLE COLS=1 WIDTH="60%"> <TR> <TD> <FONT FACE="Arial,Helvetica"> You do not have a valid session cookie!<P> Hit the "User Login" button below to login again. </FONT> </TD> </TR> </TABLE> </CENTER <BR><BR> <CENTER> <A HREF="../login/Login.po"> <IMG SRC="../media/miniUserLogin.gif" BORDER=0></A>&nbsp </CENTER> </JDDI> <BR> <JDDI HTML IFEQ FIELD=cgiArgs.help VALUE="on"> <CENTER> <TABLE COLS=1 WIDTH="40%" > <TR> <TD> <FONT FACE="Arial,Helvetica" COLOR=red> You can check to see what happens when you do not have a valid session cookie, by first logging out (via the Logout Page), and then visiting this page again. </FONT> </TD> </TR> </TABLE> </CENTER> </JDDI> <BR> <JDDI INCLUDE="../jinc/VerboseDebug.jinc"></JDDI> </BODY> </HTML>