You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2016/02/04 08:18:23 UTC

[2/2] struts-examples git commit: Adds new app to show how to use MessageStore

Adds new app to show how to use MessageStore


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

Branch: refs/heads/master
Commit: 74c60c11f207e69e8ef03bd1f9e9224e0f823b0b
Parents: 496a01b
Author: Lukasz Lenart <lu...@gmail.com>
Authored: Thu Feb 4 08:18:02 2016 +0100
Committer: Lukasz Lenart <lu...@gmail.com>
Committed: Thu Feb 4 08:18:02 2016 +0100

----------------------------------------------------------------------
 message-store/pom.xml                           | 50 ++++++++++++++++++++
 .../org/apache/struts/example/HelloWorld1.java  | 33 +++++++++++++
 .../org/apache/struts/example/HelloWorld2.java  | 32 +++++++++++++
 message-store/src/main/resources/example.xml    | 37 +++++++++++++++
 message-store/src/main/resources/log4j2.xml     | 16 +++++++
 message-store/src/main/resources/struts.xml     | 25 ++++++++++
 .../main/webapp/WEB-INF/example/HelloWorld2.jsp | 13 +++++
 message-store/src/main/webapp/WEB-INF/web.xml   | 23 +++++++++
 message-store/src/main/webapp/index.html        | 10 ++++
 9 files changed, 239 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-examples/blob/74c60c11/message-store/pom.xml
----------------------------------------------------------------------
diff --git a/message-store/pom.xml b/message-store/pom.xml
new file mode 100644
index 0000000..f90d3c0
--- /dev/null
+++ b/message-store/pom.xml
@@ -0,0 +1,50 @@
+<?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>
+
+  <artifactId>message-store</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>war</packaging>
+  <name>message-store</name>
+
+  <dependencies>
+    <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/74c60c11/message-store/src/main/java/org/apache/struts/example/HelloWorld1.java
----------------------------------------------------------------------
diff --git a/message-store/src/main/java/org/apache/struts/example/HelloWorld1.java b/message-store/src/main/java/org/apache/struts/example/HelloWorld1.java
new file mode 100644
index 0000000..ddd9b09
--- /dev/null
+++ b/message-store/src/main/java/org/apache/struts/example/HelloWorld1.java
@@ -0,0 +1,33 @@
+/*
+ * $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.example;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+public class HelloWorld1 extends ActionSupport {
+
+    public String execute() throws Exception {
+        addActionError("Hello from HelloWorld1!");
+        return SUCCESS;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/74c60c11/message-store/src/main/java/org/apache/struts/example/HelloWorld2.java
----------------------------------------------------------------------
diff --git a/message-store/src/main/java/org/apache/struts/example/HelloWorld2.java b/message-store/src/main/java/org/apache/struts/example/HelloWorld2.java
new file mode 100644
index 0000000..5e92dd3
--- /dev/null
+++ b/message-store/src/main/java/org/apache/struts/example/HelloWorld2.java
@@ -0,0 +1,32 @@
+/*
+ * $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.example;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+public class HelloWorld2 extends ActionSupport {
+
+    public String execute() throws Exception {
+        return SUCCESS;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/74c60c11/message-store/src/main/resources/example.xml
----------------------------------------------------------------------
diff --git a/message-store/src/main/resources/example.xml b/message-store/src/main/resources/example.xml
new file mode 100644
index 0000000..dd68bec
--- /dev/null
+++ b/message-store/src/main/resources/example.xml
@@ -0,0 +1,37 @@
+<?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="example" namespace="/example" extends="struts-default">
+
+        <default-action-ref name="HelloWorld" />
+
+        <action name="HelloWorld1" class="org.apache.struts.example.HelloWorld1">
+            <interceptor-ref name="createSession"/>
+            <interceptor-ref name="basicStack"/>
+            <interceptor-ref name="store">
+                <param name="operationMode">AUTOMATIC</param>
+            </interceptor-ref>
+
+            <result type="redirectAction">HelloWorld2</result>
+
+        </action>
+
+        <action name="HelloWorld2" class="org.apache.struts.example.HelloWorld2">
+            <interceptor-ref name="createSession"/>
+            <interceptor-ref name="basicStack"/>
+            <interceptor-ref name="store">
+                <param name="operationMode">AUTOMATIC</param>
+            </interceptor-ref>
+
+            <result>/WEB-INF/example/HelloWorld2.jsp</result>
+
+        </action>
+
+    </package>
+</struts>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/74c60c11/message-store/src/main/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/message-store/src/main/resources/log4j2.xml b/message-store/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..9160e24
--- /dev/null
+++ b/message-store/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/74c60c11/message-store/src/main/resources/struts.xml
----------------------------------------------------------------------
diff --git a/message-store/src/main/resources/struts.xml b/message-store/src/main/resources/struts.xml
new file mode 100644
index 0000000..bd842e9
--- /dev/null
+++ b/message-store/src/main/resources/struts.xml
@@ -0,0 +1,25 @@
+<?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"/>
+
+    <include file="example.xml"/>
+
+    <package name="default" namespace="/" extends="struts-default">
+
+        <default-action-ref name="index"/>
+
+        <action name="index">
+            <result type="redirectAction">
+                <param name="actionName">HelloWorld1</param>
+                <param name="namespace">/example</param>
+            </result>
+        </action>
+
+    </package>
+
+    <!-- Add addition packages and configuration here. -->
+</struts>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/74c60c11/message-store/src/main/webapp/WEB-INF/example/HelloWorld2.jsp
----------------------------------------------------------------------
diff --git a/message-store/src/main/webapp/WEB-INF/example/HelloWorld2.jsp b/message-store/src/main/webapp/WEB-INF/example/HelloWorld2.jsp
new file mode 100644
index 0000000..25f6f73
--- /dev/null
+++ b/message-store/src/main/webapp/WEB-INF/example/HelloWorld2.jsp
@@ -0,0 +1,13 @@
+<%@ page contentType="text/html; charset=UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<html>
+<head>
+    <title>Message store</title>
+</head>
+
+<body>
+
+<s:actionerror/>
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/74c60c11/message-store/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/message-store/src/main/webapp/WEB-INF/web.xml b/message-store/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..8858656
--- /dev/null
+++ b/message-store/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.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/74c60c11/message-store/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/message-store/src/main/webapp/index.html b/message-store/src/main/webapp/index.html
new file mode 100644
index 0000000..abdee36
--- /dev/null
+++ b/message-store/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=index.action">
+</head>
+
+<body>
+<p>Loading ...</p>
+</body>
+</html>