Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add allowed methods to handleUnknownAction #99

Merged
merged 2 commits into from
Jun 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@ public List<ExceptionMappingConfig> getGlobalExceptionMappingConfigs() {
return globalExceptionMappingConfigs;
}

/**
* gets the GlobalAllowedMethods local to this package
*
* @return a Set of method names allowed to be executed if strict method invocation is enabled
*/
public Set<String> getGlobalAllowedMethods() { return globalAllowedMethods; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this return unmodifiable collections?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will do it after merge


public boolean isStrictMethodInvocation() {
return strictMethodInvocation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public ConventionUnknownHandler(Configuration configuration, ObjectFactory objec

this.redirectToSlash = Boolean.parseBoolean(redirectToSlash);

allowedMethods = TextParseUtil.commaDelimitedStringToSet("execute,input,back,cancel,browse");
allowedMethods = TextParseUtil.commaDelimitedStringToSet("execute,input,back,cancel,browse,index");
}

public ActionConfig handleUnknownAction(String namespace, String actionName)
Expand Down Expand Up @@ -219,7 +219,10 @@ protected ActionConfig buildActionConfig(String path, ResultTypeConfig resultTyp
results.put(Action.SUCCESS, config);

return new ActionConfig.Builder(defaultParentPackageName, "execute", ActionSupport.class.getName()).
addInterceptors(interceptors).addResultConfigs(results).build();
addInterceptors(interceptors).
addResultConfigs(results).
addAllowedMethod(pkg.getGlobalAllowedMethods()).
build();
}

private Result scanResultsByExtension(String ns, String actionName, String pathPrefix,
Expand Down