Repository: struts-examples
Updated Branches:
  refs/heads/master 47b472a92 -> 544e0730a


Defines new example how to use wildcards and regex


Project: http://git-wip-us.apache.org/repos/asf/struts-examples/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-examples/commit/544e0730
Tree: http://git-wip-us.apache.org/repos/asf/struts-examples/tree/544e0730
Diff: http://git-wip-us.apache.org/repos/asf/struts-examples/diff/544e0730

Branch: refs/heads/master
Commit: 544e0730a3661fcb87280178e83809f88560a4e5
Parents: 47b472a
Author: Lukasz Lenart <lukasz.len...@gmail.com>
Authored: Fri Mar 4 07:32:27 2016 +0100
Committer: Lukasz Lenart <lukasz.len...@gmail.com>
Committed: Fri Mar 4 07:32:27 2016 +0100

----------------------------------------------------------------------
 pom.xml                                         |  1 +
 wildcard-regex/pom.xml                          | 66 ++++++++++++++++++++
 .../main/java/org/apache/struts/form/Start.java | 31 +++++++++
 .../main/java/org/apache/struts/store/Save.java | 41 ++++++++++++
 wildcard-regex/src/main/resources/form.xml      | 19 ++++++
 wildcard-regex/src/main/resources/log4j2.xml    | 16 +++++
 wildcard-regex/src/main/resources/store.xml     | 19 ++++++
 wildcard-regex/src/main/resources/struts.xml    | 27 ++++++++
 .../src/main/webapp/WEB-INF/form/Start.jsp      | 16 +++++
 .../src/main/webapp/WEB-INF/store/Store.jsp     | 13 ++++
 wildcard-regex/src/main/webapp/WEB-INF/web.xml  | 23 +++++++
 wildcard-regex/src/main/webapp/index.html       | 10 +++
 12 files changed, 282 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-examples/blob/544e0730/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 61eb7a5..553a596 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,7 @@
         <module>wildcard-method-selection</module>
         <module>message-store</module>
         <module>type-conversion</module>
+        <module>wildcard-regex</module>
   </modules>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/544e0730/wildcard-regex/pom.xml
----------------------------------------------------------------------
diff --git a/wildcard-regex/pom.xml b/wildcard-regex/pom.xml
new file mode 100644
index 0000000..0609ff9
--- /dev/null
+++ b/wildcard-regex/pom.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+<!--
+  <parent>
+    <artifactId>struts-examples</artifactId>
+    <groupId>org.apache.struts</groupId>
+    <version>1.0.0</version>
+  </parent>
+-->
+
+  <groupId>org.apache.struts</groupId>
+  <artifactId>wildcard-regex</artifactId>
+  <packaging>war</packaging>
+  <version>1</version>
+  <name>Wildcard RegEx pattern matching</name>
+
+  <properties>
+    <struts2.version>2.3.25-SNAPSHOT</struts2.version>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.struts</groupId>
+      <artifactId>struts2-core</artifactId>
+      <version>${struts2.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.4</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>jsp-api</artifactId>
+      <version>2.0</version>
+      <scope>provided</scope>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.mortbay.jetty</groupId>
+        <artifactId>jetty-maven-plugin</artifactId>
+        <version>8.1.16.v20140903</version>
+        <configuration>
+          <stopKey>CTRL+C</stopKey>
+          <stopPort>8999</stopPort>
+          <scanIntervalSeconds>10</scanIntervalSeconds>
+          
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
+          <webAppConfig>
+            <descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
+          </webAppConfig>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/544e0730/wildcard-regex/src/main/java/org/apache/struts/form/Start.java
----------------------------------------------------------------------
diff --git a/wildcard-regex/src/main/java/org/apache/struts/form/Start.java 
b/wildcard-regex/src/main/java/org/apache/struts/form/Start.java
new file mode 100644
index 0000000..fb6b985
--- /dev/null
+++ b/wildcard-regex/src/main/java/org/apache/struts/form/Start.java
@@ -0,0 +1,31 @@
+/*
+ * $Id$
+ *
+ * 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.struts.form;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+public class Start extends ActionSupport {
+
+    public String execute() throws Exception {
+        return SUCCESS;
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/544e0730/wildcard-regex/src/main/java/org/apache/struts/store/Save.java
----------------------------------------------------------------------
diff --git a/wildcard-regex/src/main/java/org/apache/struts/store/Save.java 
b/wildcard-regex/src/main/java/org/apache/struts/store/Save.java
new file mode 100644
index 0000000..fbb4ea5
--- /dev/null
+++ b/wildcard-regex/src/main/java/org/apache/struts/store/Save.java
@@ -0,0 +1,41 @@
+/*
+ * $Id$
+ *
+ * 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.struts.store;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+public class Save extends ActionSupport {
+
+    private String fullName;
+
+    public String store() throws Exception {
+        return SUCCESS;
+    }
+
+    public String getFullName() {
+        return fullName;
+    }
+
+    public void setFullName(String fullName) {
+        this.fullName = fullName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/544e0730/wildcard-regex/src/main/resources/form.xml
----------------------------------------------------------------------
diff --git a/wildcard-regex/src/main/resources/form.xml 
b/wildcard-regex/src/main/resources/form.xml
new file mode 100644
index 0000000..dfed1e9
--- /dev/null
+++ b/wildcard-regex/src/main/resources/form.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE struts PUBLIC
+        "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
+        "http://struts.apache.org/dtds/struts-2.3.dtd";>
+<!-- 
+  - This file is included by the struts.xml file as an example
+  - of how to break up the configuration file into multiple files.
+-->
+<struts>
+    <package name="form" namespace="/form" extends="struts-default">
+
+        <default-action-ref name="Start" />
+
+        <action name="Start" class="org.apache.struts.form.Start">
+            <result>/WEB-INF/form/Start.jsp</result>
+        </action>
+
+    </package>
+</struts>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/544e0730/wildcard-regex/src/main/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/wildcard-regex/src/main/resources/log4j2.xml 
b/wildcard-regex/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..9160e24
--- /dev/null
+++ b/wildcard-regex/src/main/resources/log4j2.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration>
+    <Appenders>
+        <Console name="STDOUT" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Logger name="com.opensymphony.xwork2" level="info"/>
+        <Logger name="org.apache.struts2" level="info"/>
+        <Logger name="org.apache.struts" level="debug"/>
+        <Root level="warn">
+            <AppenderRef ref="STDOUT"/>
+        </Root>
+    </Loggers>
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/544e0730/wildcard-regex/src/main/resources/store.xml
----------------------------------------------------------------------
diff --git a/wildcard-regex/src/main/resources/store.xml 
b/wildcard-regex/src/main/resources/store.xml
new file mode 100644
index 0000000..017c43f
--- /dev/null
+++ b/wildcard-regex/src/main/resources/store.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE struts PUBLIC
+        "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
+        "http://struts.apache.org/dtds/struts-2.3.dtd";>
+<!-- 
+  - This file is included by the struts.xml file as an example
+  - of how to break up the configuration file into multiple files.
+-->
+<struts>
+    <package name="store" namespace="/store" extends="struts-default">
+
+        <default-action-ref name="Save" />
+
+        <action name="Save!*" class="org.apache.struts.form.Start">
+            <result>/WEB-INF/store/Store.jsp</result>
+        </action>
+
+    </package>
+</struts>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/544e0730/wildcard-regex/src/main/resources/struts.xml
----------------------------------------------------------------------
diff --git a/wildcard-regex/src/main/resources/struts.xml 
b/wildcard-regex/src/main/resources/struts.xml
new file mode 100644
index 0000000..f926b2f
--- /dev/null
+++ b/wildcard-regex/src/main/resources/struts.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE struts PUBLIC
+        "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
+        "http://struts.apache.org/dtds/struts-2.3.dtd";>
+<struts>
+    <constant name="struts.enable.DynamicMethodInvocation" value="false"/>
+    <constant name="struts.devMode" value="true"/>
+    <constant name="struts.patternMatcher" value="regex" />
+
+    <include file="form.xml"/>
+    <include file="save.xml"/>
+
+    <package name="default" namespace="/" extends="struts-default">
+
+        <default-action-ref name="index"/>
+
+        <action name="index">
+            <result type="redirectAction">
+                <param name="actionName">Start</param>
+                <param name="namespace">/form</param>
+            </result>
+        </action>
+
+    </package>
+
+    <!-- Add addition packages and configuration here. -->
+</struts>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/544e0730/wildcard-regex/src/main/webapp/WEB-INF/form/Start.jsp
----------------------------------------------------------------------
diff --git a/wildcard-regex/src/main/webapp/WEB-INF/form/Start.jsp 
b/wildcard-regex/src/main/webapp/WEB-INF/form/Start.jsp
new file mode 100644
index 0000000..22b5a44
--- /dev/null
+++ b/wildcard-regex/src/main/webapp/WEB-INF/form/Start.jsp
@@ -0,0 +1,16 @@
+<%@ page contentType="text/html; charset=UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<html>
+<head>
+  <title>Start</title>
+</head>
+
+<body>
+
+<s:form action="Store!store" namespace="/store">
+  User name: <s:textfield name="userName"/>
+  <s:submit/>
+</s:form>
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/544e0730/wildcard-regex/src/main/webapp/WEB-INF/store/Store.jsp
----------------------------------------------------------------------
diff --git a/wildcard-regex/src/main/webapp/WEB-INF/store/Store.jsp 
b/wildcard-regex/src/main/webapp/WEB-INF/store/Store.jsp
new file mode 100644
index 0000000..0dfc080
--- /dev/null
+++ b/wildcard-regex/src/main/webapp/WEB-INF/store/Store.jsp
@@ -0,0 +1,13 @@
+<%@ page contentType="text/html; charset=UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<html>
+<head>
+    <title>Store</title>
+</head>
+
+<body>
+
+Full name: <s:property value="fullName"/>
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/544e0730/wildcard-regex/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/wildcard-regex/src/main/webapp/WEB-INF/web.xml 
b/wildcard-regex/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..d6897e8
--- /dev/null
+++ b/wildcard-regex/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app id="struts_blank" 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>Struts Blank</display-name>
+
+  <filter>
+    <filter-name>struts2</filter-name>
+    <filter-class>
+      org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
+    </filter-class>
+  </filter>
+
+  <filter-mapping>
+    <filter-name>struts2</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+
+  <welcome-file-list>
+    <welcome-file>index.html</welcome-file>
+  </welcome-file-list>
+</web-app>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/544e0730/wildcard-regex/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/wildcard-regex/src/main/webapp/index.html 
b/wildcard-regex/src/main/webapp/index.html
new file mode 100644
index 0000000..dc2bbd0
--- /dev/null
+++ b/wildcard-regex/src/main/webapp/index.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+    <META HTTP-EQUIV="Refresh" CONTENT="0;URL=example/HelloWorld.action">
+</head>
+
+<body>
+<p>Loading ...</p>
+</body>
+</html>

Reply via email to