You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ni...@apache.org on 2007/04/27 06:00:54 UTC
svn commit: r532952 - in /jakarta/commons/proper/chain/trunk/apps/example:
./ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/commons/
src/main/java/org/apache/commons/chain/ src/main/java/org/apache/...
Author: niallp
Date: Thu Apr 26 21:00:53 2007
New Revision: 532952
URL: http://svn.apache.org/viewvc?view=rev&rev=532952
Log:
CHAIN-36 - Add Example webapp for Servlet Mapper Commands
Added:
jakarta/commons/proper/chain/trunk/apps/example/
jakarta/commons/proper/chain/trunk/apps/example/pom.xml (with props)
jakarta/commons/proper/chain/trunk/apps/example/src/
jakarta/commons/proper/chain/trunk/apps/example/src/main/
jakarta/commons/proper/chain/trunk/apps/example/src/main/java/
jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/
jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/
jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/
jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/
jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/
jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/
jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/CountCommand.java (with props)
jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ExampleServlet.java (with props)
jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ForwardCommand.java (with props)
jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/
jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/
jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/chain-config.xml (with props)
jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/classes/
jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/classes/log4j.properties (with props)
jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/web.xml (with props)
jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/index.jsp (with props)
jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/pathinfo.jsp (with props)
jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/reqparam.jsp (with props)
jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/servletpath.jsp (with props)
Added: jakarta/commons/proper/chain/trunk/apps/example/pom.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/apps/example/pom.xml?view=auto&rev=532952
==============================================================================
--- jakarta/commons/proper/chain/trunk/apps/example/pom.xml (added)
+++ jakarta/commons/proper/chain/trunk/apps/example/pom.xml Thu Apr 26 21:00:53 2007
@@ -0,0 +1,123 @@
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>2</version>
+ </parent>
+
+ <artifactId>chain-example</artifactId>
+ <packaging>war</packaging>
+ <version>1.2-SNAPSHOT</version>
+ <name>Chan Example App</name>
+
+ <dependencies>
+
+ <dependency>
+
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>1.8</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.7.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-chain</groupId>
+ <artifactId>commons-chain</artifactId>
+ <version>1.2-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>myfaces</groupId>
+ <artifactId>myfaces-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.12</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>taglibs</groupId>
+ <artifactId>standard</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+ </dependencies>
+
+<!--
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/dep.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/systest/**</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+-->
+
+
+</project>
Propchange: jakarta/commons/proper/chain/trunk/apps/example/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/proper/chain/trunk/apps/example/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/CountCommand.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/CountCommand.java?view=auto&rev=532952
==============================================================================
--- jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/CountCommand.java (added)
+++ jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/CountCommand.java Thu Apr 26 21:00:53 2007
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.chain.apps.example;
+
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.chain.web.WebContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+/**
+ * <p>Bar Command</p>
+ *
+ * @version $Revision$ $Date$
+ */
+
+public class CountCommand implements Command {
+
+
+ private Log log = LogFactory.getLog(CountCommand.class);
+
+ private int count;
+
+ private String attribute = "count";
+
+
+ /**
+ * Return the request attribute name to store the count under.
+ *
+ * @return The name of the request attribute
+ */
+ public String getAttribute() {
+ return attribute;
+ }
+
+
+ /**
+ * Set the request attribute name to store the count under.
+ *
+ * @param attribute The name of the request attribute
+ */
+ public void setAttribute(String attribute) {
+ this.attribute = attribute;
+ }
+
+
+ /**
+ * <p>Execute the command.</p>
+ *
+ * @param context The {@link Context} we are operating on
+ * @return <code>false</code> so that processng will continue
+ * @throws Exception If an error occurs during execution.
+ */
+ public boolean execute(Context context) throws Exception {
+
+ count++;
+ log.info("Executing: " + attribute + "=" + count);
+
+ WebContext webContext = (WebContext)context;
+ webContext.getSessionScope().put(attribute, new Integer(count));
+
+ return false;
+
+ }
+
+
+}
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/CountCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/CountCommand.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ExampleServlet.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ExampleServlet.java?view=auto&rev=532952
==============================================================================
--- jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ExampleServlet.java (added)
+++ jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ExampleServlet.java Thu Apr 26 21:00:53 2007
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.chain.apps.example;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.CatalogFactory;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.web.servlet.ServletWebContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Custom chain servlet implementation.
+ */
+public class ExampleServlet extends HttpServlet {
+
+ private String servletName;
+
+ /**
+ * <p>Cache the name of the servlet.</p>
+ *
+ * @exception ServletException if an initialization error occurs
+ */
+ public void init() throws ServletException {
+ super.init();
+ Log log = LogFactory.getLog(ExampleServlet.class);
+ servletName = getServletConfig().getServletName();
+ if (log.isInfoEnabled()) {
+ log.info("Initializing chain example servlet '"
+ + servletName + "'");
+ }
+ }
+
+
+ /**
+ * <p>Configure a {@link ServletWebContext} for the current request, and
+ * pass it to the <code>execute()</code> method of the specified
+ * {@link Command}, loaded from our configured {@link Catalog}.</p>
+ *
+ * @param request The request we are processing
+ * @param response The response we are creating
+ *
+ * @exception IOException if an input/output error occurs
+ * @exception ServletException if a servlet exception occurs
+ */
+ public void service(HttpServletRequest request,
+ HttpServletResponse response)
+ throws IOException, ServletException {
+
+ CatalogFactory factory = CatalogFactory.getInstance();
+ Catalog catalog = factory.getCatalog(servletName);
+ if (catalog == null) {
+ catalog = factory.getCatalog();
+ }
+
+ ServletWebContext context =
+ new ServletWebContext(getServletContext(), request, response);
+ Command command = catalog.getCommand("COMMAND_MAPPER");
+ try {
+ command.execute(context);
+ } catch (Exception e) {
+ throw new ServletException(e);
+ }
+
+ }
+
+}
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ExampleServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ExampleServlet.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ForwardCommand.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ForwardCommand.java?view=auto&rev=532952
==============================================================================
--- jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ForwardCommand.java (added)
+++ jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ForwardCommand.java Thu Apr 26 21:00:53 2007
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.chain.apps.example;
+
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.chain.web.servlet.ServletWebContext;
+import javax.servlet.RequestDispatcher;
+
+/**
+ * <p>Foo Command</p>
+ *
+ * @version $Revision$ $Date$
+ */
+
+public class ForwardCommand implements Command {
+
+
+ private Log log = LogFactory.getLog(ForwardCommand.class);
+
+ private String forward;
+
+
+ /**
+ * Return the uri to forward to.
+ *
+ * @return The uri to forward to
+ */
+ public String getForward() {
+ return forward;
+ }
+
+
+ /**
+ * Set the uri to forward to.
+ *
+ * @param forward The uri to forward to
+ */
+ public void setForward(String forward) {
+ this.forward = forward;
+ }
+
+ /**
+ * <p>Execute the command.</p>
+ *
+ * @param context The {@link Context} we are operating on
+ * @return <code>false</code> so that processng will continue
+ * @throws Exception If an error occurs during execution.
+ */
+ public boolean execute(Context context) throws Exception {
+
+ String uri = getForward(context);
+ if (uri != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Forwarding to " + uri);
+ }
+ ServletWebContext swcontext = (ServletWebContext)context;
+ RequestDispatcher rd = swcontext.getContext().getRequestDispatcher(uri);
+ rd.forward(swcontext.getRequest(), swcontext.getResponse());
+ return true;
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("No forward found");
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Return the uri to forward to.
+ *
+ * @param context The {@link Context} we are operating on
+ * @return The uri to forward to
+ */
+ protected String getForward(Context context) {
+ String uri = (String)context.get("forward");
+ if (uri == null) {
+ uri = getForward();
+ }
+ return uri;
+ }
+
+}
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ForwardCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/java/org/apache/commons/chain/apps/example/ForwardCommand.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/chain-config.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/chain-config.xml?view=auto&rev=532952
==============================================================================
--- jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/chain-config.xml (added)
+++ jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/chain-config.xml Thu Apr 26 21:00:53 2007
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+<catalogs>
+
+ <!-- Default Catalog: "Path Info" example -->
+ <catalog>
+
+ <!-- Command that maps "Path Info" patterns to Commands -->
+ <chain name="COMMAND_MAPPER">
+ <command className="org.apache.commons.chain.web.servlet.PathInfoMapper"/>
+ <command forward="/pathinfo.jsp" className="org.apache.commons.chain.apps.example.ForwardCommand"/>
+ </chain>
+
+ <!-- Foo Command -->
+ <chain name="/foo">
+ <command attribute="pathinfoFooCount" className="org.apache.commons.chain.apps.example.CountCommand"/>
+ </chain>
+
+ <!-- Bar Command -->
+ <chain name="/bar">
+ <command attribute="pathinfoBarCount" className="org.apache.commons.chain.apps.example.CountCommand"/>
+ </chain>
+
+ </catalog>
+
+ <!-- Catalog for "Request Parameter" example -->
+ <catalog name="reqparam">
+
+ <!-- Command that maps a "Request Parameter" to Commands -->
+ <chain name="COMMAND_MAPPER">
+ <command catalogName="reqparam" className="org.apache.commons.chain.web.servlet.RequestParameterMapper"/>
+ <command forward="/reqparam.jsp" className="org.apache.commons.chain.apps.example.ForwardCommand"/>
+ </chain>
+
+ <!-- Foo Command -->
+ <chain name="foo">
+ <command attribute="reqparamFooCount" className="org.apache.commons.chain.apps.example.CountCommand"/>
+ </chain>
+
+ <!-- Bar Command -->
+ <chain name="bar">
+ <command attribute="reqparamBarCount" className="org.apache.commons.chain.apps.example.CountCommand"/>
+ </chain>
+
+ </catalog>
+
+ <!-- Catalog for "Servlet Path" example -->
+ <catalog name="servletpath">
+
+ <!-- Command that maps "Servlet Path" patterns to Commands -->
+ <chain name="COMMAND_MAPPER">
+ <command catalogName="servletpath" className="org.apache.commons.chain.web.servlet.ServletPathMapper"/>
+ <command forward="/servletpath.jsp" className="org.apache.commons.chain.apps.example.ForwardCommand"/>
+ </chain>
+
+ <!-- Foo Command -->
+ <chain name="/foo.execute">
+ <command attribute="servletpathFooCount" className="org.apache.commons.chain.apps.example.CountCommand"/>
+ </chain>
+
+ <!-- Bar Command -->
+ <chain name="/bar.execute">
+ <command attribute="servletpathBarCount" className="org.apache.commons.chain.apps.example.CountCommand"/>
+ </chain>
+
+
+ </catalog>
+
+</catalogs>
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/chain-config.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/chain-config.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/classes/log4j.properties
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/classes/log4j.properties?view=auto&rev=532952
==============================================================================
--- jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/classes/log4j.properties (added)
+++ jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/classes/log4j.properties Thu Apr 26 21:00:53 2007
@@ -0,0 +1,37 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#---------------------------------------------------------#
+# Properties File to control logging by Log4j #
+#---------------------------------------------------------#
+log4j.logger.org.apache.commons.chain=DEBUG, STD
+log4j.logger.org.apache.commons.digester=INFO, STD
+log4j.logger.org.apache.commons.beanutils=WARN, STD
+
+#---------------------------------------------------------#
+# Direct 'STD' logger to the 'Console' #
+#---------------------------------------------------------#
+#log4j.appender.STD=org.apache.log4j.ConsoleAppender
+#log4j.appender.STD.layout=org.apache.log4j.PatternLayout
+#log4j.appender.STD.layout.ConversionPattern=[%c] %-5p: %m%n
+
+#---------------------------------------------------------#
+# Direct 'STD' logger to a log file #
+#---------------------------------------------------------#
+log4j.appender.STD=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.STD.File=../logs/chain-example-log.txt
+log4j.appender.STD.DatePattern='.'yyyy-MM-dd
+log4j.appender.STD.layout=org.apache.log4j.PatternLayout
+log4j.appender.STD.layout.ConversionPattern=%d [%c] %-5p: %m%n
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/classes/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/web.xml?view=auto&rev=532952
==============================================================================
--- jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/web.xml (added)
+++ jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/web.xml Thu Apr 26 21:00:53 2007
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <display-name>Chain Example</display-name>
+
+ <context-param>
+ <param-name>org.apache.commons.chain.CONFIG_WEB_RESOURCE</param-name>
+ <param-value>/WEB-INF/chain-config.xml</param-value>
+ </context-param>
+
+ <!-- Configuration Listener -->
+ <listener>
+ <listener-class>
+ org.apache.commons.chain.web.ChainListener
+ </listener-class>
+ </listener>
+
+ <!-- "Path Info" Servlet Configuration -->
+ <servlet>
+ <servlet-name>pathinfo</servlet-name>
+ <servlet-class>org.apache.commons.chain.apps.example.ExampleServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!-- "Request Parameter" Servlet Configuration -->
+ <servlet>
+ <servlet-name>reqparam</servlet-name>
+ <servlet-class>org.apache.commons.chain.apps.example.ExampleServlet</servlet-class>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+
+ <!-- "Servlet Path" Servlet Configuration -->
+ <servlet>
+ <servlet-name>servletpath</servlet-name>
+ <servlet-class>org.apache.commons.chain.apps.example.ExampleServlet</servlet-class>
+ <load-on-startup>3</load-on-startup>
+ </servlet>
+
+ <!-- "Path Info" Servlet Mappings -->
+ <servlet-mapping>
+ <servlet-name>pathinfo</servlet-name>
+ <url-pattern>/exec/*</url-pattern>
+ </servlet-mapping>
+
+ <!-- "Request Parameter" Servlet Mappings -->
+ <servlet-mapping>
+ <servlet-name>reqparam</servlet-name>
+ <url-pattern>/execute</url-pattern>
+ </servlet-mapping>
+
+ <!-- "Servlet Path" Servlet Mappings -->
+ <servlet-mapping>
+ <servlet-name>servletpath</servlet-name>
+ <url-pattern>*.execute</url-pattern>
+ </servlet-mapping>
+
+ <!-- Welcome File List -->
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/index.jsp?view=auto&rev=532952
==============================================================================
--- jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/index.jsp (added)
+++ jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/index.jsp Thu Apr 26 21:00:53 2007
@@ -0,0 +1,62 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<%@ page language="java"%>
+<%@ page contentType="text/html;charset=ISO-8859-1"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+ <head>
+ <title>Chain Example Index Page</title>
+ </head>
+ <body>
+
+ <h1>Chain Example Index Page</h1>
+
+ <ul>
+ <li>Path Info Example</li>
+ <ul>
+ <li><a href="exec/foo">Foo Page</a></li>
+ <li><a href="exec/bar">Bar Page</a></li>
+ </ul>
+ <li>Request Parameter Example</li>
+ <ul>
+ <li><a href="execute?command=foo">Foo Page</a></li>
+ <li><a href="execute?command=bar">Bar Page</a></li>
+ </ul>
+ <li>Servlet Path</li>
+ <ul>
+ <li><a href="foo.execute">Foo Page</a></li>
+ <li><a href="bar.execute">Bar Page</a></li>
+ </ul>
+ </ul>
+
+ <table border="1">
+ <tr><th>Example</th><th>Command</th><th>Count</th></tr>
+ <tr><td rowspan="2" valign="top">Path Info</td><td>Foo</td><td><c:out value="${pathinfoFooCount}" default="0"/></td></tr>
+ <tr><td>Bar</td><td><c:out value="${pathinfoBarCount}" default="0"/></td></tr>
+ <tr><td rowspan="2" valign="top">Request Parameter</td><td>Foo</td><td><c:out value="${reqparamFooCount}" default="0"/></td></tr>
+ <tr><td>Bar</td><td><c:out value="${reqparamBarCount}" default="0"/></td></tr>
+ <tr><td rowspan="2" valign="top">Servlet path</td><td>Foo</td><td><c:out value="${servletpathFooCount}" default="0"/></td></tr>
+ <tr><td>Bar</td><td><c:out value="${servletpathBarCount}" default="0"/></td></tr>
+ </table>
+
+ </body>
+</html>
+
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/index.jsp
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/pathinfo.jsp
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/pathinfo.jsp?view=auto&rev=532952
==============================================================================
--- jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/pathinfo.jsp (added)
+++ jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/pathinfo.jsp Thu Apr 26 21:00:53 2007
@@ -0,0 +1,51 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<%@ page language="java"%>
+<%@ page contentType="text/html;charset=ISO-8859-1"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+ <head>
+ <title>Path Info Example: Bar</title>
+ </head>
+ <body>
+
+ <h1>Path Info Example: Bar</h1>
+
+ <ul>
+ <li><a href="../index.jsp">Index Page</a></li>
+ <li><a href="foo">Foo Page</a></li>
+ <li><a href="bar">Bar Page</a></li>
+ </ul>
+
+
+ <table border="1">
+ <tr><th>Example</th><th>Command</th><th>Count</th></tr>
+ <tr><td rowspan="2" valign="top">Path Info</td><td>Foo</td><td><c:out value="${pathinfoFooCount}" default="0"/></td></tr>
+ <tr><td>Bar</td><td><c:out value="${pathinfoBarCount}" default="0"/></td></tr>
+ <tr><td rowspan="2" valign="top">Request Parameter</td><td>Foo</td><td><c:out value="${reqparamFooCount}" default="0"/></td></tr>
+ <tr><td>Bar</td><td><c:out value="${reqparamBarCount}" default="0"/></td></tr>
+ <tr><td rowspan="2" valign="top">Servlet path</td><td>Foo</td><td><c:out value="${servletpathFooCount}" default="0"/></td></tr>
+ <tr><td>Bar</td><td><c:out value="${servletpathBarCount}" default="0"/></td></tr>
+ </table>
+
+ </body>
+</html>
+
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/pathinfo.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/pathinfo.jsp
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/reqparam.jsp
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/reqparam.jsp?view=auto&rev=532952
==============================================================================
--- jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/reqparam.jsp (added)
+++ jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/reqparam.jsp Thu Apr 26 21:00:53 2007
@@ -0,0 +1,51 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<%@ page language="java"%>
+<%@ page contentType="text/html;charset=ISO-8859-1"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+ <head>
+ <title>Request Parameter Example</title>
+ </head>
+ <body>
+
+ <h1>Request Parameter Example</h1>
+
+ <ul>
+ <li><a href="index.jsp">Index Page</a></li>
+ <li><a href="execute?command=foo">Foo Page</a></li>
+ <li><a href="execute?command=bar">Bar Page</a></li>
+ </ul>
+
+
+ <table border="1">
+ <tr><th>Example</th><th>Command</th><th>Count</th></tr>
+ <tr><td rowspan="2" valign="top">Path Info</td><td>Foo</td><td><c:out value="${pathinfoFooCount}" default="0"/></td></tr>
+ <tr><td>Bar</td><td><c:out value="${pathinfoBarCount}" default="0"/></td></tr>
+ <tr><td rowspan="2" valign="top">Request Parameter</td><td>Foo</td><td><c:out value="${reqparamFooCount}" default="0"/></td></tr>
+ <tr><td>Bar</td><td><c:out value="${reqparamBarCount}" default="0"/></td></tr>
+ <tr><td rowspan="2" valign="top">Servlet path</td><td>Foo</td><td><c:out value="${servletpathFooCount}" default="0"/></td></tr>
+ <tr><td>Bar</td><td><c:out value="${servletpathBarCount}" default="0"/></td></tr>
+ </table>
+
+ </body>
+</html>
+
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/reqparam.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/reqparam.jsp
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/servletpath.jsp
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/servletpath.jsp?view=auto&rev=532952
==============================================================================
--- jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/servletpath.jsp (added)
+++ jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/servletpath.jsp Thu Apr 26 21:00:53 2007
@@ -0,0 +1,50 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<%@ page language="java"%>
+<%@ page contentType="text/html;charset=ISO-8859-1"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+ <head>
+ <title>Servlet Path Example</title>
+ </head>
+ <body>
+
+ <h1>Servlet Path Example</h1>
+
+ <ul>
+ <li><a href="index.jsp">Index Page</a></li>
+ <li><a href="foo.execute">Foo Page</a></li>
+ <li><a href="bar.execute">Bar Page</a></li>
+ </ul>
+
+ <table border="1">
+ <tr><th>Example</th><th>Command</th><th>Count</th></tr>
+ <tr><td rowspan="2" valign="top">Path Info</td><td>Foo</td><td><c:out value="${pathinfoFooCount}" default="0"/></td></tr>
+ <tr><td>Bar</td><td><c:out value="${pathinfoBarCount}" default="0"/></td></tr>
+ <tr><td rowspan="2" valign="top">Request Parameter</td><td>Foo</td><td><c:out value="${reqparamFooCount}" default="0"/></td></tr>
+ <tr><td>Bar</td><td><c:out value="${reqparamBarCount}" default="0"/></td></tr>
+ <tr><td rowspan="2" valign="top">Servlet path</td><td>Foo</td><td><c:out value="${servletpathFooCount}" default="0"/></td></tr>
+ <tr><td>Bar</td><td><c:out value="${servletpathBarCount}" default="0"/></td></tr>
+ </table>
+
+ </body>
+</html>
+
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/servletpath.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/proper/chain/trunk/apps/example/src/main/webapp/servletpath.jsp
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org