[struts-site] branch master updated: Defines output dir
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts-site.git The following commit(s) were added to refs/heads/master by this push: new e329a36 Defines output dir e329a36 is described below commit e329a36e4a5e1e8c43c32694f1b8da23fb2c13e7 Author: Lukasz Lenart AuthorDate: Mon Mar 23 19:34:48 2020 +0100 Defines output dir --- .asf.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.asf.yaml b/.asf.yaml index ef25d99..eac0130 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -9,3 +9,4 @@ publish: jekyll: whoami: master target: asf-site + outputdir: content
Buildbot success in on jekyll_websites
The Buildbot has detected a passing build on builder jekyll_websites while building struts. Full details are available at: https://ci2.apache.org/#builders/7/builds/56 Buildbot URL: https://ci2.apache.org/ Worker for this Build: bb_slave10_ubuntu Build Reason: Triggered jekyll auto-build via .asf.yaml by lukaszlenart Blamelist: asfinfra, commits@struts.apache.org Build succeeded! Sincerely, -The Buildbot
[struts-site] branch master updated: Adds missing page to test .asf.yaml settings
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts-site.git The following commit(s) were added to refs/heads/master by this push: new 3d852d3 Adds missing page to test .asf.yaml settings 3d852d3 is described below commit 3d852d3c318fdb1485b98317a926c2690d69b5d4 Author: Lukasz Lenart AuthorDate: Mon Mar 23 19:58:59 2020 +0100 Adds missing page to test .asf.yaml settings --- ...extending-an-application-with-custom-plugins.md | 121 + source/plugins/index.md| 6 +- 2 files changed, 124 insertions(+), 3 deletions(-) diff --git a/source/plugins/extending-an-application-with-custom-plugins.md b/source/plugins/extending-an-application-with-custom-plugins.md new file mode 100644 index 000..59504cc --- /dev/null +++ b/source/plugins/extending-an-application-with-custom-plugins.md @@ -0,0 +1,121 @@ +--- +layout: default +title: Plugins +--- + +# Extending an Application with Custom Plugins + +In this tutorial, we will show how easily our application can be made extensible using the Struts 2 plugin mechanism. +To keep the demonstration simple, our plugin will expose a JavaBean that writes a message. Plugins may include any +combination of JavaBeans, Actions, Interceptors, Results or other resources we'd like available to an application. + +## The Interface + +At runtime, plugins are retrieved and referenced via an Interface. So, first, we should define an interface that our +plugin will implement. This interface must be available to both our web application and the plugin. To reduce coupling +between the web application and the plugins, keep the interface in a separate JAR. + +**IMyPlugin.java** + +```java +package example; + +public interface IMyPlugIn { + String saySomething(); +} +``` + +## The Plugin + +Now that we have an interface to implement we'll create the plugin. At load time, the framework looks for JARs +containing a `struts-plugin.xml` file at the root of the archive. To create a plugin, all we need to do is build +a JAR and put the expected `struts-plugin.xml` at the root. + +To get started, let's create a class that implements our IMyPlugin interface. + +**MyPlugin.java** + +```java +package example.impl; + +import example.IMyPlugin; + +public class MyPlugin implements IMyPlugin { + public String saySomething() { + return "We don't need no education"; + } +} +``` + +Internally, the framework utilizes a number of JavaBeans. We can use the `bean` element to add our own JavaBeans +to the set managed by the framework. + +**struts-default.xml** + +```xml + + +http://struts.apache.org/dtds/struts-2.5.dtd";> + + + + +``` + +Finally, to install the plugin, drop the JAR file under WEB-INF/lib. + +## The Action + +The JavaBeans configured by `bean` elements can be retrieved via a Container provided by XWork 2. We obtain +a reference to the Container by using the `@Inject` notation. (This notation is part of the Guice framework that +XWork and Struts use under the covers.) The framework predefines a Container object, and the `@Inject` annotation tells +the framework to set its Container object to the Action property. + +We might want to supply a number of JavaBeans to the application this way. In the Action, we will obtain a reference +to the entire set of JavaBeans that might have been plugged in. Then, we can scroll through the set, displaying each +JavaBean's message. + +**MyAction.java** + +```java +package example.actions; + +import example.IMyPlugin; + +public class MyAction extends ActionSupport { +Set plugins; + +@Inject +public void setContainer(Container container) { +Set names = container.getInstanceNames(IMyPlugin.class); +plugins = new HashSet(); +for (String name : names) { +plugins.add(container.getInstance(IMyPlugin.class, name)); +} +} + +public Set getPlugins() { +return this.plugins; +} +} +``` + +As seen by the Action class code, it's important to define a unique interface for any beans that we plugin, so that +we can identify our beans later. + +In the same way that we plugged in this JavaBean, we could also plugin and configure Action classes, Interceptors, +Results, or any other JAR-able resource that an application might utilize. + +## The JSP + +Let's do something with those plugins: + +**Page.jsp** + +```jsp + + + +``` diff --git a/source/plugins/index.md b/source/plugins/index.md index d9f13fb..e4068f6 100644 --- a/source/plugins/index.md +++ b/source/plugins/index.md @@ -5,12 +5,12 @@ title: Plugins # Plugin Developers Guide -Apache Struts 2 provides a simple [plugin architecture](plugins.html) so that developers can extend the framework just +Apache Struts 2 provides a simple [plugin architecture](plugins) so that developers can extend the framework just by
[struts-site] branch asf-site updated: Automatic Site Publish by Buildbot
This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/struts-site.git The following commit(s) were added to refs/heads/asf-site by this push: new ab71cea Automatic Site Publish by Buildbot ab71cea is described below commit ab71cea2f082410ceabaa34557b5c5b62a948e0a Author: buildbot AuthorDate: Mon Mar 23 19:00:00 2020 + Automatic Site Publish by Buildbot --- ...tending-an-application-with-custom-plugins.html | 282 + output/plugins/index.html | 6 +- 2 files changed, 285 insertions(+), 3 deletions(-) diff --git a/output/plugins/extending-an-application-with-custom-plugins.html b/output/plugins/extending-an-application-with-custom-plugins.html new file mode 100644 index 000..bb69c28 --- /dev/null +++ b/output/plugins/extending-an-application-with-custom-plugins.html @@ -0,0 +1,282 @@ + + + + + + + + + + Plugins + + + + + + + + + + + + + +http://github.com/apache/struts"; class="github-ribbon"> + https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa.png"; alt="Fork me on GitHub"> + + + + + + + + +Menu +Toggle navigation + + + + + + + + + + +Home + + +Welcome +Download +Releases +Announcements +http://www.apache.org/licenses/";>License +https://www.apache.org/foundation/thanks.html";>Thanks! +https://www.apache.org/foundation/sponsorship.html";>Sponsorship + + + + +Support + + +User Mailing List +https://issues.apache.org/jira/browse/WW";>Issue Tracker +Reporting Security Issues + +https://cwiki.apache.org/confluence/display/WW/Migration+Guide";>Version Notes +https://cwiki.apache.org/confluence/display/WW/Security+Bulletins";>Security Bulletins + +Maven Project Info +Struts Core Dependencies +Plugin Dependencies + + + + +Documentation + + +Birds Eye +Key Technologies +Kickstart FAQ +https://cwiki.apache.org/confluence/display/WW/Home";>Wiki + +Getting Started +Security Guide +Core Developers Guide +Tag Developers Guide +Maven Archetypes +Plugins +Struts Core API +Tag reference +https://cwiki.apache.org/confluence/display/WW/FAQs";>FAQs +http://cwiki.apache.org/S2PLUGINS/home.html";>Plugin registry + + + + +Contributing + + +You at Struts +How to Help FAQ +Development Lists + +Submitting patches +Source Code and Builds +Coding standards +https://cwiki.apache.org/confluence/display/WW/Contributors+Guide";>Contributors Guide + +Release Guidelines +PMC Charter +Volunteers +https://gitbox.apache.org/repos/asf?p=struts.git";>Source Repository + + +http://www.apache.org/";> + + + + + + + + + + +https://github.com/apache/struts-site/edit/master/source/plugins/extending-an-application-with-custom-plugins.md"; title="Edit this page on GitHub">Edit on GitHub + +Extending an Application with Custom Plugins + +In this tutorial, we will show how easily our application can be made extensible using the Struts 2 plugin mechanism. +To keep the demonstration simple, our plugin will expose a JavaBean that writes a message. Plugins may include any +combination of JavaBeans, Actions, Interceptors, Results or other resources we’d like available to an application. + +The Interface + +At runtime, plugins are retrieved and referenced via an Interface. So, first, we should define an interface that our +plugin will implement. This interface must be available to both our web application and the plugin. To reduce coupling +between the web application and the plugins, keep the interface in a separate JAR. + +IMyPlugin.java + +package example; + +public interface IMyPlugIn { + String saySomething(); +} + + +The Plugin + +No
Buildbot success in on jekyll_websites
The Buildbot has detected a passing build on builder jekyll_websites while building struts. Full details are available at: https://ci2.apache.org/#builders/7/builds/57 Buildbot URL: https://ci2.apache.org/ Worker for this Build: bb_slave10_ubuntu Build Reason: Triggered jekyll auto-build via .asf.yaml by lukaszlenart Blamelist: asfinfra, commits@struts.apache.org Build succeeded! Sincerely, -The Buildbot
[struts-site] 02/02: Adds ToC
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts-site.git commit cafd698027219dc8cf447facb54f55ddb81d014e Author: Lukasz Lenart AuthorDate: Mon Mar 23 20:04:37 2020 +0100 Adds ToC --- source/plugins/extending-an-application-with-custom-plugins.md | 4 1 file changed, 4 insertions(+) diff --git a/source/plugins/extending-an-application-with-custom-plugins.md b/source/plugins/extending-an-application-with-custom-plugins.md index 59504cc..3ec77d7 100644 --- a/source/plugins/extending-an-application-with-custom-plugins.md +++ b/source/plugins/extending-an-application-with-custom-plugins.md @@ -4,6 +4,10 @@ title: Plugins --- # Extending an Application with Custom Plugins +{:.no_toc} + +* Will be replaced with the ToC, excluding a header +{:toc} In this tutorial, we will show how easily our application can be made extensible using the Struts 2 plugin mechanism. To keep the demonstration simple, our plugin will expose a JavaBean that writes a message. Plugins may include any
[struts-site] 01/02: Restores generating website into content
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts-site.git commit 51aaedc3cd77c181987ce8c7921e49c64efa5c52 Author: Lukasz Lenart AuthorDate: Mon Mar 23 20:03:19 2020 +0100 Restores generating website into content --- _config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/_config.yml b/_config.yml index eba921b..0bcb20a 100644 --- a/_config.yml +++ b/_config.yml @@ -2,6 +2,7 @@ name: Apache Struts markdown: kramdown markdown_ext: md source: source +destination:content encoding: UTF-8 highlighter:rouge kramdown:
[struts-site] branch master updated (3d852d3 -> cafd698)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/struts-site.git. from 3d852d3 Adds missing page to test .asf.yaml settings new 51aaedc Restores generating website into content new cafd698 Adds ToC The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: _config.yml| 1 + source/plugins/extending-an-application-with-custom-plugins.md | 4 2 files changed, 5 insertions(+)
Buildbot failure in on jekyll_websites
The Buildbot has detected a failed build on builder jekyll_websites while building struts. Full details are available at: https://ci2.apache.org/#builders/7/builds/58 Buildbot URL: https://ci2.apache.org/ Worker for this Build: bb_slave10_ubuntu Build Reason: Triggered jekyll auto-build via .asf.yaml by lukaszlenart Blamelist: asfinfra, commits@struts.apache.org BUILD FAILED: failed '/usr/local/bin/jekyll-build.py --sourcetype ...' (failure) Sincerely, -The Buildbot
[struts-site] branch asf-site updated: Updates production by Jenkins
This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/struts-site.git The following commit(s) were added to refs/heads/asf-site by this push: new ca517d7 Updates production by Jenkins ca517d7 is described below commit ca517d7870fab27e7d9e1dde1a70883dedd94596 Author: jenkins AuthorDate: Mon Mar 23 20:11:58 2020 + Updates production by Jenkins --- ...tending-an-application-with-custom-plugins.html | 289 + content/plugins/index.html | 6 +- 2 files changed, 292 insertions(+), 3 deletions(-) diff --git a/content/plugins/extending-an-application-with-custom-plugins.html b/content/plugins/extending-an-application-with-custom-plugins.html new file mode 100644 index 000..7dab2b4 --- /dev/null +++ b/content/plugins/extending-an-application-with-custom-plugins.html @@ -0,0 +1,289 @@ + + + + + + + + + + Plugins + + + + + + + + + + + + + +http://github.com/apache/struts"; class="github-ribbon"> + https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa.png"; alt="Fork me on GitHub"> + + + + + + + + +Menu +Toggle navigation + + + + + + + + + + +Home + + +Welcome +Download +Releases +Announcements +http://www.apache.org/licenses/";>License +https://www.apache.org/foundation/thanks.html";>Thanks! +https://www.apache.org/foundation/sponsorship.html";>Sponsorship + + + + +Support + + +User Mailing List +https://issues.apache.org/jira/browse/WW";>Issue Tracker +Reporting Security Issues + +https://cwiki.apache.org/confluence/display/WW/Migration+Guide";>Version Notes +https://cwiki.apache.org/confluence/display/WW/Security+Bulletins";>Security Bulletins + +Maven Project Info +Struts Core Dependencies +Plugin Dependencies + + + + +Documentation + + +Birds Eye +Key Technologies +Kickstart FAQ +https://cwiki.apache.org/confluence/display/WW/Home";>Wiki + +Getting Started +Security Guide +Core Developers Guide +Tag Developers Guide +Maven Archetypes +Plugins +Struts Core API +Tag reference +https://cwiki.apache.org/confluence/display/WW/FAQs";>FAQs +http://cwiki.apache.org/S2PLUGINS/home.html";>Plugin registry + + + + +Contributing + + +You at Struts +How to Help FAQ +Development Lists + +Submitting patches +Source Code and Builds +Coding standards +https://cwiki.apache.org/confluence/display/WW/Contributors+Guide";>Contributors Guide + +Release Guidelines +PMC Charter +Volunteers +https://gitbox.apache.org/repos/asf?p=struts.git";>Source Repository + + +http://www.apache.org/";> + + + + + + + + + + +https://github.com/apache/struts-site/edit/master/source/plugins/extending-an-application-with-custom-plugins.md"; title="Edit this page on GitHub">Edit on GitHub + +Extending an Application with Custom Plugins + + + The Interface + The Plugin + The Action + The JSP + + +In this tutorial, we will show how easily our application can be made extensible using the Struts 2 plugin mechanism. +To keep the demonstration simple, our plugin will expose a JavaBean that writes a message. Plugins may include any +combination of JavaBeans, Actions, Interceptors, Results or other resources we’d like available to an application. + +The Interface + +At runtime, plugins are retrieved and referenced via an Interface. So, first, we should define an interface that our +plugin will implement. This interface must be available to both our web application and the plugin. To reduce coupling +between the web application and the plugins, keep the interface in a separate JAR. + +IMyPlugin.java + +package example; + +public interface IMyPlugI