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 701d44909..a51986858 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 @@ -75,7 +75,7 @@ public class CodebehindUnknownHandler implements UnknownHandler { public void setPathPrefix(String prefix) { this.templatePathPrefix=prefix; } - + @Inject public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; @@ -110,7 +110,7 @@ public class CodebehindUnknownHandler implements UnknownHandler { /** Create a new ActionConfig in the default package, with the default interceptor stack and a single result */ protected ActionConfig buildActionConfig(String path, String namespace, String actionName, ResultTypeConfig resultTypeConfig) { final PackageConfig pkg = configuration.getPackageConfig(defaultPackageName); - return new ActionConfig.Builder(defaultPackageName, "execute", ActionSupport.class.getName()) + return new ActionConfig.Builder(defaultPackageName, "execute", pkg.getDefaultClassRef()) .addInterceptors(InterceptorBuilder.constructInterceptorReference(new InterceptorLocator() { public Object getInterceptorConfig(String name) { return pkg.getAllInterceptorConfigs().get(name); // recurse package hiearchy diff --git a/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionSupport.java b/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionSupport.java new file mode 100644 index 000000000..9c6918545 --- /dev/null +++ b/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionSupport.java @@ -0,0 +1,35 @@ +/* + * $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.rest; + +import com.opensymphony.xwork2.ActionSupport; + +/** + * Extends {@link ActionSupport} to provides a default implementation of the index method that can be invoked for + * unknown actions by the {@link com.opensymphony.xwork2.UnknownHandler}. + */ +public class RestActionSupport extends ActionSupport { + + public String index() throws Exception { + return execute(); + } +} diff --git a/plugins/rest/src/main/resources/struts-plugin.xml b/plugins/rest/src/main/resources/struts-plugin.xml index 21d83120b..d43b8bcca 100644 --- a/plugins/rest/src/main/resources/struts-plugin.xml +++ b/plugins/rest/src/main/resources/struts-plugin.xml @@ -47,6 +47,7 @@ + @@ -112,6 +113,9 @@ + + +