diff --git a/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java b/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java index ad2a75b1d..a6242202d 100644 --- a/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java +++ b/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java @@ -53,15 +53,20 @@ import com.opensymphony.xwork2.inject.Inject; */ public class CodebehindUnknownHandler implements UnknownHandler { - protected String defaultPackageName = "codebehind-default"; + protected String defaultPackageName; protected ServletContext servletContext; protected Map resultsByExtension; - protected String templatePathPrefix = "/"; + protected String templatePathPrefix; protected Configuration configuration; protected ObjectFactory objectFactory; protected static final Log LOG = LogFactory.getLog(CodebehindUnknownHandler.class); + @Inject("struts.codebehind.pathPrefix") + public void setPathPrefix(String prefix) { + this.templatePathPrefix=prefix; + } + @Inject("struts.codebehind.defaultPackage") public void setDefaultPackage(String pkg) { this.defaultPackageName = pkg; diff --git a/plugins/codebehind/src/main/resources/struts-plugin.xml b/plugins/codebehind/src/main/resources/struts-plugin.xml index 1bc6de17f..1b8a7a72b 100644 --- a/plugins/codebehind/src/main/resources/struts-plugin.xml +++ b/plugins/codebehind/src/main/resources/struts-plugin.xml @@ -6,7 +6,10 @@ - + + + + diff --git a/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java b/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java index 0bf246b1a..49e3ca2ea 100644 --- a/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java +++ b/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java @@ -44,10 +44,11 @@ public class CodebehindUnknownHandlerTest extends StrutsTestCase { super.setUp(); mockServletContext = new Mock(ServletContext.class); handler = new CodebehindUnknownHandler(); + handler.setDefaultPackage("codebehind-default"); + handler.setPathPrefix("/"); handler.setConfiguration(configuration); handler.setObjectFactory(container.getInstance(ObjectFactory.class)); handler.setServletContext((ServletContext)mockServletContext.proxy()); - } public void testBuildResult() {