Package org.apache.struts2.convention
Interface ConventionsService
- All Known Implementing Classes:
ConventionsServiceImpl
public interface ConventionsService
This interface defines the conventions that are used by the convention plugin. In most cases the methods on this class will provide the best default for any values and also handle locating overrides of the default via the annotations that are part of the plugin.
-
Method Summary
Modifier and TypeMethodDescriptiondetermineResultPath(Class<?> actionClass) Locates the result location from annotations on the action class or the package or returns the default if no annotations are present.default StringdetermineResultPath(Class<?> actionClass, PackageConfig packageConfig) Locates the result location likedetermineResultPath(Class), using the package's scopedstruts.convention.result.pathwhen the action carries no@ResultPath.determineResultPath(ActionConfig actionConfig) Delegates to the other method but first looks up the Action's class using the given class name.default StringdetermineResultPath(ActionConfig actionConfig, PackageConfig packageConfig) Locates the result location likedetermineResultPath(ActionConfig), using the package's scopedstruts.convention.result.pathwhen the action carries no@ResultPath.getResultTypesByExtension(PackageConfig packageConfig) Returns a mapping between the result type strings and theResultTypeConfiginstances based on thePackageConfiggiven.
-
Method Details
-
determineResultPath
Locates the result location from annotations on the action class or the package or returns the default if no annotations are present.- Parameters:
actionClass- The action class.- Returns:
- The result location if it is set in the annotations. Otherwise, the default result location is returned.
-
determineResultPath
Delegates to the other method but first looks up the Action's class using the given class name.- Parameters:
actionConfig- (Optional) The configuration for the action that the result is being built for or null if the default result path is needed.- Returns:
- The result location if it is set in the annotations for the class of the ActionConfig. Otherwise, the default result location is returned. If null is passed in, the default is returned,
-
determineResultPath
Locates the result location likedetermineResultPath(Class), using the package's scopedstruts.convention.result.pathwhen the action carries no@ResultPath.- Parameters:
actionClass- The action class.packageConfig- The package the action belongs to, or null for the global default.- Returns:
- The result location.
- Since:
- 7.5.0
-
determineResultPath
Locates the result location likedetermineResultPath(ActionConfig), using the package's scopedstruts.convention.result.pathwhen the action carries no@ResultPath.- Parameters:
actionConfig- (Optional) The configuration for the action, or null when there is no action.packageConfig- The package whose scoped value applies, or null for the global default.- Returns:
- The result location.
- Since:
- 7.5.0
-
getResultTypesByExtension
Returns a mapping between the result type strings and theResultTypeConfiginstances based on thePackageConfiggiven.- Parameters:
packageConfig- The PackageConfig to get the result types for.- Returns:
- The result types or an empty Map of nothing is configured.
-