|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.jdon.controller.WebAppUtil
public class WebAppUtil
Used in Web application. Using WebAppUtil, framework's user can get his businesss service object that defined in jdonframework.xml this is main and important client class for framework's user. ForumService forumService = (ForumService) WebAppUtil.getService("forumService", request); forumService.getForums(start);
| 构造方法摘要 | |
|---|---|
WebAppUtil()
|
|
| 方法摘要 | |
|---|---|
static Object |
callService(String serviceName,
String methodName,
Object[] methodParams,
javax.servlet.http.HttpServletRequest request)
Command pattern for service invoke sample: browser url: /aaa.do? |
static Object |
getComponentInstance(String name,
javax.servlet.http.HttpServletRequest request)
get a component that registered in container. the component is not different from the service. the component instance is single instance Any intercepter will be disable |
static Object |
getComponentInstance(String name,
javax.servlet.ServletContext sc)
get a component that registered in container. the component is not different from the service. the component instance is single instance Any intercepter will be disable |
static ContainerWrapper |
getContainer(javax.servlet.http.HttpServletRequest request)
get this Web application's container |
static ContainerWrapper |
getContainer(javax.servlet.ServletContext sc)
|
static String |
getContainerKey()
get the key for the application container user can directly get his container from servletcontext by the key. |
static String |
getInterceptorKey()
get the key for the interceptor, by the key, use can add his interceptor to the container |
static Object |
getService(String name,
javax.servlet.http.HttpServletRequest request)
get a service from jdonframework.xml's service configure. the service maybe is a service . |
static Object |
getService(String name,
javax.servlet.ServletContext sc)
Difference with getComponentInstance method: 1. this method return new service instance each times. 2. call methods of the return service instance, will active interceptors. |
static Object |
getService(TargetMetaDef targetMetaDef,
javax.servlet.http.HttpServletRequest request)
|
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public WebAppUtil()
| 方法详细信息 |
|---|
public static Object getService(String name,
javax.servlet.http.HttpServletRequest request)
if user has a business interface, so the interface can has two implemention:pojo or ejb, if is ejb, the ejb's local/remote interface must inherit the business interface. so the application's MVC will completely seperate from his business lay
usage: in jdonframework.xml:
UserDao ud = (UserDao)WebAppUtil.getService(“userJdbcDao”, request); UserDao is a interface.
name - Stringrequest - HttpServletRequest
Exception
public static Object getService(String name,
javax.servlet.ServletContext sc)
name - sc -
public static Object getService(TargetMetaDef targetMetaDef,
javax.servlet.http.HttpServletRequest request)
public static Object getComponentInstance(String name,
javax.servlet.http.HttpServletRequest request)
public static Object getComponentInstance(String name,
javax.servlet.ServletContext sc)
sc -
public static Object callService(String serviceName,
String methodName,
Object[] methodParams,
javax.servlet.http.HttpServletRequest request)
throws Exception
serviceName - the service name in jdonframework.xmlmethodName - the method namerequest - model - the method parameter must be packed in a ModelIF object. if no
method parameter, set it to null;
Exceptioncom.jdon.strutsutil.ServiceMethodActionpublic static String getContainerKey()
public static String getInterceptorKey()
public static ContainerWrapper getContainer(javax.servlet.http.HttpServletRequest request)
throws Exception
request - HttpServletRequest
Exception
public static ContainerWrapper getContainer(javax.servlet.ServletContext sc)
throws Exception
Exception
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||