mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
Added ability to customize template path prefix
WW-1595 git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@492788 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
+7
-2
@@ -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<String,ResultTypeConfig> 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;
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
|
||||
<struts>
|
||||
<bean type="com.opensymphony.xwork2.UnknownHandler" class="org.apache.struts2.codebehind.CodebehindUnknownHandler" />
|
||||
|
||||
|
||||
<constant name="struts.codebehind.pathPrefix" value="/"/>
|
||||
<constant name="struts.codebehind.defaultPackage" value="codebehind-default"/>
|
||||
|
||||
<package name="codebehind-default" extends="struts-default">
|
||||
</package>
|
||||
</struts>
|
||||
|
||||
+2
-1
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user