openamf/src/java/org/openamf AdvancedGateway.java,1.8,1.9
[email protected] Thu, 01 May 2003 17:07:38 -0700
Newsgroups
gmane.comp.java.openamf.cvs
Message-ID
<[email protected] >
Update of /cvsroot/openamf/openamf/src/java/org/openamf
In directory sc8-pr-cvs1:/tmp/cvs-serv19486/src/java/org/openamf
Modified Files:
AdvancedGateway.java
Log Message:
1) added the ability to store state-beans in HttpSession or ServletContext
2) fixed bug, where state-bean wasn't being stored in session
Index: AdvancedGateway.java
===================================================================
RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/AdvancedGateway.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** AdvancedGateway.java 1 May 2003 16:22:06 -0000 1.8
--- AdvancedGateway.java 2 May 2003 00:07:36 -0000 1.9
***************
*** 41,46 ****
getMethodConfig(serviceConfig, request);
! addStateBeansToParams(request, methodConfig);
!
serviceInvoker =
ServiceInvoker.load(
--- 41,46 ----
getMethodConfig(serviceConfig, request);
! addStateBeansToParams(httpServletRequest, request, methodConfig);
!
serviceInvoker =
ServiceInvoker.load(
***************
*** 57,75 ****
private void addStateBeansToParams(
ServiceRequest request,
ServiceMethodConfig methodConfig)
! throws ClassNotFoundException, InstantiationException, IllegalAccessException {
!
if (methodConfig != null) {
! for (Iterator i = methodConfig.getStateBeanConfigs();
! i.hasNext();
! ) {
!
! StateBeanConfig stateBeanConfig = (StateBeanConfig) i.next();
! log.debug("loading " + stateBeanConfig.getClassName());
! Class stateBeanClass =
! Thread.currentThread().getContextClassLoader().loadClass(
! stateBeanConfig.getClassName());
! Object stateBean = stateBeanClass.newInstance();
request.addParameter(stateBean);
}
--- 57,127 ----
private void addStateBeansToParams(
+ HttpServletRequest httpServletRequest,
ServiceRequest request,
ServiceMethodConfig methodConfig)
! throws
! ClassNotFoundException,
! InstantiationException,
! IllegalAccessException {
!
if (methodConfig != null) {
! Iterator stateBeans = methodConfig.getStateBeanConfigs();
! while (stateBeans.hasNext()) {
!
! Object stateBean = null;
! StateBeanConfig stateBeanConfig =
! (StateBeanConfig) stateBeans.next();
!
! if (stateBeanConfig.isApplcationScope()) {
! stateBean =
! getServletContext().getAttribute(
! stateBeanConfig.getClassName());
! } else {
! stateBean =
! httpServletRequest.getSession().getAttribute(
! stateBeanConfig.getClassName());
! }
!
! if (stateBean == null) {
! log.debug("loading " + stateBeanConfig.getClassName());
! Class stateBeanClass =
! Thread
! .currentThread()
! .getContextClassLoader()
! .loadClass(
! stateBeanConfig.getClassName());
! stateBean = stateBeanClass.newInstance();
!
! if (stateBeanConfig.isApplcationScope()) {
! log.debug(
! "storing "
! + stateBeanConfig.getClassName()
! + " in ServletContext");
! getServletContext().setAttribute(
! stateBeanConfig.getClassName(),
! stateBean);
! } else {
! log.debug(
! "storing "
! + stateBeanConfig.getClassName()
! + " in HttpSession");
! httpServletRequest.getSession().setAttribute(
! stateBeanConfig.getClassName(),
! stateBean);
! }
! } else {
! if (stateBeanConfig.isApplcationScope()) {
! log.debug(
! "got "
! + stateBeanConfig.getClassName()
! + " from ServletContext");
! } else {
! log.debug(
! "got "
! + stateBeanConfig.getClassName()
! + " from HttpSession");
! }
! }
!
request.addParameter(stateBean);
}
***************
*** 85,89 ****
ServiceMethodConfig methodConfig =
serviceInvoker.getRequest().getServiceMethodConfig();
!
try {
if (methodConfig != null
--- 137,141 ----
ServiceMethodConfig methodConfig =
serviceInvoker.getRequest().getServiceMethodConfig();
!
try {
if (methodConfig != null
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf