|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.qi4j.library.struts2.codebehind.Qi4jCodebehindPackageProvider
public class Qi4jCodebehindPackageProvider
This is inspired by the ClasspathPackageProvider from the struts2-codebehind-plugin. Most of the code is directly copied from the 2.1.1 version of the plugin but modified to only look for the @Action annotation and to accept interfaces as well as classes.
Nested Class Summary | |
---|---|
static class |
Qi4jCodebehindPackageProvider.ClasspathPageLocator
ClasspathPathLocator searches the classpath for server pages. |
static interface |
Qi4jCodebehindPackageProvider.PageLocator
PageLocator defines a locate method that can be used to discover server pages. |
Field Summary | |
---|---|
protected static String |
DEFAULT_PAGE_EXTENSION
The default page extension, to use in place of ".jsp". |
protected static String |
DEFAULT_PAGE_PREFIX
The default page prefix (or "path"). |
protected static String |
DEFAULT_PARENT_PACKAGE
A setting to indicate a custom default parent package, to use in place of "struts-default". |
protected static String |
FORCE_LOWER_CASE
The default page prefix (or "path"). |
Constructor Summary | |
---|---|
Qi4jCodebehindPackageProvider()
|
Method Summary | |
---|---|
protected String |
getClassSuffix()
|
void |
init(com.opensymphony.xwork2.config.Configuration configuration)
|
static boolean |
isNotEmpty(String text)
|
protected com.opensymphony.xwork2.config.entities.PackageConfig.Builder |
loadPackageConfig(String actionNamespace,
String actionPackage,
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(String[] pkgs)
|
boolean |
needsReload()
|
protected void |
processActionClass(Class<?> cls,
String[] pkgs)
Create a default action mapping for a class instance. |
void |
setActionConfiguration(ActionConfiguration actionConfiguration)
|
void |
setActionPackages(String packages)
|
void |
setDefaultPageExtension(String defaultPageExtension)
Register a default page extension to use when locating pages. |
void |
setDefaultPagePrefix(String defaultPagePrefix)
Reigster a default page prefix to use when locating pages. |
void |
setDefaultParentPackage(String defaultParentPackage)
Register a default parent package for the actions. |
void |
setForceLowerCase(String force)
Whether to use a lowercase letter as the initial letter of an action. |
void |
setPageLocator(Qi4jCodebehindPackageProvider.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 String DEFAULT_PAGE_PREFIX
protected static final String DEFAULT_PAGE_EXTENSION
protected static final String DEFAULT_PARENT_PACKAGE
protected static final String FORCE_LOWER_CASE
Constructor Detail |
---|
public Qi4jCodebehindPackageProvider()
Method Detail |
---|
public void setActionPackages(String packages)
public void setServletContext(javax.servlet.ServletContext ctx)
public void setActionConfiguration(ActionConfiguration actionConfiguration)
public void setDefaultParentPackage(String defaultParentPackage)
defaultParentPackage
- the new defaultParentPackagepublic void setDefaultPageExtension(String defaultPageExtension)
defaultPageExtension
- the new defaultPageExtensionpublic void setDefaultPagePrefix(String defaultPagePrefix)
defaultPagePrefix
- the defaultPagePrefix to setpublic void setForceLowerCase(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(Qi4jCodebehindPackageProvider.PageLocator locator)
locator
- public void init(com.opensymphony.xwork2.config.Configuration configuration) throws com.opensymphony.xwork2.config.ConfigurationException
init
in interface com.opensymphony.xwork2.config.PackageProvider
com.opensymphony.xwork2.config.ConfigurationException
public boolean needsReload()
needsReload
in interface com.opensymphony.xwork2.config.PackageProvider
public void loadPackages() throws com.opensymphony.xwork2.config.ConfigurationException
loadPackages
in interface com.opensymphony.xwork2.config.PackageProvider
com.opensymphony.xwork2.config.ConfigurationException
protected void loadPackages(String[] pkgs) throws com.opensymphony.xwork2.config.ConfigurationException
com.opensymphony.xwork2.config.ConfigurationException
protected void processActionClass(Class<?> cls, String[] pkgs)
cls
- Action or POJO instance to processpkgs
- List of packages that were scanned for Actionsprotected String getClassSuffix()
protected com.opensymphony.xwork2.config.entities.PackageConfig.Builder loadPackageConfig(String actionNamespace, String actionPackage, Class actionClass)
actionNamespace
- The configuration namespaceactionPackage
- The Java package containing our Action classesactionClass
- The Action class instance
public static final boolean isNotEmpty(String text)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |