[cvs] example commit by dlloyd: Initial import of weblog example at
version
JCorporate Ltd
jcorp at jcorporate.com
Thu Jan 13 00:39:03 UTC 2005
Log Message:
-----------
Initial import of weblog example at version 2.01
Added Files:
-----------
example:
build-weblog.xml
example/src:
weblog.jsp
example/src/WEB-INF/config:
weblog-config.xml
example/src/WEB-INF/lib:
readme-directory.txt
example/src/WEB-INF/src/com/jcorporate/expresso/demo/weblog:
WeblogSchema.java
example/src/WEB-INF/src/com/jcorporate/expresso/demo/weblog/controller:
EntryController.java
WlogLogin.java
example/src/WEB-INF/src/com/jcorporate/expresso/demo/weblog/dbobj:
Entry.java
User.java
example/src/expresso/components/weblog:
addEntry.jsp
delete.jsp
frame.jsp
login.jsp
loginSucess.jsp
logout.jsp
processDelete.jsp
putEntry.jsp
standard.inc
test.html
view.jsp
weblog.css
weblog_title.jpg
example/src/expresso/components/weblog/images:
community.gif
expresso_sm.jpg
weblog_title.jpg
Revision Data
-------------
--- /dev/null
+++ build-weblog.xml
@@ -0,0 +1,604 @@
+<!--///////////////////////////////////////////////////////////////////////////
+//
+// Weblog - Main Build Script
+//
+// Necessary software:
+// JDK 1.3 or above
+// Apache Ant 1.5
+// Expresso Source Code
+// Expresso 3rd party libraries
+//
+////////////////////////////////////////////////////////////////////////////-->
+<!DOCTYPE project SYSTEM "./src/WEB-INF/expresso-le/project.dtd">
+<project name="eforum" default="Usage" basedir="./src/">
+ <!-- ===== Enable environment variables =================================== -->
+ <property environment="env"/>
+ <property file="build.properties"/>
+ <!-- ===== Import properties from external properties files ===============
+ By using this file you can freely override any properties contained
+ in this build file for your own uses.
+ -->
+ <property file="${user.home}/build.properties"/>
+ <!-- ===== Set up internal properties ===================================== -->
+ <!-- The following property defines the location of the compiled expresso classes. This is included
+ along with the WEB-INF/lib classes in the compilation classpath
+ -->
+ <property name="expresso.classes.location" value="${basedir}/../../expresso/expresso-web/WEB-INF/classes"/>
+ <property name="expresso.lib.location" value="${basedir}/../../lib/WEB-INF/lib"/>
+ <!-- This points to where the WEB-INF/lib directory is to be used for compilation classpath. The default
+ points to the lib module if you have checked it out with the same root as this project You can
+ override it with your own build.properties file
+ -->
+ <property name="expresso.library" value="./WEB-INF/expresso-le/WEB-INF/lib"/>
+ <property name="app.name" value="weblog"/>
+ <property name="app.version.major" value="2"/>
+ <property name="app.version.minor" value="0"/>
+ <property name="app.version.micro" value="1"/>
+ <property name="app.version.specification" value="${app.version.major}.${app.version.minor}"/>
+ <property name="app.version" value="${app.version.major}-${app.version.minor}${app.version.micro}"/>
+ <!-- Java compiler Settings -->
+ <property name="build.compiler" value="modern"/>
+ <property name="build.debug" value="true"/>
+ <property name="build.deprecation" value="true"/>
+ <property name="build.optimize" value="true"/>
+ <!-- Project Specific Settings -->
+ <property name="weblog.name" value="${app.name}-${app.version}"/>
+ <property name="weblog.build.webinf" value="${basedir}/WEB-INF"/>
+ <property name="weblog.build.dist" value="${basedir}/WEB-INF/dist"/>
+ <property name="weblog.config" value="${weblog.build.webinf}/config"/>
+ <property name="weblog.src" value="${weblog.build.webinf}/src"/>
+ <property name="weblog.web" value="${basedir}/expresso"/>
+ <property name="weblog.component" value="${weblog.web}/components/weblog"/>
+ <property name="weblog.doc" value="${weblog.component}/doc"/>
+ <property name="weblog.javadocs" value="${weblog.component}/javadoc"/>
+ <property name="weblog.build.classes" value="${weblog.build.webinf}/classes"/>
+ <property name="weblog.build.config" value="${weblog.build.webinf}/config"/>
+ <property name="weblog.build.stylesheets" value="${basedir}/src/style"/>
+ <property name="weblog.lib" value="${basedir}/expresso-le/WEB-INF/lib"/>
+ <!--property name="expresso.home" value="${env.EXPRESSO_HOME}"/-->
+ <property name="container.home" value="${env.CATALINA_HOME}"/>
+ <property name="deploydir" value="${container.home}/webapps"/>
+ <!--property name="expresso.build.dist" value="${expresso.home}/expresso/dist"/-->
+ <property name="weblog.build.dist" value="./WEB-INF/dist"/>
+
+ <property name="weblog.war.name" value="${weblog.name}.war"/>
+ <!--property name="expresso.war" value="${expresso.home}/expresso/expresso-web/${app.name}${app.version}-bin.war"/-->
+
+ <!-- Set path to web application container
+ Ant will use this property to locate the servlet.jar file as well as other
+ JAR files that your container makes available. The default configuration
+ is for the Tomcat container, but if you are using a different one such as
+ Orion, Resin or JRun, then you'll need to set this property to point to
+ its home directory.
+ -->
+ <property name="container.home" value="${env.CATALINA_HOME}"/>
+
+ <!-- ==========================================================================
+ Target: Usage
+ Displays a list of targets and explains how to use this build file.
+ ============================================================================-->
+ <target name="Usage" description="Displays Usage Help">
+ <echo><![CDATA[
+===== COMPILING THE SOURCE ========================================
+ant clean : Remove all generated class and jar files, plus
+ all generated documentation.
+ant compile : Compiles the eForum source code
+ant build : First performs a clean, and then a complete rebuild
+ of the eForum source code.
+
+===== ARCHIVING ===================================================
+ant build-all : Runs the "build" target, then creates downloadable
+ distribution as a zip file.
+ant docs : Runs the "dist" target, then creates a WAR
+ file that includes documentation.
+ant src : Builds a JAR file that contains all of the
+ Expresso source code and docs.
+
+===== DOCUMENTATION ===============================================
+ant javadoc : Generates the API documentation.
+ant xmldoc : Generates the Expresso XML documentation.
+
+===== MISCELLANEOUS ===============================================
+ant environment : Display environment variables visible to Ant.
+ ]]></echo>
+ </target>
+ <!--
+ =============================================================
+ Generate the ANT based DTD
+ =============================================================
+ -->
+ <target name="gen-dtd">
+ <antstructure output="project.dtd"/>
+ </target>
+ <!--
+ =============================================================
+ Initialize the build environment
+ =============================================================
+ -->
+ <target name="check_catalina" description="support for tomcat which uses /common directory, as opposed to Resin" >
+ <!-- determine whether catalina is found -->
+ <available file="${container.home}/common/lib/servlet-api.jar" property="haveCatalina" />
+ </target>
+ <target name="add_catalina_path" if="haveCatalina" >
+ <fileset dir="${container.home}/common/lib" id="catpath">
+ <include name="*.jar"/>
+ </fileset>
+ <pathconvert refid="catpath" property="catalina_path" pathsep="${path.separator}" />
+ <property name="catalina_path" value="${catalina_path}" />
+ </target>
+ <target name="empty_catalina_path" unless="haveCatalina" >
+ <property name="catalina_path" value="" />
+ </target>
+ <target name="init" depends="check_catalina,add_catalina_path,empty_catalina_path">
+ <tstamp>
+ <format property="TSTAMP" pattern="h:mma"/>
+ <format property="TODAY" pattern="MMMM d, yyyy"/>
+ </tstamp>
+ <echo>Ant started at ${TSTAMP} on ${TODAY}</echo>
+ <!-- Set up external dependencies
+
+ These properties tell Ant where to find any external JAR files upon
+ which your application might depend. These values will be:
+
+ * Included in the classpath used by the javac compiler.
+
+ * Copied into the "/WEB-INF/lib" directory of your web application
+ during execution of the "dist" target.
+
+ Since all of the Java classes that your web application container
+ exposes will be included automatically in the build classpath, you do
+ not need to explicitly include any of those dependencies. The only
+ JAR's that you need to include are those that are intended to be copied
+ into your application's "/WEB-INF/lib" directory.
+ -->
+ <!--
+ Sample external dependency:
+ <property name="foo.jar"
+ value="/path/to/foo.jar"/>
+ -->
+ <!-- Set up compile classpath
+
+ Ant can dynamically build a customized classpath for each compilation.
+ This is particularly useful for including the servlet.jar file along
+ with all the other JAR files that the web application container
+ exposes. The JAR files that will be copied into your application's
+ "/WEB-INF/lib" directory are also appended to the classpath.
+ -->
+ <path id="compile.classpath">
+ <!-- Include this application's compiled classes -->
+ <pathelement location="${weblog.build.classes}"/>
+ <!-- Include all external dependencies that were set above -->
+ <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
+ <!--
+ <pathelement location="${foo.jar}"/>
+ -->
+ <!-- Include all JAR's that the container exposes to applications -->
+ <pathelement path="${catalina_path}" />
+ <fileset dir="${container.home}">
+ <include name="lib/*.jar" unless="haveCatalina"/>
+ </fileset>
+ <!-- include all the Expresso classes in the classpath -->
+ <pathelement location="${expresso.classes.location}"/>
+ <!-- Include Expresso's internal JAR's -->
+ <fileset dir="${expresso.library}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${weblog.build.webinf}/lib">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+ <fileset id="weblog.resources" dir="${weblog.src}">
+ <include name="**/*.gif"/>
+ <include name="**/*.png"/>
+ <include name="**/*.jpg"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.properties"/>
+ </fileset>
+ <pathconvert pathsep=":" property="buildclasspath" refid="compile.classpath"/>
+ <!-- Determine if JDK 1.4 is being used -->
+ <available classname="java.nio.Buffer" property="jdk14.present"/>
+ </target>
+ <!-- ==========================================================================
+ Target: buildDirs
+ Creates directories used to build Expresso.
+ ============================================================================-->
+ <target name="buildDirs" depends="init">
+ <!--
+ <mkdir dir="${expresso.build}"/>
+ -->
+ <mkdir dir="${weblog.build.webinf}"/>
+ <mkdir dir="${weblog.build.classes}"/>
+ <mkdir dir="${weblog.config}"/>
+ <mkdir dir="${weblog.build.dist}"/>
+ </target>
+ <!-- ==========================================================================
+ Target: compile
+ Reads in source files and converts them into class files suitable for
+ execution by the JVM. This top-level target runs another Ant process
+ to perform the actual work.
+ ============================================================================-->
+ <target name="compile" depends="init, buildDirs, copyResources, checklibs" description="Compile Expresso source">
+ <javac srcdir="${weblog.src}" destdir="${weblog.build.classes}" classpath="${buildclasspath}" debug="${build.debug}" deprecation="${build.deprecation}" optimize="${build.optimize}">
+ <!--compilerarg value="-Xlint:unchecked"/-->
+ </javac>
+ </target>
+ <!-- ================================================================================
+ Copies all the resource files to their target locations
+ -->
+ <target name="copyResources" depends="init">
+ <echo message="Precopying all resource files...."/>
+ <copy todir="${weblog.build.classes}">
+ <fileset refid="weblog.resources"/>
+ </copy>
+ </target>
+ <!--
+ =========================================================================
+ Checks to make sure all required libraries are present and fails if they aren't.
+ ========================================================================
+ -->
+ <target name="checklibs" description="Checks Compilation Classpath" depends="init">
+ <!--available classname="junit.framework.TestCase" property="junit-present" classpathref="compile.classpath"/>
+ <fail message="Unable to locate junit" unless="junit-present"/-->
+ <available classname="org.apache.xerces.parsers.DOMParser" property="xerces-present" classpathref="compile.classpath"/>
+ <fail message="Unable to locate Xerces" unless="xerces-present"/>
+ <available classname="org.apache.xerces.parsers.DOMParser" property="jaxp-present" classpathref="compile.classpath"/>
+ <fail message="Unable to locate Xerces DOM Parser" unless="jaxp-present"/>
+ <available classname="org.apache.log4j.Appender" property="log4j-present" classpathref="compile.classpath"/>
+ <fail message="Unable to locate log4j" unless="log4j-present"/>
+ <!--available classname="javax.crypto.JCEUtil" property="crypto-present" classpathref="compile.classpath"/>
+ <fail message="Unable to locate Java Cryptography Extensions" unless="crypto-present"/>
+ <available classname="org.bouncycastle.jce.provider.BouncyCastleProvider" property="bouncy-present" classpathref="compile.classpath"/>
+ <fail message="Unable to locate Bouncy Castle JCE Provider Run ant get-crypto to download the appropriate jar file" unless="bouncy-present"/>
+ <available classname="javax.naming.Context" property="jndi-present" classpathref="compile.classpath"/>
+ <fail message="Unable to locate JNDI Classes" unless="jndi-present"/-->
+ <available classname="javax.mail.Message" property="javamail-present" classpathref="compile.classpath"/>
+ <fail message="Unable to locate JavaMail Classes" unless="javamail-present"/>
+ <echo message="All 3rd party libraries seem to be in the classpath"/>
+ </target>
+ <!--
+ ===========================================================================================
+ Retrieves the BouncyCastle Crypto Jar and deposits it into the lib directory
+ ===========================================================================================
+ -->
+ <target name="get-crypto" description="Download the bouncy-castle library">
+ <property name="bouncy.filename" value="jce-jdk13-114.jar"/>
+ <property name="expresso.bouncy.url" value="http://www.bouncycastle.org/download/${bouncy.filename}"/>
+ <echo message="Retrieving the BouncyCastle Jar File from ${expresso.bouncy.url}"/>
+ <get src="${expresso.bouncy.url}" dest="${expresso.library}/${bouncy.filename}" verbose="true"/>
+ </target>
+ <!--
+ ===========================================================================================
+ Dumps the current ant build environment to screen.
+ ===========================================================================================
+ -->
+ <target name="environment" depends="init" description="display environment information">
+ <echo><![CDATA[
+ Build ClassPath: ${buildclasspath}
+ app.name: ${app.name}
+ app.version: ${app.version}
+ (Todo - add all the rest of the environment variables here)
+ ]]></echo>
+ </target>
+ <!-- ==========================================================================
+ Target: clean
+ Delete the "dist" and "build" directories so that a recompile will result
+ in a completely fresh build.
+ ============================================================================
+ -->
+ <target name="clean" description="Clean up all compiled classes and documentation">
+ <delete dir="${weblog.build.classes}"/>
+ </target>
+ <!--
+ ==========================================================================
+ Target: build
+ Builds the entire Expresso package. Forces a clean before compiling
+ ============================================================================
+ -->
+ <target name="build" depends="clean, compile" description="Rebuild Expresso Expresso"/>
+ <!--
+ ==========================================================================
+ Target: javadoc
+ This target generates Expresso's Javadoc API documentation.
+ ============================================================================
+ -->
+ <target name="javadoc" description="Build API documentation" depends="init">
+ <mkdir dir="${weblog.javadocs}"/>
+ <javadoc packagelist="${weblog.src}/com/jcorporate/demo/weblog/packagelist" classpath="${buildclasspath}" sourcepath="${weblog.src}" use="true" author="true" destdir="${weblog.javadocs}" protected="true" version="true" doctitle="WebLog version ${app.version}<br>API Specification" windowtitle="WebLog Version ${app.version}" header="<b>eForum ${app.version}</b>" bottom="Please see <a href=http://www.jcorporate.com>www.jcorporate.com<b> for information about new example releases. <hr>">
+ <group title="Database Objects" packages="com.jcorporate.eforum.dbobj"/>
+ <group title="Controllers" packages="com.jcorporate.eforum.controller"/>
+ <group title="Jobs" packages="com.jcorporate.eforum.job"/>
+ <link offline="true" href="http://java.sun.com/j2se/1.3/docs/api/" packagelistloc="expresso/doc/java"/>
+ <link offline="true" href="http://java.sun.com/products/servlet/2.3/javadoc/" packagelistloc="expresso/doc/java/servlet"/>
+ </javadoc>
+ </target>
+ <!--
+ ========================================================================
+ Builds the XML documentation set.
+ ========================================================================
+ -->
+ <target name="xmldocs" depends="init" description="Build XML Documentation">
+ <!-- Build the changelog -->
+ <java classname="org.apache.xalan.xslt.Process" classpath="${buildclasspath}" maxmemory="64m" failonerror="false" fork="true">
+ <arg line=" -IN ${weblog.doc}/changelog.xml -OUT ${weblog.doc}/changelog.html"/>
+ </java>
+ </target>
+ <!--
+ ============================================================================================
+ ********************************************************************************************
+ ============================================================================================
+
+ Targets below this marker should be for final packaging not just compiling
+ ============================================================================================
+ ********************************************************************************************
+ ============================================================================================
+ -->
+ <target name="jar" depends="compile" description="Builds a compiled jar file">
+ <mkdir dir="${weblog.build.webinf}/lib"/>
+ <jar jarfile="${weblog.build.webinf}/lib/weblog.jar" basedir="${weblog.build.classes}">
+ <manifest>
+ <attribute name="Specification-Name" value="${app.name}"/>
+ <attribute name="Specification-Vendor" value="Jcorporate Ltd."/>
+ <attribute name="Specification-Version" value="${app.version.specification}"/>
+ <attribute name="Implementation-Vendor" value="JCorporate Ltd."/>
+ <attribute name="Implementation-Version" value="${app.version.major}.${app.version.minor}.${app.version.micro}"/>
+ </manifest>
+ </jar>
+ </target>
+ <!--
+ ========================================================================
+ Creates the Component src war after doing a complete rebuild
+ ========================================================================
+ -->
+ <target name="src-war" depends="build, javadoc, xmldocs, bld-src-war" description="Build the src war file"/>
+ <!--
+ ========================================================================
+ Creates the Component src war without doing a complete rebuild.
+ ========================================================================
+ -->
+ <target name="bld-src-war" depends="init,buildDirs">
+ <delete file="${weblog.build.dist}/${welog.name}-src.zip" failonerror="false"/>
+ <zip zipfile="${weblog.build.dist}/${weblog.name}-src.zip" basedir="." includes="
+ WEB-INF/*,
+ WEB-INF/bin/**/*,
+ WEB-INF/tld/*.tld,
+ WEB-INF/config/**/*,
+ WEB-INF/src/**,
+ WEB-INF/config/**/*,
+ LICENSE,
+ README*,
+ SUPPORT,
+ index*.*,
+ expresso/**/*"
+ excludes="**/CVS/**,
+ **/*.jbx,
+ **/*docbook-xsl*/**/*,
+ **/javadoc/**"/>
+ </target>
+ <!--
+ ========================================================================
+ Creates the Component binary war with a complete rebuild.
+ ========================================================================
+ -->
+ <target name="binary-war" depends="build, xmldocs, javadoc, bld-binary, jar" description="Build the Expresso Binary Distribution"/>
+ <!--
+ ========================================================================
+ Creates the Component binary war without doing a complete rebuild.
+ ========================================================================
+ -->
+ <target name="bld-binary" depends="init, jar, buildDirs" description="Build the Expresso Binary Distribution">
+ <delete dir="${weblog.build.dist}/temp" failonerror="false"/>
+ <mkdir dir="${weblog.build.dist}/temp"/>
+
+ <copy todir="${weblog.build.dist}/temp">
+ <fileset dir="WEB-INF/expresso-le">
+ <include name="**/*" />
+ </fileset>
+ </copy>
+
+ <delete file="${weblog.build.dist}/temp/index.html" failonerror="false"/>
+
+ <copy todir="${weblog.build.dist}/temp/">
+ <fileset dir=".">
+ <include name="*" />
+ </fileset>
+ </copy>
+ <copy todir="${weblog.build.dist}/temp/expresso/">
+ <fileset dir="${weblog.web}">
+ <include name="**/*" />
+ </fileset>
+ </copy>
+ <copy todir="${weblog.build.dist}/temp/WEB-INF">
+ <fileset dir="${weblog.build.webinf}">
+ <include name="config/*" />
+ <include name="lib/*" />
+ <include name="src/*" />
+ </fileset>
+ </copy>
+ <copy todir="${weblog.build.dist}/temp/WEB-INF/lib">
+ <fileset dir="${weblog.build.webinf}/lib">
+ <include name="weblog.jar" />
+ </fileset>
+ </copy>
+ <copy todir="${weblog.build.dist}/temp/WEB-INF/src">
+ <fileset dir="${weblog.build.webinf}/src">
+ <include name="**/*.java" />
+ </fileset>
+ </copy>
+ <copy todir="${weblog.build.dist}/temp/WEB-INF">
+ <fileset dir="${weblog.build.webinf}">
+ <include name="build.*" />
+ </fileset>
+ </copy>
+
+ <delete file="${weblog.build.dist}/${weblog.war.name}" failonerror="false"/>
+ <zip zipfile="${weblog.build.dist}/${weblog.war.name}" compress="on" basedir="${weblog.build.dist}/temp"
+ excludes="**/CVS/**,**/*.jbx,**/*docbook-xsl*/**/*" />
+ </target>
+ <!--
+ ========================================================================
+ Creates the Expresso Javadoc Zip File after building javadocs
+ ========================================================================
+ -->
+ <target name="javadoc-zip" depends="javadoc,bld-javadoc-zip" description="Builds the JavaDoc API Zip File"/>
+ <!--
+ ========================================================================
+ Creates the Expresso Javadoc Zip File without rebuilding the javadocs
+ ========================================================================
+ -->
+ <target name="bld-javadoc-zip" depends="init,buildDirs">
+ <delete file="${weblog.build.dist}/${weblog.name}-javadoc.zip" failonerror="false"/>
+ <zip zipfile="${weblog.build.dist}/${weblog.name}-javadoc.zip" basedir="${weblog.component}/javadoc" includes="**/*" compress="true"/>
+ </target>
+ <!--
+ ========================================================================
+ Creates the Expresso Javadoc Zip File without rebuilding the javadocs
+ ========================================================================
+ -->
+ <target name="build-all" depends="init, build, javadoc, xmldocs, bld-javadoc-zip, bld-src-war, bld-binary">
+ <echo>Built all ${app.name} distributions</echo>
+ </target>
+ <!--
+ ========================================================================
+ Build into Expresso dist tree
+ ========================================================================
+ -->
+ <target name="build-eforum-exp" depends="jar" description="build the dist for the component">
+ <echo message="Building eForum "/>
+ <!-- copy the docroot files -->
+ <mkdir dir="${expresso.home}/expresso/expresso-web/expresso/components/eforum"/>
+ <copy todir="${expresso.home}/expresso/expresso-web/expresso/components/eforum">
+ <fileset dir="${eforum.web}/components/eforum">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ <!-- copy in the style file(s) -->
+ <mkdir dir="${expresso.home}/expresso/expresso-web/expresso/style"/>
+ <copy todir="${expresso.home}/expresso/expresso-web/expresso/style">
+ <fileset dir="${eforum.web}/style">
+ <include name="**/*.css"/>
+ </fileset>
+ </copy>
+ <!-- copy in the forum jar file(s) -->
+ <copy todir="${expresso.home}/expresso/expresso-web/WEB-INF/lib">
+ <fileset dir="${eforum.lib}">
+ <include name="**/*.jar"/>
+ <include name="**/*.zip"/>
+ </fileset>
+ </copy>
+ <!-- copy all of the componenets config files -->
+ <copy todir="${expresso.home}/expresso/expresso-web/WEB-INF/config" overwrite="true">
+ <fileset dir="${eforum.config}">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <!--
+ ========================================================================
+ Create combined War
+ ========================================================================
+ -->
+ <target name="build-eforum-dist" depends="jar" description="build the dist for the component">
+ <echo message="Building eForum "/>
+ <!-- copy the docroot files -->
+ <mkdir dir="${eforum.build.dist}/temp"/>
+ <unwar src="${expresso.war}" dest="${eforum.build.dist}/temp" />
+
+ <mkdir dir="${eforum.build.dist}/temp/expresso/components/eforum"/>
+ <copy todir="${eforum.build.dist}/temp/expresso/components/eforum">
+ <fileset dir="${eforum.web}/components/eforum">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ <!-- copy in the style file(s) -->
+ <mkdir dir="${eforum.build.dist}/temp/expresso/style"/>
+ <copy todir="${eforum.build.dist}/temp/expresso/style">
+ <fileset dir="${eforum.web}/style">
+ <include name="**/*.css"/>
+ </fileset>
+ </copy>
+ <!-- copy in the forum jar file(s) -->
+ <copy todir="${eforum.build.dist}/temp/WEB-INF/lib">
+ <fileset dir="${eforum.lib}">
+ <include name="**/*.jar"/>
+ <include name="**/*.zip"/>
+ </fileset>
+ </copy>
+ <!-- copy all of the componenets config files -->
+ <copy todir="${eforum.build.dist}/temp/WEB-INF/config" overwrite="true">
+ <fileset dir="${eforum.config}">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+
+ <!-- ePoll -->
+ <mkdir dir="${eforum.build.dist}/temp/expresso/components/epoll"/>
+ <copy todir="${eforum.build.dist}/temp/expresso/components/epoll">
+ <fileset dir="${epoll.web}/components/epoll">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ <!-- copy in the style file(s) -->
+ <mkdir dir="${eforum.build.dist}/temp/expresso/style"/>
+ <copy todir="${eforum.build.dist}/temp/expresso/style">
+ <fileset dir="${epoll.web}/style">
+ <include name="**/*.css"/>
+ </fileset>
+ </copy>
+ <!-- copy all of the componenets config files -->
+ <copy todir="${eforum.build.dist}/temp/WEB-INF/config" overwrite="true">
+ <fileset dir="${epoll.config}">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+
+ <jar destfile="${eforum.build.dist}/${eforum.war.name}"
+ basedir="${eforum.build.dist}/temp"
+ index="true"
+ />
+ </target>
+ <!-- Seurat Registration component -->
+ <target name="expresso-complete-prep">
+ <echo message="Building registration component "/>
+ <ant dir="../expresso/expresso-web" antfile="${expresso.home}/expresso/build.xml" target="expresso-complete-prep"/>
+ </target>
+ <!-- Seurat Registration component -->
+ <target name="bld-expresso-binary">
+ <echo message="Building registration component "/>
+ <ant dir="../expresso/expresso-web" antfile="${expresso.home}/expresso/build.xml" target="bld-expresso-binary"/>
+ </target>
+ <target name="clean-dist">
+ <echo message="Cleaning Expresso Distribution "/>
+ <ant dir="../expresso" antfile="${expresso.home}/expresso/build.xml" target="clean-dist"/>
+ </target>
+ <target name="build-expresso">
+ <echo message="Cleaning Expresso Distribution "/>
+ <ant dir="../expresso/expresso-web" antfile="${expresso.home}/expresso/build.xml" target="build"/>
+ </target>
+ <!--
+ ========================================================================
+ Create the expresso.war with eforums included. This target will not rebuild expresso
+ ========================================================================
+ -->
+ <target name="expresso-eforum-binary-non-build" depends="expresso-complete-prep, build-eforum-dist,bld-expresso-binary" description="Create the Expresso war file with the registration component">
+ </target>
+ <!--
+ ========================================================================
+ Create the expresso.war with eforums included. This target will rebuild expresso
+ ========================================================================
+ -->
+ <target name="expresso-eforum-binary" depends="clean-dist,build-expresso,expresso-complete-prep, build-eforum-dist,bld-expresso-binary" description="Build the Expresso Binary Distribution with the Registration component">
+ </target>
+ <target name="deploy-component-war" description="Create the war file with the name of the client">
+ <property name="deployName" value="expresso"/>
+ <property name="oldDeployed" value="${deploydir}/${deployName}"/>
+ <mkdir dir="${oldDeployed}"/>
+ <delete dir="${oldDeployed}"/>
+ <mkdir dir="${deploydir}/../work"/>
+ <delete dir="${deploydir}/../work"/>
+ <mkdir dir="${deploydir}/../work"/>
+ <!-- copy war file to the container; rename so that we always have same name-->
+ <copy file="${expresso.home}/expresso/dist/${app.name}${app.version.major}-${app.version.minor}${app.version.micro}-bin.war" tofile="${deploydir}/expresso.war"/>
+ </target>
+</project>
--- /dev/null
+++ src/weblog.jsp
@@ -0,0 +1,103 @@
+<%
+/* ====================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCORPORATE LTD OR ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jcorporate Ltd. Contributions back
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
+ * <http://www.jcorporate.com/>.
+ *
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
+ *
+ * Contributors:
+ * David Lloyd (dlloyd at jgroup.net)
+ * Tino Dai (tdai at jgroup.net)
+ */
+%><% boolean forwardIfNotSetup = false; %><%@ include file="jsp/properSetup.inc" %><%
+
+ try {
+ request.getRequestDispatcher("/weblog/EntryController.do").forward(request, response);
+ } catch (Exception weblog_e) {
+ String db;
+ try {
+ db = com.jcorporate.expresso.core.jsdkapi.GenericSession.getAttributeString(request, "db");
+ if ( db == null || db.length() < 1 ) db="default";
+ } catch (Exception weblog_e2) {
+ db="default";
+ }
+
+ String contextPath = com.jcorporate.expresso.core.misc.StringUtil.notNull(
+ com.jcorporate.expresso.services.dbobj.Setup.getValue(db, "ContextPath"));
+
+%>
+
+<html>
+ <head>
+ <style> @import url(<%=contextPath%>/expresso/components/weblog/weblog.css); </style>
+ <title>
+ Expresso Welog Example
+ <title>
+ </head>
+ <body bgcolor="black">
+
+You should have been redirected to <a href='http://<%=contextPath%>/weblog/EntryController.do'>http://<%=contextPath%>/weblog/EntryController.do</a>. You may do so at this time.
+
+ </body>
+</html>
+
+<%
+ }
+%>
\ No newline at end of file
--- /dev/null
+++ src/WEB-INF/config/weblog-config.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
+ "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
+<struts-config>
+ <action-mappings>
+ <action path="/weblog/WlogLogin"
+ type="com.jcorporate.expresso.demo.weblog.controller.WlogLogin"
+ name="default"
+ scope="request"
+ validate="false">
+ <forward name="promptLogin" path="/expresso/components/weblog/login.jsp"/>
+ <forward name="processLogin" path="/expresso/components/weblog/loginSucess.jsp"/>
+ <forward name="logOut" path="/expresso/components/weblog/logout.jsp"/>
+ </action>
+ <action path="/weblog/EntryController"
+ type="com.jcorporate.expresso.demo.weblog.controller.EntryController"
+ name="default"
+ scope="request"
+ validate="false">
+ <forward name="viewEntry" path="/expresso/components/weblog/view.jsp"/>
+ <forward name="deleteEntry" path="/expresso/components/weblog/delete.jsp"/>
+ <forward name="addEntry" path="/expresso/components/weblog/addEntry.jsp"/>
+ <forward name="putEntry" path="/expresso/components/weblog/putEntry.jsp"/>
+ <forward name="processDelete" path="/expresso/components/weblog/processDelete.jsp"/>
+ </action>
+ <action path="/weblog/WeblogTest"
+ type="com.jcorporate.expresso.demo.weblog.controller.WeblogTest"
+ name="default"
+ scope="request"
+ validate="false">
+ </action>
+ </action-mappings>
+</struts-config>
--- /dev/null
+++ src/WEB-INF/lib/readme-directory.txt
@@ -0,0 +1 @@
+This directory should be empty for CVS initial checkout.
--- /dev/null
+++ src/WEB-INF/src/com/jcorporate/expresso/demo/weblog/WeblogSchema.java
@@ -0,0 +1,114 @@
+/* ====================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCORPORATE LTD OR ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jcorporate Ltd. Contributions back
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
+ * <http://www.jcorporate.com/>.
+ *
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
+ *
+ * Contributors:
+ * David Lloyd (dlloyd at jgroup.net)
+ * Tino Dai (tdai at jgroup.net)
+ */
+package com.jcorporate.expresso.demo.weblog;
+
+import com.jcorporate.expresso.core.dbobj.Schema;
+
+/**
+ *
+ *
+ */
+public class WeblogSchema extends Schema {
+
+ /**
+ *
+ */
+ public WeblogSchema() {
+ super();
+ // TODO Auto-generated constructor stub
+ addDBObject(com.jcorporate.expresso.demo.weblog.dbobj.User.class);
+ addDBObject(com.jcorporate.expresso.demo.weblog.dbobj.Entry.class);
+ addController(com.jcorporate.expresso.demo.weblog.controller.WlogLogin.class);
+ addController(com.jcorporate.expresso.demo.weblog.controller.EntryController.class);
+ }
+
+ /* (non-Javadoc)
+ * @see com.jcorporate.expresso.core.dbobj.Schema#getDefaultComponentCode()
+ */
+ public String getDefaultComponentCode() {
+ // TODO Auto-generated method stub
+ return "weblog";
+ }
+
+ /* (non-Javadoc)
+ * @see com.jcorporate.expresso.core.dbobj.Schema#getDefaultDescription()
+ */
+ public String getDefaultDescription() {
+ // TODO Auto-generated method stub
+ return "Expresso Weblog";
+ }
+
+ /* (non-Javadoc)
+ * @see com.jcorporate.expresso.core.dbobj.Schema#getMessageBundlePath()
+ */
+ public String getMessageBundlePath() {
+ // TODO Auto-generated method stub
+ return "com/jcorporate/expresso/demo/weblog";
+ }
+
+}
--- /dev/null
+++ src/WEB-INF/src/com/jcorporate/expresso/demo/weblog/controller/WlogLogin.java
@@ -0,0 +1,269 @@
+/* ====================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCORPORATE LTD OR ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jcorporate Ltd. Contributions back
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
+ * <http://www.jcorporate.com/>.
+ *
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
+ *
+ * Contributors:
+ * David Lloyd (dlloyd at jgroup.net)
+ * Tino Dai (tdai at jgroup.net)
+ */
+package com.jcorporate.expresso.demo.weblog.controller;
+
+import com.jcorporate.expresso.core.controller.Controller;
+import com.jcorporate.expresso.core.controller.State;
+import com.jcorporate.expresso.core.controller.Output;
+import com.jcorporate.expresso.core.controller.Input;
+import com.jcorporate.expresso.core.controller.Transition;
+import com.jcorporate.expresso.core.controller.Block;
+import com.jcorporate.expresso.core.db.DBException;
+import com.jcorporate.expresso.core.controller.ControllerResponse;
+import com.jcorporate.expresso.core.controller.ControllerRequest;
+import com.jcorporate.expresso.core.controller.ControllerException;
+import com.jcorporate.expresso.core.controller.NonHandleableException;
+import com.jcorporate.expresso.core.misc.StringUtil;
+import com.jcorporate.expresso.core.misc.CurrentLogin;
+import com.jcorporate.expresso.core.jsdkapi.GenericSession;
+import com.jcorporate.expresso.core.controller.session.PersistentSession;
+import com.jcorporate.expresso.demo.weblog.dbobj.User;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import javax.servlet.http.*;
+import com.jcorporate.expresso.core.controller.ServletControllerRequest;
+import javax.servlet.*;
+
+/**
+ *
+ * This particular class handles the following:
+ * Logins
+ * Logouts
+ * New Members
+ */
+public class WlogLogin extends Controller {
+
+ public WlogLogin() {
+ super();
+ State promptLogin = new State("promptLogin","Back to Login");
+ addState(promptLogin);
+ setInitialState("promptLogin");
+ State processLogin = new State("processLogin","Login");
+ addState(processLogin);
+ State addUser = new State("addUser","Adding Users");
+ addState(addUser);
+ State processNewUser = new State("processNewUser","Processing New Users");
+ addState(processNewUser);
+ State logOut = new State("logOut","Processing log out");
+ addState(logOut);
+ }
+ protected void runPromptLoginState(ControllerRequest request, ControllerResponse response) throws ControllerException {
+ // The Input object handles the user inputs. Here we see two, the UserName and
+ // Password.
+ Input UserName = new Input();
+ UserName.setName("UserName");
+ UserName.setLabel("Username");
+ UserName.setDefaultValue("");
+ // For the input to show up on the view (in this case the web browser), it will need to be
+ // added to the response object. The response object is very similar to the HttpServletResponse object.
+ response.add(UserName);
+ // i.setDefaultValue("tdai"); <-The default parameters that go into the particular input box
+ Input PassWord = new Input();
+ PassWord.setName("PassWord");
+ PassWord.setLabel("Password");
+ response.add(PassWord);
+
+ // In this case, we are specifying that the component that we are adding to the response object is
+ // an Output. An Output object allows the class to display information back to the user (in this class
+ // via the web browser
+ response.addOutput(new Output("title","Simple Expresso WebLog"));
+ // response.addOutput(new Output("hello","Hello World")); <- The output that one wants to go to the screen
+ // Transition t = new Transition("processLogin",this);
+ // The transition objects allow the application to hop from state to state
+ // In this case, we have Transition(name,Label,the name of the class that we will be transitioning to, new state)
+ Transition t = new Transition("myButton", "Login",WlogLogin.class,"processLogin");
+ Transition u = new Transition("addUser",this);
+ response.addTransition(t);
+ response.addTransition(u);
+ response.addTransition(new Transition("processLogin", this));
+ response.addTransition(new Transition("addUser",this));
+
+ }
+
+ protected void runProcessLoginState(ControllerRequest request, ControllerResponse response) throws ControllerException, NonHandleableException, DBException, ServletException {
+ // Top make sure the value isn't empty
+ String userName = StringUtil.notNull(request.getParameter("UserName"));
+ String passWord = StringUtil.notNull(request.getParameter("PassWord"));
+ if ((userName.length() == 0) || (passWord.length() == 0)) {
+ // Here we will be sending back the error message to the promptLogin state above
+ response.addError("Either the username or password is blank");
+ // Unlike the transition that we saw above, this will automatically transition to another state, in this case
+ // promptLogin
+ transition("promptLogin",request,response);
+ // The return will allow the control to be passed permanently to the promptLogin instead of
+ // return control back to ProcessLogin after finishing promptLogin.
+ return;
+ }
+
+ // Starting the validation phase
+ User myUser = new User();
+ // Here we are downcasting into Servlet and HttpServlet request and response
+ // We are doing this to expose some of the methods that ControllerResponse and
+ // ControllerRequest don't have
+ ServletControllerRequest sr = (ServletControllerRequest) request;
+ HttpServletRequest hreq = (HttpServletRequest) sr.getServletRequest();
+
+ // The setField is an method of dbobject, and allows certain fields of the
+ // dbobject to be set to certain values
+ myUser.setField(User.FLD_USERNAME,request.getParameter("UserName"));
+ // If we can find that entry in that db, great
+ if ( myUser.find() ) {
+ String tempPass=myUser.getField(User.FLD_USERPASSWORD);
+ if (tempPass.equals(request.getParameter("PassWord"))) {
+ // The CurrentLogin object will encapsulate all of the relevant info into an object, myLogin
+ CurrentLogin myLogin = CurrentLogin.newInstance(request.getParameter("UserName"), hreq.getRemoteAddr(), request.getDataContext(), myUser.getFieldInt(User.FLD_UID));
+ // To have the session be persistant, we will call request.session(), remove the CurrentLogin, and set the CurrentLogin equal to
+ // myLogin
+ PersistentSession session = request.getSession();
+ session.removePersistentAttribute("CurrentLogin");
+ session.setPersistentAttribute("CurrentLogin",myLogin);
+ response.addOutput(new Output("myOutput","Login sucessful"));
+ } else {
+ response.addOutput(new Output("myOutput","Login unsucessful"));
+ response.addError("Either the username or password is incorrect");
+ transition("promptLogin",request,response);
+ return;
+ }
+
+ } else {
+ // Here we will be sending back the error message to the promptLogin state above
+ response.addError("Either the username or password is invalid");
+ transition("promptLogin",request,response, false);
+ // The return will allow the control to be passed permanently to the promptLogin instead of
+ // return control back to ProcessLogin after finishing promptLogin.
+ return;
+ }
+
+ // response.addOutput(new Output("myOutput",myUser));
+ // The request.getParameter must equal the setName in the input block
+ response.addTransition(new Transition("viewButton","View",EntryController.class,"viewEntry"));
+ response.addTransition(new Transition("deleteButton","Delete",EntryController.class,"deleteEntry"));
+ response.addTransition(new Transition("addButton","Add",EntryController.class,"addEntry"));
+ response.addOutput(new Output("Hello",request.getParameter("UserName")));
+
+ }
+ protected void runAddUserState(ControllerRequest request, ControllerResponse response) throws ControllerException {
+ Input user = new Input();
+ user.setName("newUserName");
+ user.setLabel("User Name:");
+
+ Input pass = new Input();
+ pass.setName("newPassword");
+ pass.setLabel("PassWord");
+
+ Input repass = new Input();
+ repass.setName("newRePassword");
+ repass.setLabel("Password again");
+
+ Input email = new Input();
+ email.setName("email");
+ email.setLabel("Email");
+
+ // The block serves the function of encapulsating the inputs, outputs, and transitions
+ Block block1 = new Block();
+ block1.add(user);
+ block1.add(pass);
+ block1.add(repass);
+
+ Transition t = new Transition("myButton","Add User",WlogLogin.class,"processNewUser");
+ block1.add(t);
+ // Finally we add the block to the response object to pass off to the next state
+ response.addBlock(block1);
+ }
+ protected void runProcessNewUserState(ControllerRequest request, ControllerResponse response) throws ControllerException, DBException {
+ User newUser = new User();
+ // This is to check that nobody else has that username
+ newUser.setField(User.FLD_USERNAME,request.getParameter("newUserName"));
+ // If not, process the new user
+ if ( ! newUser.find()) {
+ String newPassword = new String();
+ newPassword = request.getParameter("newPassword");
+ if ( newPassword.equals(request.getParameter("newRePassword"))) {
+ newUser.setField(User.FLD_USERNAME,request.getParameter("newUserName"));
+ newUser.setField(User.FLD_USERPASSWORD,request.getParameter("newPassword"));
+ newUser.add();
+ response.addOutput(new Output("Result","Request Sucessful, added "+ request.getParameter("newUserName")));
+
+ }
+ // If not, alert the user
+ } else { response.addOutput(new Output("Result","Not sucessful, find was false"));
+ }
+ // Prompt user to transiton back to promptLogin state
+ response.addTransition(new Transition("promptLogin",this));
+ }
+
+ protected void runLogOutState(ControllerRequest request, ControllerResponse response) throws ControllerException, DBException, NonHandleableException {
+ // In this method, we are removing the CurrentLogin so that the user
+ // is not logged in anymore
+ PersistentSession session = request.getSession();
+ response.addOutput(new Output("logOut","Good bye " + request.getUser()));
+ session.removePersistentAttribute("CurrentLogin");
+ response.addTransition(new Transition("promptLogin",this));
+ }
+}
+
--- /dev/null
+++ src/WEB-INF/src/com/jcorporate/expresso/demo/weblog/controller/EntryController.java
@@ -0,0 +1,254 @@
+/* ====================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCORPORATE LTD OR ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jcorporate Ltd. Contributions back
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
+ * <http://www.jcorporate.com/>.
+ *
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
+ *
+ * Contributors:
+ * David Lloyd (dlloyd at jgroup.net)
+ * Tino Dai (tdai at jgroup.net)
+ */
+package com.jcorporate.expresso.demo.weblog.controller;
+
+import java.lang.Integer;
+import com.jcorporate.expresso.core.controller.Controller;
+import com.jcorporate.expresso.core.controller.State;
+import com.jcorporate.expresso.core.controller.Block;
+import com.jcorporate.expresso.core.controller.Output;
+import com.jcorporate.expresso.core.controller.Input;
+import com.jcorporate.expresso.core.controller.Transition;
+import com.jcorporate.expresso.core.controller.ControllerRequest;
+import com.jcorporate.expresso.core.controller.ControllerResponse;
+import com.jcorporate.expresso.core.controller.ControllerException;
+import com.jcorporate.expresso.core.controller.NonHandleableException;
+import com.jcorporate.expresso.core.db.DBException;
+import com.jcorporate.expresso.core.misc.CurrentLogin;
+import com.jcorporate.expresso.demo.weblog.dbobj.Entry;
+import com.jcorporate.expresso.demo.weblog.dbobj.User;
+import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.Vector;
+import com.jcorporate.expresso.core.dbobj.ValidValue;
+import com.jcorporate.expresso.core.misc.StringUtil;
+
+/**
+ *
+ *
+ */
+public class EntryController extends Controller {
+
+ /**
+ *
+ */
+ public EntryController() {
+ super();
+ State viewEntry = new State("viewEntry","View Entry");
+ addState(viewEntry);
+ State deleteEntry = new State("deleteEntry","Delete Entry");
+ addState(deleteEntry);
+ State processDelete = new State("processDelete","Delete Process");
+ addState(processDelete);
+ State addEntry = new State("addEntry","Add Entry");
+ addState(addEntry);
+ State putEntry = new State("putEntry","Put Entry");
+ addState(putEntry);
+ setInitialState("viewEntry");
+ }
+
+ protected void runDeleteEntryState(ControllerRequest request, ControllerResponse response) throws ControllerException, DBException, NonHandleableException {
+ // The first part of each state is to check that the user is logged in. To do that
+ // we set the username of the User dbobject equal to the request.getUser().
+ // The request.getUser() will read the values that of the CurrentLogin Persistant Attribute
+ User myUser = new User();
+ myUser.setField(User.FLD_USERNAME,request.getUser());
+ if ( ! myUser.find() ) {
+ Transition trans = new Transition("","",WlogLogin.class,"promptLogin");
+ trans.transition(request,response);
+ return;
+ }
+ Entry myEntry = new Entry();
+ // The next 4 lines retrieve from the database the entries that belong
+ // to the user.
+ myEntry.setField(Entry.FLD_USER,request.getUser());
+ ArrayList tempArray = myEntry.searchAndRetrieveList();
+ Vector tempVector = new Vector();
+ Input getEntry = new Input();
+ for (int i=0 ; i< tempArray.size() ; ++i) {
+ Entry tempEntry = (Entry)tempArray.get(i);
+ tempVector.add(new ValidValue(tempEntry.getField(Entry.FLD_ENTRY_ID),tempEntry.getField(Entry.FLD_TITLE)));
+ }
+ getEntry.setName("getEntry");
+ getEntry.setLabel("getEntry");
+ getEntry.setValidValues(tempVector);
+ getEntry.setDefaultValue("key");
+ response.addInput(getEntry);
+ response.addTransition(new Transition("processDelete",this));
+ }
+
+ protected void runProcessDeleteState(ControllerRequest request, ControllerResponse response) throws ControllerException, DBException, NonHandleableException {
+ // Security
+ User myUser = new User();
+ myUser.setField(User.FLD_USERNAME,request.getUser());
+ if ( ! myUser.find() ) {
+ Transition trans = new Transition("","",WlogLogin.class,"promptLogin");
+ trans.transition(request,response);
+ return;
+ }
+ Entry myEntry = new Entry();
+ myEntry.setField(Entry.FLD_USER,request.getUser());
+ // This line will ensure that the getEntry parameter isn't blank
+ String getEntryDate = StringUtil.notNull(request.getParameter("getEntry"));
+ // If there is indeed a non-blank value in getEntry, then process the delete
+ if ( getEntryDate.length() > 0 ) {
+ myEntry.setField(Entry.FLD_ENTRY_ID,request.getParameter("getEntry"));
+ response.add(new Output("DeleteProcess",request.getParameter("getEntry")));
+ // This will delete anything with the user and the date field set (which will be unique)
+ myEntry.delete();
+ }
+ response.add(new Output("DeleteProcess","In the Delete Process"));
+ response.addTransition(new Transition("addEntry",this));
+ response.addTransition(new Transition("viewEntry",this));
+ response.addTransition(new Transition("deleteEntry",this));
+ response.addTransition(new Transition("logoutButton","Logout",WlogLogin.class,"logOut"));
+ }
+
+ protected void runViewEntryState(ControllerRequest request, ControllerResponse response) throws ControllerException, DBException, NonHandleableException {
+ // Security
+ User myUser = new User();
+ myUser.setField(User.FLD_USERNAME,request.getUser());
+ if ( ! myUser.find() ) {
+ Transition trans = new Transition("","",WlogLogin.class,"promptLogin");
+ trans.transition(request,response);
+ return;
+ }
+
+ response.addOutput(new Output("User",request.getUser()));
+ Entry myEntry = new Entry();
+ myEntry.setField(User.FLD_USERNAME,request.getUser());
+ // myEntry.setMaxRecords(3);
+ response.addOutput(new Output("User",request.getUser()));
+ response.addOutput(new Output("ViewState","In the View State"));
+ ArrayList tempArray = myEntry.searchAndRetrieveList();
+ if ( tempArray.size() > 0) {
+ for (int i =0 ; i < tempArray.size() ; ++i) {
+ // Here we see that Block serves as a holding device for many
+ // titles and entries
+ Entry tempEntry = (Entry)tempArray.get(i);
+ Block whole = new Block();
+ whole.add(new Output("ViewTitle",tempEntry.getField(Entry.FLD_TITLE)));
+ whole.add(new Output("ViewEntry",tempEntry.getField(Entry.FLD_ENTRY)));
+ response.addBlock(whole);
+ }
+ } else {
+ Block whole = new Block();
+ whole.add(new Output("ViewTitle","No Entries yet"));
+ whole.add(new Output("ViewEntry","Please add some...."));
+ response.addBlock(whole);
+ }
+ response.addTransition(new Transition("addEntry",this));
+ response.addTransition(new Transition("viewEntry",this));
+ response.addTransition(new Transition("deleteEntry",this));
+ response.addTransition(new Transition("logoutButton","Logout",WlogLogin.class,"logOut"));
+ }
+
+ protected void runAddEntryState(ControllerRequest request, ControllerResponse response) throws DBException, ControllerException, NonHandleableException {
+ // Security
+ User myUser = new User();
+ myUser.setField(User.FLD_USERNAME,request.getUser());
+ if ( ! myUser.find() ) {
+ Transition trans = new Transition("","",WlogLogin.class,"promptLogin");
+ trans.transition(request,response);
+ return;
+ }
+ response.add(new Output("AddEntry","In the Add State"));
+ Input titleEntry = new Input();
+ titleEntry.setName("titleEntry");
+ titleEntry.setLabel("TitleEntry");
+ Input entryEntry = new Input();
+ entryEntry.setName("entryEntry");
+ entryEntry.setLabel("EntryEntry");
+ response.addTransition(new Transition("AddEntryButton","AddEntry",com.jcorporate.expresso.demo.weblog.controller.EntryController.class,"putEntry"));
+ response.addInput(titleEntry);
+ response.addInput(entryEntry);
+ }
+
+
+ protected void runPutEntryState(ControllerRequest request, ControllerResponse response) throws DBException, ControllerException, NonHandleableException {
+ // Security
+ User myUser = new User();
+ myUser.setField(User.FLD_USERNAME,request.getUser());
+ if ( ! myUser.find() ) {
+ Transition trans = new Transition("","",WlogLogin.class,"promptLogin");
+ trans.transition(request,response);
+ return;
+ }
+ Entry myEntry = new Entry();
+ myEntry.setField(Entry.FLD_TITLE,request.getParameter("input(titleEntry)"));
+ myEntry.setField(Entry.FLD_ENTRY,request.getParameter("input(entryEntry)"));
+ // To make sure that the row in the database is assigned to the correct person
+ myEntry.add(request.getUser());
+ myEntry.setField("Title","");
+ response.add(new Output("Statement","The entry is put in"));
+ response.addTransition(new Transition("addEntry",this));
+ response.addTransition(new Transition("viewEntry",this));
+ response.addTransition(new Transition("deleteEntry",this));
+ response.addTransition(new Transition("logoutButton","Logout",WlogLogin.class,"logOut"));
+ }
+}
--- /dev/null
+++ src/WEB-INF/src/com/jcorporate/expresso/demo/weblog/dbobj/Entry.java
@@ -0,0 +1,193 @@
+/* ====================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCORPORATE LTD OR ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jcorporate Ltd. Contributions back
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
+ * <http://www.jcorporate.com/>.
+ *
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
+ *
+ * Contributors:
+ * David Lloyd (dlloyd at jgroup.net)
+ * Tino Dai (tdai at jgroup.net)
+ */
+package com.jcorporate.expresso.demo.weblog.dbobj;
+
+import com.jcorporate.expresso.core.db.DBConnection;
+import com.jcorporate.expresso.core.db.DBException;
+import com.jcorporate.expresso.core.dbobj.RequestContext;
+import com.jcorporate.expresso.core.dbobj.DBObject;
+import com.jcorporate.expresso.core.dbobj.SecuredDBObject;
+import com.jcorporate.expresso.core.misc.DateTime;
+
+/**
+ *
+ *
+ *
+ */
+public class Entry extends SecuredDBObject {
+
+ /**
+ *
+ */
+ public static final String FLD_ENTRY_ID = "EntryID";
+
+ /**
+ *
+ */
+ public static final String FLD_USER = "UserLoginName";
+
+ /**
+ *
+ */
+ public static final String FLD_DATE = "EntryDate";
+
+ /**
+ *
+ */
+ public static final String FLD_TITLE = "Title";
+
+ /**
+ *
+ */
+ public static final String FLD_ENTRY = "EntryText";
+
+ /**
+ * @throws DBException
+ */
+ public Entry() throws DBException {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param newConnection
+ * @throws DBException
+ */
+ public Entry(DBConnection newConnection) throws DBException {
+ super(newConnection);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param newConnection
+ * @param setupTablesContext
+ * @throws DBException
+ */
+ public Entry(DBConnection newConnection, String setupTablesContext)
+ throws DBException {
+ super(newConnection, setupTablesContext);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param newUid
+ * @throws DBException
+ */
+ public Entry(int newUid) throws DBException {
+ super(newUid);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param theConnection
+ * @param theUser
+ * @throws DBException
+ */
+ public Entry(DBConnection theConnection, int theUser) throws DBException {
+ super(theConnection, theUser);
+ // TODO Auto-generated constructor stub
+ }
+
+
+ /**
+ * @param request
+ * @throws DBException
+ */
+ public Entry(RequestContext request) throws DBException {
+ super(request);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param dbKey
+ * @param theUser
+ * @throws DBException
+ */
+ public Entry(String dbKey, int theUser) throws DBException {
+ super(dbKey, theUser);
+ // TODO Auto-generated constructor stub
+ }
+
+ protected synchronized void setupFields () throws DBException {
+ setTargetTable("WEBLOGENTRY");
+
+ addField(FLD_ENTRY_ID,"auto-inc", 0, false, "Entry ID");
+ addField(FLD_USER,"char",30,false,"User Name");
+ addField(FLD_DATE,"datetime",0,false,"Date and Time");
+ addField(FLD_TITLE,"varchar",30,false,"Title");
+ addField(FLD_ENTRY,"text",0,true,"Entry");
+
+ addKey(FLD_ENTRY_ID);
+ }
+
+ public void add(String User) throws DBException {
+ setField(FLD_DATE,DateTime.getDateTimeForDB(new java.util.Date(),this.getDataContext()));
+ setField(FLD_USER,User);
+ super.add();
+ }
+}
--- /dev/null
+++ src/WEB-INF/src/com/jcorporate/expresso/demo/weblog/dbobj/User.java
@@ -0,0 +1,130 @@
+/* ====================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCORPORATE LTD OR ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jcorporate Ltd. Contributions back
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
+ * <http://www.jcorporate.com/>.
+ *
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
+ *
+ * Contributors:
+ * David Lloyd (dlloyd at jgroup.net)
+ * Tino Dai (tdai at jgroup.net)
+ */
+package com.jcorporate.expresso.demo.weblog.dbobj;
+
+import com.jcorporate.expresso.core.db.DBConnection;
+import com.jcorporate.expresso.core.db.DBException;
+import com.jcorporate.expresso.core.dbobj.RequestContext;
+import com.jcorporate.expresso.core.dbobj.SecuredDBObject;
+
+/**
+ *
+ *
+ *
+ */
+public class User extends SecuredDBObject {
+
+ public static final String FLD_UID = "ExpUid";
+
+ public static final String FLD_USERNAME = "UserLoginName";
+
+ public static final String FLD_USERPASSWORD = "UserPassword";
+
+ /**
+ * @throws DBException
+ */
+ public User() throws DBException {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param theConnection
+ * @param theUser
+ * @throws DBException
+ */
+ public User(DBConnection theConnection, int theUser) throws DBException {
+ super(theConnection, theUser);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param theUser
+ * @throws DBException
+ */
+ public User(int theUser) throws DBException {
+ super(theUser);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param request
+ * @throws DBException
+ */
+ public User(RequestContext request) throws DBException {
+ super(request);
+ // TODO Auto-generated constructor stub
+ }
+ protected synchronized void setupFields() throws DBException {
+ setTargetTable("WEBLOGUSER");
+ addField(FLD_UID,"auto-inc",0,false,"Uid");
+ addField(FLD_USERNAME,"char",30,false,"User Name");
+ addField(FLD_USERPASSWORD,"char",30,false,"Password");
+ }
+
+}
--- /dev/null
+++ src/expresso/components/weblog/view.jsp
@@ -0,0 +1,114 @@
+<%
+/* ====================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCORPORATE LTD OR ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jcorporate Ltd. Contributions back
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
+ * <http://www.jcorporate.com/>.
+ *
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
+ *
+ * Contributors:
+ * David Lloyd (dlloyd at jgroup.net)
+ * Tino Dai (tdai at jgroup.net)
+ */
+%>
+<%@ taglib uri="/WEB-INF/tld/expresso.tld" prefix="expresso" %>
+<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="struts-logic" %>
+<%@ taglib uri="/WEB-INF/tld/expresso-logic.tld" prefix="logic" %>
+<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="struts-bean" %>
+<%@ taglib uri="/WEB-INF/tld/expresso-bean.tld" prefix="bean" %>
+<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
+<%@ include file="standard.inc" %>
+
+<html>
+ <head>
+ <style> @import url(<%=contextPath%>/expresso/components/weblog/weblog.css); </style>
+ <title>
+ Expresso View State
+ <title>
+ </head>
+ <expresso:OutputTag name="ViewState">
+ <expresso:ContentTag />
+ </expresso:OutputTag>
+ </title>
+ <body bgcolor="black">
+ <table>
+ <tr><td valign="top">
+ <img src="<%=contextPath%>/expresso/components/weblog/images/weblog_title.jpg">
+ </td>
+ <td>
+ <html:form action="/weblog/EntryController?state=processDelete" method="POST">
+ <H2>Welcome <expresso:OutputTag name="User"><expresso:ContentTag/></expresso:OutputTag></h2>
+ <expresso:TransitionTag name="viewEntry"/>
+ <expresso:TransitionTag name="deleteEntry"/>
+ <expresso:TransitionTag name="addEntry"/>
+ <expresso:TransitionTag name="logoutButton"/><br>
+ </html:form>
+ </td>
+ </tr>
+
+ <table border=1 bordercolor="blue" width="90%">
+ <logic:iterate property="blocks" id="eachRow">
+ <tr><td><p><b><bean:write name="eachRow" property="/ViewTitle"/></b></p>
+ <hr />
+ <p><bean:write name="eachRow" property="/ViewEntry"/></p></td></tr>
+ </logic:iterate>
+ </table>
+ </table>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+++ src/expresso/components/weblog/processDelete.jsp
@@ -0,0 +1,109 @@
+<%
+/* =================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCORPORATE LTD OR ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jcorporate Ltd. Contributions back
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
+ * <http://www.jcorporate.com/>.
+ *
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
+ *
+ * Contributors:
+ * David Lloyd (dlloyd at jgroup.net)
+ * Tino Dai (tdai at jgroup.net)
+ */
+%>
+<%@ taglib uri="/WEB-INF/tld/expresso.tld" prefix="expresso" %>
+<%@ taglib uri="/WEB-INF/tld/expresso-html.tld" prefix="html" %>
+<%@ taglib uri="/WEB-INF/tld/expresso-logic.tld" prefix="logic" %>
+
+<%@ include file="standard.inc" %>
+
+<html>
+ <head>
+ <style>
+ @import url(<%=contextPath%>/expresso/components/weblog/weblog.css);
+ </style>
+ <title>
+ Adding Entry
+ </title>
+ </head>
+ <body bgcolor="black">
+ <table>
+ <tr>
+ <td>
+ <img src="<%=contextPath%>/expresso/components/weblog/images/weblog_title.jpg">
+ </td>
+ <td>
+ <H3>Thanks for deleting an entry. Click on the view to see your entry</h3>
+ <html:form action="/weblog/EntryController?state=addEntry" method="POST">
+ <table>
+ <tr>
+ <td><expresso:TransitionTag name="addEntry" /></td>
+ <td><expresso:TransitionTag name="viewEntry" /></td>
+ </tr>
+ <tr>
+ <td><expresso:TransitionTag name="deleteEntry" /></td>
+ <td><expresso:TransitionTag name="logoutButton" /></td>
+ </tr>
+ </table>
+ </html:form>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+++ src/expresso/components/weblog/test.html
@@ -0,0 +1,10 @@
+<html>
+ <head>
+ <style>
+ @import url(weblog.css);
+ </style>
+ </head>
+ <body>
+ <H1>Hello there</h1>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+++ src/expresso/components/weblog/standard.inc
@@ -0,0 +1,117 @@
+<%
+/* =================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCORPORATE LTD OR ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jcorporate Ltd. Contributions back
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
+ * <http://www.jcorporate.com/>.
+ *
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
+ *
+ * Contributors:
+ * David Lloyd (dlloyd at jgroup.net)
+ * Tino Dai (tdai at jgroup.net)
+ */
+%>
+<%@ page import="com.jcorporate.expresso.core.misc.StringUtil" %>
+<%@ page import="com.jcorporate.expresso.core.misc.ConfigManager" %>
+<%@ page import="com.jcorporate.expresso.core.servlet.CheckLogin" %>
+<%@ page import="com.jcorporate.expresso.core.jsdkapi.GenericSession" %>
+<%@ page import="com.jcorporate.expresso.services.dbobj.Setup" %>
+<%@ page import="com.jcorporate.expresso.core.db.DBException" %>
+
+
+<% CheckLogin.getInstance().checkLogin(request, response, getServletConfig());
+ String db;
+ try {
+ db = GenericSession.getAttributeString(request, "db");
+ if ( db == null || db.length() < 1 ) db="default";
+ } catch (Exception e) {
+ db="default";
+ }
+ String images = ConfigManager.getContext(db).getImages();
+ String contextPath = StringUtil.notNull(Setup.getValue(db, "ContextPath"));
+
+ String expressoContextPath = StringUtil.notNull(Setup.getValue(db, "ContextPath")) + "/" + StringUtil.notNull(ConfigManager.getContext(db).getExpressoDir());
+ //String contextPath = expressoContextPath + "/components/eforum";
+ String servletPath = Setup.getValueRequired(db, "ContextPath") + Setup.getValueRequired(db, "ServletPath");
+ String nextPath = StringUtil.notNull(ConfigManager.getContext(db).getExpressoDir()) + "/components/eforum";
+
+ // // ================================================================================
+ // // THIS CODE SHOULD GO IN A NEW ANTI-CACHE TAG.
+ // // ================================================================================
+ //
+ // // HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
+ // try {
+ // // Set to expire far in the past.
+ // response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");
+ //
+ // // Set standard HTTP/1.1 no-cache headers.
+ // response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
+ //
+ // // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
+ // response.addHeader("Cache-Control", "post-check=0, pre-check=0");
+ //
+ // // Set standard HTTP/1.0 no-cache header.
+ // response.setHeader("Pragma", "no-cache");
+ // }
+ // catch (Exception e) {
+ // System.err.println ("unable to build the anti-cache response exception:"+ e );
+ // }
+
+%>
+
--- /dev/null
+++ src/expresso/components/weblog/putEntry.jsp
@@ -0,0 +1,109 @@
+<%
+/* =================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCORPORATE LTD OR ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jcorporate Ltd. Contributions back
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
+ * <http://www.jcorporate.com/>.
+ *
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
+ *
+ * Contributors:
+ * David Lloyd (dlloyd at jgroup.net)
+ * Tino Dai (tdai at jgroup.net)
+ */
+%>
+
+<%@ taglib uri="/WEB-INF/tld/expresso.tld" prefix="expresso" %>
+<%@ taglib uri="/WEB-INF/tld/expresso-html.tld" prefix="html" %>
+<%@ taglib uri="/WEB-INF/tld/expresso-logic.tld" prefix="logic" %>
+
+<%@ include file="standard.inc" %>
+<html>
+ <head>
+ <style>
+ @import url(/Expresso/expresso/components/weblog/weblog.css);
+ </style>
+ <title>
+ Adding Entry
+ </title>
+ </head>
+ <body bgcolor="black">
+ <table>
+ <tr>
+ <td>
+ <img src="<%=contextPath%>/expresso/components/weblog/images/weblog_title.jpg">
+ </td>
+ <td>
+ <H3>Your entry has been added to the weblog </h3>
+ <html:form action="/weblog/EntryController?state=addEntry" method="POST">
+ <table>
+ <tr>
+ <td><expresso:TransitionTag name="addEntry" /></td>
+ <td><expresso:TransitionTag name="viewEntry" /></td>
+ </tr>
+ <tr>
+ <td><expresso:TransitionTag name="deleteEntry" /></td>
+ <td><expresso:TransitionTag name="logoutButton" /></td>
+ </tr>
+ </table>
+ </html:form>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+++ src/expresso/components/weblog/frame.jsp
@@ -0,0 +1,104 @@
+<%
+/* ====================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCORPORATE LTD OR ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jcorporate Ltd. Contributions back
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
+ * <http://www.jcorporate.com/>.
+ *
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
+ *
+ * Contributors:
+ * David Lloyd (dlloyd at jgroup.net)
+ * Tino Dai (tdai at jgroup.net)
+ */
+
+ try {
+ request.getRequestDispatcher("/weblog/EntryController.do").forward(request, response);
+ } catch (Exception weblog_e) {
+ weblog_e.printStackTrace();
+
+ String db;
+ try {
+ db = com.jcorporate.expresso.core.jsdkapi.GenericSession.getAttributeString(request, "db");
+ if ( db == null || db.length() < 1 ) db="default";
+ } catch (Exception weblog_e2) {
+ db="default";
+ }
+
+ String contextPath = com.jcorporate.expresso.core.misc.StringUtil.notNull(
+ com.jcorporate.expresso.services.dbobj.Setup.getValue(db, "ContextPath"));
+
+%>
+
+<html>
+ <head>
+ <style> @import url(<%=contextPath%>/expresso/components/weblog/weblog.css); </style>
+ <title>
+ Expresso Weblog Example
+ <title>
+ </head>
+ <body bgcolor="black">
+
+You should have been redirected to <a href='http://<%=contextPath%>/weblog/EntryController.do'>http://<%=contextPath%>/weblog/EntryController.do</a>. You may do so at this time.
+
+ </body>
+</html>
+
+<%
+ }
+%>
\ No newline at end of file
--- /dev/null
+++ src/expresso/components/weblog/login.jsp
@@ -0,0 +1,130 @@
+<%
+/* =================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCORPORATE LTD OR ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jcorporate Ltd. Contributions back
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
+ * <http://www.jcorporate.com/>.
+ *
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
+ *
+ * Contributors:
+ * David Lloyd (dlloyd at jgroup.net)
+ * Tino Dai (tdai at jgroup.net)
+ */
+%>
+<%@ taglib uri="/WEB-INF/tld/expresso.tld" prefix="expresso" %>
+<%@ taglib uri="/WEB-INF/tld/expresso-html.tld" prefix="html" %>
+<%@ taglib uri="/WEB-INF/tld/expresso-bean.tld" prefix="bean" %>
+
+<%@ include file="standard.inc" %>
+<html>
+ <head>
+ <style> @import url(<%=contextPath%>/expresso/components/weblog/weblog.css); </style>
+
+ <title>
+ <expresso:OutputTag name="title">
+ <expresso:ContentTag />
+ </expresso:OutputTag>
+ </title>
+</head>
+<body bgcolor="black">
+ <table>
+ <tr><td>
+ <img src="<%=contextPath%>/expresso/components/weblog/images/weblog_title.jpg">
+ </td>
+ <td>
+ <table>
+ <html:form action="/weblog/WlogLogin.do?state=processLogin" method="POST">
+ <expresso:ElementCollection type="input">
+ <tr><td colspan=2>
+ <H2>Come right in and make yourself at home!</h2>
+ </td></tr>
+ <tr><td colspan=2>
+ <expresso:ErrorMessages />
+ </td></tr>
+ <tr><td>
+ <p>Username:</p>
+ </td>
+ <td>
+ <expresso:InputTag name="UserName" type="text" size="15"/>
+ </td></tr>
+ <tr><td>
+ <p>Password:</p>
+ </td>
+ <td>
+ <expresso:InputTag name="PassWord" type="text" size="15"/>
+ </td></tr>
+ </expresso:ElementCollection>
+ <tr><td colspan=2 align=center>
+ <expresso:TransitionTag name="processLogin" />
+ <expresso:TransitionTag name="addUser" />
+<!--
+ <input type="hidden" name="style" value="xml">
+ <input type="hidden" name="xsl" value="none">
+ -->
+ </td></tr>
+ <tr><td colspan=2 align=center>
+ <html:link page="/expresso/doc/tutorial.html">Tutorial</html:link>
+ </td></tr>
+ </html:form>
+ </table>
+ </td>
+ </tr>
+ </table>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+++ src/expresso/components/weblog/delete.jsp
@@ -0,0 +1,120 @@
+<%
+/* =================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCORPORATE LTD OR ITS 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.
+ * =======================