Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3CD3E200B44 for ; Thu, 14 Jul 2016 11:50:02 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3B351160A52; Thu, 14 Jul 2016 09:50:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C6C0E160A63 for ; Thu, 14 Jul 2016 11:49:59 +0200 (CEST) Received: (qmail 39122 invoked by uid 500); 14 Jul 2016 09:49:58 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 38884 invoked by uid 99); 14 Jul 2016 09:49:58 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jul 2016 09:49:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0F357E9E9C; Thu, 14 Jul 2016 09:49:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lukaszlenart@apache.org To: commits@struts.apache.org Date: Thu, 14 Jul 2016 09:50:01 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [5/6] struts-examples git commit: WW-4660 Moves example portlet app into struts-examples archived-at: Thu, 14 Jul 2016 09:50:02 -0000 WW-4660 Moves example portlet app into struts-examples Project: http://git-wip-us.apache.org/repos/asf/struts-examples/repo Commit: http://git-wip-us.apache.org/repos/asf/struts-examples/commit/1dfc0aa2 Tree: http://git-wip-us.apache.org/repos/asf/struts-examples/tree/1dfc0aa2 Diff: http://git-wip-us.apache.org/repos/asf/struts-examples/diff/1dfc0aa2 Branch: refs/heads/master Commit: 1dfc0aa2081e5ec5a28cfea513e66c728df2fdcd Parents: 81b2df4 Author: Lukasz Lenart Authored: Thu Jul 14 11:49:12 2016 +0200 Committer: Lukasz Lenart Committed: Thu Jul 14 11:49:12 2016 +0200 ---------------------------------------------------------------------- pom.xml | 5 +- portlet/README.txt | 22 ++ portlet/pom.xml | 218 +++++++++++ portlet/src/main/etc/exo/web.xml | 63 +++ .../main/etc/gridsphere/README-gridsphere.txt | 2 + .../main/etc/gridsphere/gridsphere-portlet.xml | 24 ++ portlet/src/main/etc/gridsphere/group.xml | 10 + portlet/src/main/etc/gridsphere/layout.xml | 19 + portlet/src/main/etc/gridsphere/struts-portlet | 0 portlet/src/main/etc/gridsphere/web.xml | 63 +++ .../src/main/etc/jbossportal2.0/jboss-app.xml | 3 + .../main/etc/jbossportal2.0/jboss-portlet.xml | 12 + .../src/main/etc/jbossportal2.0/jboss-web.xml | 3 + .../etc/jbossportal2.0/portlet-instances.xml | 11 + .../etc/jbossportal2.0/struts-portlet-pages.xml | 18 + .../src/main/etc/jbossportal2.2/jboss-app.xml | 3 + .../main/etc/jbossportal2.2/jboss-portlet.xml | 12 + .../src/main/etc/jbossportal2.2/jboss-web.xml | 3 + .../jbossportal2.2/struts-portlet-object.xml | 25 ++ .../src/main/etc/jetspeed2/README-jetspeed2.txt | 1 + .../src/main/etc/jetspeed2/struts-portlet.psml | 20 + portlet/src/main/etc/liferay3.6.1/web.xml | 75 ++++ .../struts2/portlet/example/ExampleAction.java | 39 ++ .../struts2/portlet/example/FormExample.java | 50 +++ .../portlet/example/FormExampleModelDriven.java | 37 ++ .../example/FormExampleWithValidation.java | 47 +++ .../portlet/example/FormResultAction.java | 49 +++ .../struts2/portlet/example/FormTestAction.java | 36 ++ .../portlet/example/SavePrefsAction.java | 62 +++ .../portlet/example/eventing/ProcessAction.java | 61 +++ .../portlet/example/eventing/PublishAction.java | 52 +++ .../example/fileupload/FileUploadAction.java | 81 ++++ .../struts2/portlet/example/model/Name.java | 18 + .../portlet/example/spring/SpringAction.java | 58 +++ .../portlet/example/spring/ThingManager.java | 38 ++ portlet/src/main/resources/LICENSE.txt | 174 +++++++++ portlet/src/main/resources/NOTICE.txt | 5 + portlet/src/main/resources/log4j2.xml | 15 + .../FormExample-formExamplePrg-validation.xml | 13 + ...processTilesFreemarkerExample-validation.xml | 13 + ...mple-processValidationExample-validation.xml | 13 + .../pluto-portal-driver-services-config.xml | 155 ++++++++ portlet/src/main/resources/struts-edit.xml | 48 +++ portlet/src/main/resources/struts-eventing.xml | 21 + portlet/src/main/resources/struts-help.xml | 14 + portlet/src/main/resources/struts-tiles.xml | 27 ++ portlet/src/main/resources/struts-view.xml | 130 +++++++ portlet/src/main/resources/struts.xml | 12 + .../template/xhtml/components/checkbox.vm | 12 + .../template/xhtml/components/datefield.vm | 8 + .../template/xhtml/components/mytextfield.vm | 15 + portlet/src/main/resources/validators.xml | 18 + portlet/src/main/resources/velocity.properties | 1 + .../main/webapp/WEB-INF/applicationContext.xml | 22 ++ .../main/webapp/WEB-INF/edit/defaultEdit.jsp | 5 + .../main/webapp/WEB-INF/edit/formExample.jsp | 5 + .../webapp/WEB-INF/edit/formExampleInput.jsp | 8 + portlet/src/main/webapp/WEB-INF/edit/index.jsp | 11 + .../main/webapp/WEB-INF/edit/namespaceTest.jsp | 4 + .../src/main/webapp/WEB-INF/edit/prefsForm.jsp | 6 + .../src/main/webapp/WEB-INF/edit/prefsSaved.jsp | 5 + portlet/src/main/webapp/WEB-INF/edit/test.jsp | 4 + .../src/main/webapp/WEB-INF/eventing/index.jsp | 11 + .../main/webapp/WEB-INF/eventing/process.jsp | 12 + .../main/webapp/WEB-INF/help/defaultHelp.jsp | 1 + portlet/src/main/webapp/WEB-INF/help/index.jsp | 1 + .../webapp/WEB-INF/jetty-pluto-web-default.xml | 384 +++++++++++++++++++ portlet/src/main/webapp/WEB-INF/portlet.xml | 214 +++++++++++ portlet/src/main/webapp/WEB-INF/readme.txt | 10 + portlet/src/main/webapp/WEB-INF/tiles.xml | 46 +++ .../src/main/webapp/WEB-INF/view/fileUpload.jsp | 13 + .../webapp/WEB-INF/view/fileUploadSuccess.jsp | 14 + .../main/webapp/WEB-INF/view/formExample.jsp | 5 + .../webapp/WEB-INF/view/formExampleInput.jsp | 8 + .../view/formExampleInputModelDriven.jsp | 8 + .../webapp/WEB-INF/view/formExampleInputPrg.jsp | 8 + .../WEB-INF/view/formExampleInputValidation.jsp | 8 + .../formExampleSubmitToSelfWithValidation.jsp | 6 + .../webapp/WEB-INF/view/freeMarkerExample.ftl | 3 + .../WEB-INF/view/freeMarkerExampleInput.ftl | 5 + .../src/main/webapp/WEB-INF/view/helloWorld.vm | 4 + portlet/src/main/webapp/WEB-INF/view/index.jsp | 18 + .../main/webapp/WEB-INF/view/notImplemented.jsp | 1 + .../main/webapp/WEB-INF/view/springExample.jsp | 16 + .../main/webapp/WEB-INF/view/tokenExample.jsp | 5 + .../webapp/WEB-INF/view/tokenExampleInput.jsp | 20 + portlet/src/main/webapp/WEB-INF/web.xml | 31 ++ portlet/src/main/webapp/styles/styles.css | 7 + portlet/src/main/webapp/tiles/footer.ftl | 5 + portlet/src/main/webapp/tiles/footer.jsp | 6 + portlet/src/main/webapp/tiles/formExample.jsp | 5 + .../webapp/tiles/formExampleInputValidation.jsp | 8 + portlet/src/main/webapp/tiles/header.jsp | 2 + portlet/src/main/webapp/tiles/index.jsp | 13 + portlet/src/main/webapp/tiles/layout.jsp | 13 + portlet/src/test/java/JettyPlutoLauncher.java | 19 + .../struts2/portlet/test/BasePortletTest.java | 97 +++++ .../portlet/test/Struts2PortletTest.java | 87 +++++ 98 files changed, 3116 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 8d03f4d..fd3ce41 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 org.apache.struts struts-examples @@ -61,8 +60,10 @@ helloworld http-session interceptors + json mailreader message-resource + portlet preparable-interface restful2actionmapper rest-angular http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/README.txt ---------------------------------------------------------------------- diff --git a/portlet/README.txt b/portlet/README.txt new file mode 100644 index 0000000..ce8a425 --- /dev/null +++ b/portlet/README.txt @@ -0,0 +1,22 @@ +README.txt - portlet + +This is a simple example of using the portlet API with Struts applications. + +For more on getting started with Struts, see + +* http://cwiki.apache.org/WW/home.html + +WARNING - Additional configuration required for deployment + +Due to difference in portlet container implementations, the portlet +WAR is not ready-to-run. Extract the portlet WAR, and then copy the +contents of apps/portlet/src/main/etc// into the +WAR's WEB-INF directory. + +I18N: +===== +Please note that this project was created with the assumption that it will be run +in an environment where the default locale is set to English. This means that +the default messages defined in package.properties are in English. If the default +locale for your server is different, then rename package.properties to package_en.properties +and create a new package.properties with proper values for your default locale. http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/pom.xml ---------------------------------------------------------------------- diff --git a/portlet/pom.xml b/portlet/pom.xml new file mode 100644 index 0000000..2d8025f --- /dev/null +++ b/portlet/pom.xml @@ -0,0 +1,218 @@ + + + + 4.0.0 + + org.apache.struts + struts2-apps + 2.5.3-SNAPSHOT + + + struts2-portlet + war + Struts 2 Portlet Webapp + + + + pluto + + + + + maven-war-plugin + + ${project.build.directory}/pluto-resources/web.xml + + + + + org.apache.pluto + maven-pluto-plugin + 1.1.7 + + + generate-resources + + assemble + + + + + + org.mortbay.jetty + maven-jetty-plugin + 6.1.26 + + ${project.build.directory}/pluto-resources/web.xml + src/main/webapp/WEB-INF/jetty-pluto-web-default.xml + + + org.apache.pluto.embedded.portletIds + StrutsPortlet + + + + + + + + + com.bekk.boss + maven-jetty-pluto-embedded + 1.0.1 + + + + + + + + javax.portlet + portlet-api + provided + + + org.apache.struts + struts2-spring-plugin + + + org.apache.struts + struts2-portlet-plugin + + + org.apache.struts + struts2-dwr-plugin + + + org.apache.struts + struts2-portlet-tiles-plugin + + + + org.apache.velocity + velocity + + + + org.apache.velocity + velocity-tools + + + + commons-digester + commons-digester + + + javax.servlet + servlet-api + + + + + commons-fileupload + commons-fileupload + + + + + org.apache.logging.log4j + log4j-api + ${log4j2.version} + + + org.apache.logging.log4j + log4j-core + ${log4j2.version} + + + + org.mortbay.jetty + jetty + test + + + + net.sourceforge.jwebunit + jwebunit-htmlunit-plugin + 3.3 + test + + + javax.servlet + servlet-api + + + + + + com.bekk.boss + maven-jetty-pluto-embedded + 1.0.1 + test + + + + org.mortbay.jetty + jsp-2.1 + test + + + + org.apache.commons + commons-lang3 + + + + xerces + xercesImpl + test + + + + + + + + org.codehaus.mojo + rat-maven-plugin + 1.0-alpha-2 + + + pom.xml + src/** + + + src/main/etc/gridsphere/README-gridsphere.txt + src/main/etc/gridsphere/struts-portlet + src/main/etc/jetspeed2/README-jetspeed2.txt + src/main/etc/jetspeed2/struts-portlet.psml + + + + + + + UTF-8 + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/exo/web.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/exo/web.xml b/portlet/src/main/etc/exo/web.xml new file mode 100644 index 0000000..a6357e9 --- /dev/null +++ b/portlet/src/main/etc/exo/web.xml @@ -0,0 +1,63 @@ + + + + struts-portlet + + + contextConfigLocation + /WEB-INF/applicationContext*.xml + + + action2 + + org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter + + + + + action2 + /* + + + + org.springframework.web.context.ContextLoaderListener + + + + + org.apache.struts2.portlet.context.ServletContextHolderListener + + + + + org.exoplatform.services.portletcontainer.impl.servlet.PortletApplicationListener + + + + + preparator + + org.apache.struts2.portlet.context.PreparatorServlet + + + + dwr + uk.ltd.getahead.dwr.DWRServlet + + + PortletWrapper + + org.exoplatform.services.portletcontainer.impl.servlet.ServletWrapper + + + + + dwr + /dwr/* + + + PortletWrapper + /PortletWrapper + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/gridsphere/README-gridsphere.txt ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/gridsphere/README-gridsphere.txt b/portlet/src/main/etc/gridsphere/README-gridsphere.txt new file mode 100644 index 0000000..e502e06 --- /dev/null +++ b/portlet/src/main/etc/gridsphere/README-gridsphere.txt @@ -0,0 +1,2 @@ +Put the empty 'struts-portlet' file in the $CATALINA_HOME/webapps/gridsphere/WEB-INF/CustomPortal/portlets +folder of your Gridsphere installation. You will need to add the gridsphere-ui-tags-2.1.2.jar to your project. http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/gridsphere/gridsphere-portlet.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/gridsphere/gridsphere-portlet.xml b/portlet/src/main/etc/gridsphere/gridsphere-portlet.xml new file mode 100644 index 0000000..ed15d11 --- /dev/null +++ b/portlet/src/main/etc/gridsphere/gridsphere-portlet.xml @@ -0,0 +1,24 @@ + + + + + + + JSR Portlet Servlet + PortletServlet + + + + + Portlet Servlet + en + + Portlet Servlet + Portlet Servlet + A JSR Portlet Loader + portlet servlet + + + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/gridsphere/group.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/gridsphere/group.xml b/portlet/src/main/etc/gridsphere/group.xml new file mode 100644 index 0000000..d04e4e7 --- /dev/null +++ b/portlet/src/main/etc/gridsphere/group.xml @@ -0,0 +1,10 @@ + + + StrutsPortlet + StrutsPortlet Example Application + PUBLIC + + struts-portlet#StrutsPortlet + USER + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/gridsphere/layout.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/gridsphere/layout.xml b/portlet/src/main/etc/gridsphere/layout.xml new file mode 100644 index 0000000..14a160b --- /dev/null +++ b/portlet/src/main/etc/gridsphere/layout.xml @@ -0,0 +1,19 @@ + + + StrutsPortlet Example + + + StrutsPortlet Example Application + + + + + struts-portlet#StrutsPortlet + + + + + + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/gridsphere/struts-portlet ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/gridsphere/struts-portlet b/portlet/src/main/etc/gridsphere/struts-portlet new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/gridsphere/web.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/gridsphere/web.xml b/portlet/src/main/etc/gridsphere/web.xml new file mode 100644 index 0000000..0653b25 --- /dev/null +++ b/portlet/src/main/etc/gridsphere/web.xml @@ -0,0 +1,63 @@ + + + + struts-portlet + + + contextConfigLocation + /WEB-INF/applicationContext*.xml + + + action2 + + org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter + + + + + action2 + /* + + + + org.springframework.web.context.ContextLoaderListener + + + + + org.apache.struts2.portlet.context.ServletContextHolderListener + + + + + org.gridlab.gridsphere.provider.portlet.jsr.PortletServlet + + + + + preparator + + org.apache.struts2.portlet.context.PreparatorServlet + + + + dwr + uk.ltd.getahead.dwr.DWRServlet + + + PortletServlet + + org.gridlab.gridsphere.provider.portlet.jsr.PortletServlet + + + + + dwr + /dwr/* + + + PortletServlet + /jsr/struts-portlet + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/jbossportal2.0/jboss-app.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/jbossportal2.0/jboss-app.xml b/portlet/src/main/etc/jbossportal2.0/jboss-app.xml new file mode 100644 index 0000000..02e09d5 --- /dev/null +++ b/portlet/src/main/etc/jbossportal2.0/jboss-app.xml @@ -0,0 +1,3 @@ + + struts-portlet + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/jbossportal2.0/jboss-portlet.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/jbossportal2.0/jboss-portlet.xml b/portlet/src/main/etc/jbossportal2.0/jboss-portlet.xml new file mode 100644 index 0000000..663eaf3 --- /dev/null +++ b/portlet/src/main/etc/jbossportal2.0/jboss-portlet.xml @@ -0,0 +1,12 @@ + + + StrutsPortlet + + + + + StrutsPortlet2 + + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/jbossportal2.0/jboss-web.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/jbossportal2.0/jboss-web.xml b/portlet/src/main/etc/jbossportal2.0/jboss-web.xml new file mode 100644 index 0000000..9d9c645 --- /dev/null +++ b/portlet/src/main/etc/jbossportal2.0/jboss-web.xml @@ -0,0 +1,3 @@ + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/jbossportal2.0/portlet-instances.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/jbossportal2.0/portlet-instances.xml b/portlet/src/main/etc/jbossportal2.0/portlet-instances.xml new file mode 100644 index 0000000..c22073d --- /dev/null +++ b/portlet/src/main/etc/jbossportal2.0/portlet-instances.xml @@ -0,0 +1,11 @@ + + + + StrutsPortletInstance + StrutsPortlet + + + StrutsPortlet2Instance + StrutsPortlet2 + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/jbossportal2.0/struts-portlet-pages.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/jbossportal2.0/struts-portlet-pages.xml b/portlet/src/main/etc/jbossportal2.0/struts-portlet-pages.xml new file mode 100644 index 0000000..255c453 --- /dev/null +++ b/portlet/src/main/etc/jbossportal2.0/struts-portlet-pages.xml @@ -0,0 +1,18 @@ + + default + + struts-portlet + + StrutsPortletWindow + struts-portlet.StrutsPortlet.StrutsPortletInstance + left + 0 + + + StrutsPortletWindow2 + struts-portlet.StrutsPortlet2.StrutsPortlet2Instance + right + 0 + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/jbossportal2.2/jboss-app.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/jbossportal2.2/jboss-app.xml b/portlet/src/main/etc/jbossportal2.2/jboss-app.xml new file mode 100644 index 0000000..02e09d5 --- /dev/null +++ b/portlet/src/main/etc/jbossportal2.2/jboss-app.xml @@ -0,0 +1,3 @@ + + struts-portlet + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/jbossportal2.2/jboss-portlet.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/jbossportal2.2/jboss-portlet.xml b/portlet/src/main/etc/jbossportal2.2/jboss-portlet.xml new file mode 100644 index 0000000..663eaf3 --- /dev/null +++ b/portlet/src/main/etc/jbossportal2.2/jboss-portlet.xml @@ -0,0 +1,12 @@ + + + StrutsPortlet + + + + + StrutsPortlet2 + + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/jbossportal2.2/jboss-web.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/jbossportal2.2/jboss-web.xml b/portlet/src/main/etc/jbossportal2.2/jboss-web.xml new file mode 100644 index 0000000..9d9c645 --- /dev/null +++ b/portlet/src/main/etc/jbossportal2.2/jboss-web.xml @@ -0,0 +1,3 @@ + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/jbossportal2.2/struts-portlet-object.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/jbossportal2.2/struts-portlet-object.xml b/portlet/src/main/etc/jbossportal2.2/struts-portlet-object.xml new file mode 100644 index 0000000..2e062ad --- /dev/null +++ b/portlet/src/main/etc/jbossportal2.2/struts-portlet-object.xml @@ -0,0 +1,25 @@ + + + + overwrite + default + + + StrutsPortlet Example + + + StrutsWindow + StrutsPortletInstance + center + 0 + + + + + overwrite + + StrutsPortletInstance + struts-portlet.StrutsPortlet + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/jetspeed2/README-jetspeed2.txt ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/jetspeed2/README-jetspeed2.txt b/portlet/src/main/etc/jetspeed2/README-jetspeed2.txt new file mode 100644 index 0000000..acde566 --- /dev/null +++ b/portlet/src/main/etc/jetspeed2/README-jetspeed2.txt @@ -0,0 +1 @@ +Copy the struts-portlet.psml file to the JETSPEED2_INSTALL_DIR/webapps/jetspeed/WEB-INF/pages directory. http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/jetspeed2/struts-portlet.psml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/jetspeed2/struts-portlet.psml b/portlet/src/main/etc/jetspeed2/struts-portlet.psml new file mode 100644 index 0000000..bf865ba --- /dev/null +++ b/portlet/src/main/etc/jetspeed2/struts-portlet.psml @@ -0,0 +1,20 @@ + + + Struts Portlet Example Application + Struts Portlet Example Application + + + + + + + + + + public-view + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/etc/liferay3.6.1/web.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/etc/liferay3.6.1/web.xml b/portlet/src/main/etc/liferay3.6.1/web.xml new file mode 100644 index 0000000..73c769f --- /dev/null +++ b/portlet/src/main/etc/liferay3.6.1/web.xml @@ -0,0 +1,75 @@ + + + + struts-portlet + + contextConfigLocation + /WEB-INF/applicationContext*.xml + + + company_id + struts.apache.org + + + action2 + + org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter + + + + + action2 + /* + + + + com.liferay.portal.servlet.PortletContextListener + + + + + org.springframework.web.context.ContextLoaderListener + + + + + org.apache.struts2.portlet.context.ServletContextHolderListener + + + + + + StrutsPortlet + + com.liferay.portal.servlet.PortletServlet + + + portlet-class + + org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher + + + 0 + + + + preparator + + org.apache.struts2.portlet.context.PreparatorServlet + + + + dwr + uk.ltd.getahead.dwr.DWRServlet + + + + dwr + /dwr/* + + + StrutsPortlet + /StrutsPortlet/* + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/java/org/apache/struts2/portlet/example/ExampleAction.java ---------------------------------------------------------------------- diff --git a/portlet/src/main/java/org/apache/struts2/portlet/example/ExampleAction.java b/portlet/src/main/java/org/apache/struts2/portlet/example/ExampleAction.java new file mode 100644 index 0000000..d3e0741 --- /dev/null +++ b/portlet/src/main/java/org/apache/struts2/portlet/example/ExampleAction.java @@ -0,0 +1,39 @@ +/* + * $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.struts2.portlet.example; + +import java.util.Map; + +import com.opensymphony.xwork2.ActionContext; +import com.opensymphony.xwork2.ActionSupport; + +public class ExampleAction extends ActionSupport { + + private String name = "PortletWork Example"; + + public String getName() { + return name; + } + + public Map getRenderParameters() { + return ActionContext.getContext().getParameters(); + } +} http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java ---------------------------------------------------------------------- diff --git a/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java b/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java new file mode 100644 index 0000000..98b8517 --- /dev/null +++ b/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java @@ -0,0 +1,50 @@ +/* + * $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.struts2.portlet.example; + +import org.apache.struts2.dispatcher.DefaultActionSupport; + +import com.opensymphony.xwork2.ActionSupport; + +/** + */ +public class FormExample extends DefaultActionSupport { + + String firstName = null; + String lastName = null; + + public String getFirstName() { + return firstName; + } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + public String getLastName() { + return lastName; + } + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String displayResult() { + return "displayResult"; + } +} http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleModelDriven.java ---------------------------------------------------------------------- diff --git a/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleModelDriven.java b/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleModelDriven.java new file mode 100644 index 0000000..0ad526e --- /dev/null +++ b/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleModelDriven.java @@ -0,0 +1,37 @@ +/* + * $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.struts2.portlet.example; + +import org.apache.struts2.portlet.example.model.Name; + +import com.opensymphony.xwork2.ActionSupport; +import com.opensymphony.xwork2.ModelDriven; + +/** + */ +public class FormExampleModelDriven extends ActionSupport implements ModelDriven { + + private Name name = new Name(); + + public Name getModel() { + return name; + } +} http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleWithValidation.java ---------------------------------------------------------------------- diff --git a/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleWithValidation.java b/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleWithValidation.java new file mode 100644 index 0000000..a26609c --- /dev/null +++ b/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleWithValidation.java @@ -0,0 +1,47 @@ +/* + * $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.struts2.portlet.example; + +import com.opensymphony.xwork2.ActionSupport; + +/** + */ +public class FormExampleWithValidation extends ActionSupport { + private String firstName = null; + private String lastName = null; + + public String input() { + return SUCCESS; + } + + public String getFirstName() { + return firstName; + } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + public String getLastName() { + return lastName; + } + public void setLastName(String lastName) { + this.lastName = lastName; + } +} http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/java/org/apache/struts2/portlet/example/FormResultAction.java ---------------------------------------------------------------------- diff --git a/portlet/src/main/java/org/apache/struts2/portlet/example/FormResultAction.java b/portlet/src/main/java/org/apache/struts2/portlet/example/FormResultAction.java new file mode 100644 index 0000000..6e9aeae --- /dev/null +++ b/portlet/src/main/java/org/apache/struts2/portlet/example/FormResultAction.java @@ -0,0 +1,49 @@ +/* + * $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.struts2.portlet.example; + +import java.util.Collection; +import java.util.Map; + +import javax.portlet.RenderRequest; + +import org.apache.struts2.portlet.context.PortletActionContext; +import com.opensymphony.xwork2.ActionSupport; + +/** + */ +public class FormResultAction extends ActionSupport { + + private String result = null; + + public String getResult() { + return result; + } + public void setResult(String result) { + this.result = result; + } + + public Collection getRenderParams() { + RenderRequest req = PortletActionContext.getRenderRequest(); + Map params = req.getParameterMap(); + return params.entrySet(); + } +} http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/java/org/apache/struts2/portlet/example/FormTestAction.java ---------------------------------------------------------------------- diff --git a/portlet/src/main/java/org/apache/struts2/portlet/example/FormTestAction.java b/portlet/src/main/java/org/apache/struts2/portlet/example/FormTestAction.java new file mode 100644 index 0000000..ebbe102 --- /dev/null +++ b/portlet/src/main/java/org/apache/struts2/portlet/example/FormTestAction.java @@ -0,0 +1,36 @@ +/* + * $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.struts2.portlet.example; + +import com.opensymphony.xwork2.ActionSupport; + +/** + */ +public class FormTestAction extends ActionSupport { + + private String name = null; + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } +} http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/java/org/apache/struts2/portlet/example/SavePrefsAction.java ---------------------------------------------------------------------- diff --git a/portlet/src/main/java/org/apache/struts2/portlet/example/SavePrefsAction.java b/portlet/src/main/java/org/apache/struts2/portlet/example/SavePrefsAction.java new file mode 100644 index 0000000..1998e37 --- /dev/null +++ b/portlet/src/main/java/org/apache/struts2/portlet/example/SavePrefsAction.java @@ -0,0 +1,62 @@ +/* + * $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.struts2.portlet.example; + +import javax.portlet.ActionRequest; +import javax.portlet.PortletPreferences; + +import org.apache.struts2.portlet.context.PortletActionContext; +import com.opensymphony.xwork2.ActionSupport; + +/** + */ +public class SavePrefsAction extends ActionSupport { + private String preferenceOne = null; + private String preferenceTwo = null; + public String getPreferenceOne() { + return preferenceOne; + } + public void setPreferenceOne(String preferenceOne) { + this.preferenceOne = preferenceOne; + } + public String getPreferenceTwo() { + return preferenceTwo; + } + public void setPreferenceTwo(String preferenceTwo) { + this.preferenceTwo = preferenceTwo; + } + + public String execute() throws Exception { + ActionRequest req = PortletActionContext.getActionRequest(); + PortletPreferences prefs = req.getPreferences(); + prefs.setValue("preferenceOne", preferenceOne); + prefs.setValue("preferenceTwo", preferenceTwo); + prefs.store(); + return SUCCESS; + } + + public String showForm() throws Exception { + PortletPreferences prefs = PortletActionContext.getRequest().getPreferences(); + preferenceOne = prefs.getValue("preferenceOne", "not set"); + preferenceTwo = prefs.getValue("preferenceTwo", "not set"); + return SUCCESS; + } +} http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/ProcessAction.java ---------------------------------------------------------------------- diff --git a/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/ProcessAction.java b/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/ProcessAction.java new file mode 100644 index 0000000..81efcef --- /dev/null +++ b/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/ProcessAction.java @@ -0,0 +1,61 @@ +/* + * 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.struts2.portlet.example.eventing; + +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.portlet.interceptor.PortletRequestAware; +import org.apache.struts2.portlet.interceptor.PortletResponseAware; + +import javax.portlet.EventRequest; +import javax.portlet.EventResponse; +import javax.portlet.PortletRequest; +import javax.portlet.PortletResponse; + +public class ProcessAction extends ActionSupport implements PortletRequestAware, PortletResponseAware { + + private PortletRequest request; + private PortletResponse response; + private String name; + + public String execute() throws Exception { + + if (request instanceof EventRequest) { + EventRequest req = (EventRequest) request; + EventResponse res = (EventResponse) response; + res.setRenderParameter("eventName", (String) req.getEvent().getValue()); + return "forward"; + } else { + name = request.getParameter("eventName"); + } + + return SUCCESS; + } + + public void setPortletRequest(PortletRequest request) { + this.request = request; + } + + public void setPortletResponse(PortletResponse response) { + this.response = response; + } + + public String getName() { + return this.name; + } +} http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/PublishAction.java ---------------------------------------------------------------------- diff --git a/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/PublishAction.java b/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/PublishAction.java new file mode 100644 index 0000000..439b4d4 --- /dev/null +++ b/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/PublishAction.java @@ -0,0 +1,52 @@ +/* + * 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.struts2.portlet.example.eventing; + +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.portlet.interceptor.PortletResponseAware; + +import javax.portlet.ActionResponse; +import javax.portlet.PortletResponse; +import javax.xml.namespace.QName; + +public class PublishAction extends ActionSupport implements PortletResponseAware { + + private PortletResponse response; + private String name; + + public String execute() throws Exception { + + if (name != null) { + ((ActionResponse) response).setEvent(new QName("http://org.apache.struts2.portlets/events", "name"), name); + + addActionMessage("Publishing Event with Parameter name : " + name); + } + + return SUCCESS; + } + + public void setPortletResponse(PortletResponse response) { + this.response = response; + + } + + public void setName(String name) { + this.name = name; + } +} http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/java/org/apache/struts2/portlet/example/fileupload/FileUploadAction.java ---------------------------------------------------------------------- diff --git a/portlet/src/main/java/org/apache/struts2/portlet/example/fileupload/FileUploadAction.java b/portlet/src/main/java/org/apache/struts2/portlet/example/fileupload/FileUploadAction.java new file mode 100644 index 0000000..398078c --- /dev/null +++ b/portlet/src/main/java/org/apache/struts2/portlet/example/fileupload/FileUploadAction.java @@ -0,0 +1,81 @@ +/* + * $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.struts2.portlet.example.fileupload; + +import java.io.File; + +import org.apache.struts2.dispatcher.DefaultActionSupport; + +/** + * File Upload example's action. FileUploadAction + * + */ +public class FileUploadAction extends DefaultActionSupport { + + private static final long serialVersionUID = 5156288255337069381L; + + private String contentType; + private File upload; + private String fileName; + private String caption; + + // since we are using the file name will be + // obtained through getter/setter of FileName + public String getUploadFileName() { + return fileName; + } + public void setUploadFileName(String fileName) { + this.fileName = fileName; + } + + + // since we are using the content type will be + // obtained through getter/setter of ContentType + public String getUploadContentType() { + return contentType; + } + public void setUploadContentType(String contentType) { + this.contentType = contentType; + } + + + // since we are using the File itself will be + // obtained through getter/setter of + public File getUpload() { + return upload; + } + public void setUpload(File upload) { + this.upload = upload; + } + + + public String getCaption() { + return caption; + } + public void setCaption(String caption) { + this.caption = caption; + } + + public String upload() throws Exception { + return SUCCESS; + } + +} http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/java/org/apache/struts2/portlet/example/model/Name.java ---------------------------------------------------------------------- diff --git a/portlet/src/main/java/org/apache/struts2/portlet/example/model/Name.java b/portlet/src/main/java/org/apache/struts2/portlet/example/model/Name.java new file mode 100644 index 0000000..21856bb --- /dev/null +++ b/portlet/src/main/java/org/apache/struts2/portlet/example/model/Name.java @@ -0,0 +1,18 @@ +package org.apache.struts2.portlet.example.model; + +public class Name { + private String firstName; + private String lastName; + public String getFirstName() { + return firstName; + } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + public String getLastName() { + return lastName; + } + public void setLastName(String lastName) { + this.lastName = lastName; + } +} http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/java/org/apache/struts2/portlet/example/spring/SpringAction.java ---------------------------------------------------------------------- diff --git a/portlet/src/main/java/org/apache/struts2/portlet/example/spring/SpringAction.java b/portlet/src/main/java/org/apache/struts2/portlet/example/spring/SpringAction.java new file mode 100644 index 0000000..6db753c --- /dev/null +++ b/portlet/src/main/java/org/apache/struts2/portlet/example/spring/SpringAction.java @@ -0,0 +1,58 @@ +/* + * $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.struts2.portlet.example.spring; + +import java.util.List; + +import org.apache.commons.lang3.StringUtils; + +import com.opensymphony.xwork2.ActionSupport; + +/** + */ +public class SpringAction extends ActionSupport { + + private ThingManager thingManager = null; + private String thing = null; + + public void setThingManager(ThingManager thingManager) { + this.thingManager = thingManager; + } + + public List getThings() { + return thingManager.getThings(); + } + + public String getThing() { + return thing; + } + + public void setThing(String thing) { + this.thing = thing; + } + + public String execute() { + if(StringUtils.isNotEmpty(thing)) { + thingManager.addThing(thing); + } + return SUCCESS; + } +} http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/java/org/apache/struts2/portlet/example/spring/ThingManager.java ---------------------------------------------------------------------- diff --git a/portlet/src/main/java/org/apache/struts2/portlet/example/spring/ThingManager.java b/portlet/src/main/java/org/apache/struts2/portlet/example/spring/ThingManager.java new file mode 100644 index 0000000..ba117a5 --- /dev/null +++ b/portlet/src/main/java/org/apache/struts2/portlet/example/spring/ThingManager.java @@ -0,0 +1,38 @@ +/* + * $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.struts2.portlet.example.spring; + +import java.util.ArrayList; +import java.util.List; + +/** + */ +public class ThingManager { + private List things = new ArrayList(); + + public void addThing(String thing) { + things.add(thing); + } + + public List getThings() { + return things; + } +} http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/resources/LICENSE.txt ---------------------------------------------------------------------- diff --git a/portlet/src/main/resources/LICENSE.txt b/portlet/src/main/resources/LICENSE.txt new file mode 100644 index 0000000..dd5b3a5 --- /dev/null +++ b/portlet/src/main/resources/LICENSE.txt @@ -0,0 +1,174 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/resources/NOTICE.txt ---------------------------------------------------------------------- diff --git a/portlet/src/main/resources/NOTICE.txt b/portlet/src/main/resources/NOTICE.txt new file mode 100644 index 0000000..bfba90c --- /dev/null +++ b/portlet/src/main/resources/NOTICE.txt @@ -0,0 +1,5 @@ +Apache Struts +Copyright 2000-2011 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/resources/log4j2.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/resources/log4j2.xml b/portlet/src/main/resources/log4j2.xml new file mode 100644 index 0000000..092d5f6 --- /dev/null +++ b/portlet/src/main/resources/log4j2.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-formExamplePrg-validation.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-formExamplePrg-validation.xml b/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-formExamplePrg-validation.xml new file mode 100644 index 0000000..3151f29 --- /dev/null +++ b/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-formExamplePrg-validation.xml @@ -0,0 +1,13 @@ + + + + + You must enter a first name + + + + + You must enter a last name + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-processTilesFreemarkerExample-validation.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-processTilesFreemarkerExample-validation.xml b/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-processTilesFreemarkerExample-validation.xml new file mode 100644 index 0000000..3151f29 --- /dev/null +++ b/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-processTilesFreemarkerExample-validation.xml @@ -0,0 +1,13 @@ + + + + + You must enter a first name + + + + + You must enter a last name + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-processValidationExample-validation.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-processValidationExample-validation.xml b/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-processValidationExample-validation.xml new file mode 100644 index 0000000..3151f29 --- /dev/null +++ b/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-processValidationExample-validation.xml @@ -0,0 +1,13 @@ + + + + + You must enter a first name + + + + + You must enter a last name + + + http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/resources/pluto-portal-driver-services-config.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/resources/pluto-portal-driver-services-config.xml b/portlet/src/main/resources/pluto-portal-driver-services-config.xml new file mode 100644 index 0000000..6803d03 --- /dev/null +++ b/portlet/src/main/resources/pluto-portal-driver-services-config.xml @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts-examples/blob/1dfc0aa2/portlet/src/main/resources/struts-edit.xml ---------------------------------------------------------------------- diff --git a/portlet/src/main/resources/struts-edit.xml b/portlet/src/main/resources/struts-edit.xml new file mode 100644 index 0000000..a31691c --- /dev/null +++ b/portlet/src/main/resources/struts-edit.xml @@ -0,0 +1,48 @@ + + + + + + + /WEB-INF/edit/index.jsp + + + /WEB-INF/edit/test.jsp + + + + /WEB-INF/edit/formExampleInput.jsp + + + + + + /WEB-INF/edit/formExampleInput.jsp + + + /edit/processFormExampleForward.action?firstName=${firstName}&lastName=${lastName} + + + + + + /WEB-INF/edit/formExample.jsp + + + + + + + /WEB-INF/edit/namespaceTest.jsp + + + \ No newline at end of file