|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.struts2.config.ClasspathPackageProvider
public class ClasspathPackageProvider
ClasspathPackageProvider loads the configuration by scanning the classpath or selected packages for Action classes.
This provider is only invoked if one or more action packages are passed to the dispatcher, usually from the web.xml. Configurations are created for objects that either implement Action or have classnames that end with "Action".
Nested Class Summary | |
---|---|
static class |
ClasspathPackageProvider.ClasspathPageLocator
ClasspathPathLocator searches the classpath for server pages. |
static interface |
ClasspathPackageProvider.PageLocator
PageLocator defines a locate method that can be used to discover server pages. |
Field Summary | |
---|---|
protected static java.lang.String |
DEFAULT_PAGE_EXTENSION
The default page extension, to use in place of ".jsp". |
protected static java.lang.String |
DEFAULT_PAGE_PREFIX
The default page prefix (or "path"). |
protected static java.lang.String |
DEFAULT_PARENT_PACKAGE
A setting to indicate a custom default parent package, to use in place of "struts-default". |
protected static java.lang.String |
DISABLE_ACTION_SCANNING
A setting to disable action scanning. |
protected static java.lang.String |
FORCE_LOWER_CASE
The default page prefix (or "path"). |
Constructor Summary | |
---|---|
ClasspathPackageProvider()
|
Method Summary | |
---|---|
protected com.opensymphony.xwork2.util.ResolverUtil.ClassTest |
createActionClassTest()
|
void |
destroy()
Default destructor. |
protected java.lang.String |
getClassSuffix()
|
void |
init(com.opensymphony.xwork2.config.Configuration config)
Register this application's configuration. |
protected com.opensymphony.xwork2.config.entities.PackageConfig.Builder |
loadPackageConfig(java.lang.String actionNamespace,
java.lang.String actionPackage,
java.lang.Class actionClass)
Finds or creates the package configuration for an Action class. |
void |
loadPackages()
Clears and loads the list of packages registered at construction. |
protected void |
loadPackages(java.lang.String[] pkgs)
Scan a list of packages for Action classes. |
boolean |
needsReload()
Indicates whether the packages have been initialized. |
protected void |
processActionClass(java.lang.Class<?> cls,
java.lang.String[] pkgs)
Create a default action mapping for a class instance. |
void |
setActionPackages(java.lang.String packages)
|
void |
setDefaultPageExtension(java.lang.String defaultPageExtension)
Register a default page extension to use when locating pages. |
void |
setDefaultPagePrefix(java.lang.String defaultPagePrefix)
Reigster a default page prefix to use when locating pages. |
void |
setDefaultParentPackage(java.lang.String defaultParentPackage)
Register a default parent package for the actions. |
void |
setDisableActionScanning(java.lang.String disableActionScanning)
Disables action scanning. |
void |
setForceLowerCase(java.lang.String force)
Whether to use a lowercase letter as the initial letter of an action. |
void |
setPageLocator(ClasspathPackageProvider.PageLocator locator)
Register a PageLocation to use to scan for server pages. |
void |
setServletContext(javax.servlet.ServletContext ctx)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String DEFAULT_PAGE_PREFIX
protected static final java.lang.String DEFAULT_PAGE_EXTENSION
protected static final java.lang.String DEFAULT_PARENT_PACKAGE
protected static final java.lang.String DISABLE_ACTION_SCANNING
protected static final java.lang.String FORCE_LOWER_CASE
Constructor Detail |
---|
public ClasspathPackageProvider()
Method Detail |
---|
public void setActionPackages(java.lang.String packages)
public void setServletContext(javax.servlet.ServletContext ctx)
public void setDisableActionScanning(java.lang.String disableActionScanning)
disableActionScanning
- True to disablepublic void setDefaultParentPackage(java.lang.String defaultParentPackage)
defaultParentPackage
- the new defaultParentPackagepublic void setDefaultPageExtension(java.lang.String defaultPageExtension)
defaultPageExtension
- the new defaultPageExtensionpublic void setDefaultPagePrefix(java.lang.String defaultPagePrefix)
defaultPagePrefix
- the defaultPagePrefix to setpublic void setForceLowerCase(java.lang.String force)
force
- If false, actions will retain the initial uppercase letter from the Action class.
(view.action
(true) versus View.action
(false)).public void setPageLocator(ClasspathPackageProvider.PageLocator locator)
locator
- protected void loadPackages(java.lang.String[] pkgs)
pkgs
- A list of packages to loadprocessActionClass(java.lang.Class>, java.lang.String[])
protected com.opensymphony.xwork2.util.ResolverUtil.ClassTest createActionClassTest()
protected java.lang.String getClassSuffix()
protected void processActionClass(java.lang.Class<?> cls, java.lang.String[] pkgs)
cls
- Action or POJO instance to processpkgs
- List of packages that were scanned for Actionsprotected com.opensymphony.xwork2.config.entities.PackageConfig.Builder loadPackageConfig(java.lang.String actionNamespace, java.lang.String actionPackage, java.lang.Class actionClass)
actionNamespace
- The configuration namespaceactionPackage
- The Java package containing our Action classesactionClass
- The Action class instance
public void destroy()
public void init(com.opensymphony.xwork2.config.Configuration config)
init
in interface com.opensymphony.xwork2.config.PackageProvider
config
- The configuration for this application.public void loadPackages() throws com.opensymphony.xwork2.config.ConfigurationException
loadPackages
in interface com.opensymphony.xwork2.config.PackageProvider
com.opensymphony.xwork2.config.ConfigurationException
public boolean needsReload()
needsReload
in interface com.opensymphony.xwork2.config.PackageProvider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |