|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.taursys.servlet.ServletFormFactory
This Factory creates and recycles servlet forms for an application. This class was designed to be used by a ServletApp. It will typically be setup in the init method of the ServletApp. Below is an example of typical usage:
public class MyMainServlet extends ServletApp { public void init(ServletConfig config) throws ServletException { super.init(config); getFactory().addPackage("/","com.taursys.examples.simpleweb"); getFactory().setDefaultFormName("com.taursys.examples.simpleweb.ShowHidePage"); getFactory().setDefaultClassLoader(getClass().getClassLoader()); // Set default logging Debug.setLoggerAdapter(new SimpleLogger(Debug.DEBUG)); } }
Constructor Summary | |
ServletFormFactory()
Creates a new ServletFormFactory with a defaultFormName of com.taursys.servlet.DefaultMessageForm. |
Method Summary | |
void |
addPackage(java.lang.String path,
java.lang.String packageName)
Adds the given path and packageName to the packages table. |
ServletForm |
createServletForm(java.lang.String url)
Returns a ServletForm based on the given url. |
java.lang.ClassLoader |
getDefaultClassLoader()
Get the default ClassLoader used to load and instantiate ServletForms. |
java.lang.String |
getDefaultFormName()
Gets the default ServletForm name for this factory. |
java.lang.String |
getServletFormSuffix()
Gets the current suffix for ServletForms. |
java.lang.String |
parseClassName(java.lang.String url)
Parses given url and constructs fully qualified ServletForm class name. |
void |
recycle(ServletForm usedServletForm)
Recycle will put given servletForm back into pool if servletForm supports recycling. |
void |
setDefaultClassLoader(java.lang.ClassLoader newDefaultClassLoader)
Set the default ClassLoader used to load and instantiate ServletForms. |
void |
setDefaultFormName(java.lang.String newDefaultFormName)
Sets the default ServletForm name for this factory. |
void |
setServletFormSuffix(java.lang.String newServletFormSuffix)
Sets the suffix for ServletForms. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ServletFormFactory()
Method Detail |
public ServletForm createServletForm(java.lang.String url) throws ServletFormNotFoundException
url
- containing the encoded ServletForm name
ServletFormNotFoundException
- if cannot parse url, package is not
registered, or ServletForm class is not found.public void recycle(ServletForm usedServletForm)
usedServletForm
- to recycle (if it supports recycling)public java.lang.String parseClassName(java.lang.String url) throws ServletFormNotFoundException
Assuming 2 entries in package table:
url
- path to parse - usually obtained through request.getPathInfo()
ServletFormNotFoundException
- if path not found or form does not
end in servletFormSuffix.public void addPackage(java.lang.String path, java.lang.String packageName)
path
- that form names will be registered underpackageName
- full package name for forms in given pathpublic void setDefaultFormName(java.lang.String newDefaultFormName)
newDefaultFormName
- for this factorypublic java.lang.String getDefaultFormName()
public void setServletFormSuffix(java.lang.String newServletFormSuffix)
newServletFormSuffix
- the suffix to use
java.lang.IllegalArgumentException
- if passed a null value.public java.lang.String getServletFormSuffix()
public void setDefaultClassLoader(java.lang.ClassLoader newDefaultClassLoader)
getFactory().setDefaultClassLoader(getClass().getClassLoader());
newDefaultClassLoader
- to use to load and instantiate ServletForms.public java.lang.ClassLoader getDefaultClassLoader()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |