diff --git a/bundles/admin/src/main/resources/static/js/shell.js b/bundles/admin/src/main/resources/static/js/shell.js index eb7877de6..8f3486efa 100644 --- a/bundles/admin/src/main/resources/static/js/shell.js +++ b/bundles/admin/src/main/resources/static/js/shell.js @@ -29,8 +29,8 @@ result_div.appendChild(document.createElement('br')); for (var line_index in result_array) { - var result_wrap = document.createElement('pre') - line = document.createTextNode(result_array[line_index]); + var result_wrap = document.createElement('pre'); + var line = document.createTextNode(result_array[line_index]); result_wrap.appendChild(line); result_div.appendChild(result_wrap); result_div.appendChild(document.createElement('br')); diff --git a/bundles/demo/pom.xml b/bundles/demo/pom.xml index 282330e3b..44c120f15 100644 --- a/bundles/demo/pom.xml +++ b/bundles/demo/pom.xml @@ -67,7 +67,6 @@ org.apache.felix maven-bundle-plugin true - 2.1.0 META-INF diff --git a/bundles/demo/src/main/java/actions/osgi/HelloWorldAction.java b/bundles/demo/src/main/java/actions/osgi/HelloWorldAction.java index b2b8a16e0..dad0c25a7 100644 --- a/bundles/demo/src/main/java/actions/osgi/HelloWorldAction.java +++ b/bundles/demo/src/main/java/actions/osgi/HelloWorldAction.java @@ -22,13 +22,21 @@ package actions.osgi; import com.opensymphony.xwork2.ActionSupport; import org.apache.struts2.convention.annotation.Action; +import org.apache.struts2.convention.annotation.Actions; +import org.apache.struts2.convention.annotation.Namespace; +import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.ResultPath; -@ResultPath("/content") +@Namespace("/osgi") +@ResultPath("/content/osgi") public class HelloWorldAction extends ActionSupport { - private Message message; + private Message message = new Message("Default non-null message"); - @Action("hello-convention") + @Override + @Actions({ + @Action(value="hello-convention", results={@Result(name="success", type="freemarker", location="/content/osgi/hello-convention.ftl")}), + @Action(value="/osgi/hello-convention", results={@Result(name="success", type="freemarker", location="/content/osgi/hello-convention.ftl")}) + }) public String execute() { return SUCCESS; } @@ -45,6 +53,7 @@ public class HelloWorldAction extends ActionSupport { return "Hello!!!"; } + @Override public String toString() { StringBuilder sb = new StringBuilder("{message:"); sb.append(message != null ? message.getText() : "null"); diff --git a/bundles/demo/src/main/resources/content/osgi/hello.ftl b/bundles/demo/src/main/resources/content/osgi/hello.ftl index 343319b8c..1d81dc076 100644 --- a/bundles/demo/src/main/resources/content/osgi/hello.ftl +++ b/bundles/demo/src/main/resources/content/osgi/hello.ftl @@ -20,7 +20,7 @@ --> - Action mapped by the XML configurationn + Action mapped by the XML configuration This is an action mapped by XML configuration, using a FreeMarker result. diff --git a/bundles/demo/src/main/resources/content/osgi/hello.vm b/bundles/demo/src/main/resources/content/osgi/hello.vm index ed95682d1..55d05774a 100644 --- a/bundles/demo/src/main/resources/content/osgi/hello.vm +++ b/bundles/demo/src/main/resources/content/osgi/hello.vm @@ -18,7 +18,7 @@ *# - Action mapped by the XML configurationn + Action mapped by the XML configuration This is an action mapped by XML configuration, using a Velocity result. diff --git a/bundles/demo/src/main/resources/struts.xml b/bundles/demo/src/main/resources/struts.xml index 5a10fb315..13a945fcf 100644 --- a/bundles/demo/src/main/resources/struts.xml +++ b/bundles/demo/src/main/resources/struts.xml @@ -20,21 +20,36 @@ */ --> + "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" + "http://struts.apache.org/dtds/struts-2.5.dtd"> - + + + + + + + + + - + + /content/osgi/hello.vm - + + /content/osgi/hello.ftl - + /content/osgi/home.ftl + \ No newline at end of file diff --git a/plugins/osgi/src/main/java/org/apache/struts2/osgi/BundlePackageLoader.java b/plugins/osgi/src/main/java/org/apache/struts2/osgi/BundlePackageLoader.java index ea31633bc..3fe7827e8 100644 --- a/plugins/osgi/src/main/java/org/apache/struts2/osgi/BundlePackageLoader.java +++ b/plugins/osgi/src/main/java/org/apache/struts2/osgi/BundlePackageLoader.java @@ -24,11 +24,11 @@ import com.opensymphony.xwork2.config.Configuration; import com.opensymphony.xwork2.config.ConfigurationException; import com.opensymphony.xwork2.config.entities.PackageConfig; import com.opensymphony.xwork2.config.impl.DefaultConfiguration; -import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider; import com.opensymphony.xwork2.inject.Container; import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.struts2.config.StrutsXmlConfigurationProvider; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; @@ -140,18 +140,18 @@ public class BundlePackageLoader implements PackageLoader { this.contextContainer = contextContainer; } - static class BundleConfigurationProvider extends XmlConfigurationProvider { + static class BundleConfigurationProvider extends StrutsXmlConfigurationProvider { private Bundle bundle; private BundleContext bundleContext; public BundleConfigurationProvider(String filename, Bundle bundle, BundleContext bundleContext) { - super(filename, false); + super(filename, false, null); // Currently no dependency on ServletContext this.bundle = bundle; this.bundleContext = bundleContext; } public BundleConfigurationProvider(String filename) { - super(filename); + super(filename, false, null); // Currently no dependency on ServletContext } @Override