Hi there,
I think there is a bug in Shale framework
1.0.4-SNAPSHOT(shale-framework-20060917.zip). in the init() function of TestVC
that extends AbstractViewController, if we get the HTTPServeltRequest object
from ExternalContext, then try to add a new attribute ( an instance of TestVC)
to the request object. The TestVC is created, then destroyed, recreated,
destroyed, recreated, destroyed.....
in Shale 1.0.1-SNAPSHOT(struts-shale-20060121.zip) doesn't have this problem.
Thanks,
-- Luo
Here is the test source code:
=====================
import org.apache.shale.view.AbstractViewController;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.servlet.http.HttpServletRequest;
public class TestVC extends AbstractViewController {
private static final Log LOGGER = LogFactory.getLog(TestVC.class);
public final void init() {
LOGGER.debug("init()");
super.init();
HttpServletRequest request = getRequest();
LOGGER.debug("Before set attribute TestVC to HttpServletRequest
object");
request.setAttribute("TestVC", this); //problem in here!!
LOGGER.debug("After set attribute TestVC to HttpServletRequest
object"); //this debug info never be print out!
doInit();
}
public final void destroy() {
LOGGER.debug("destroy()");
super.destroy();
doDestroy();
}
protected HttpServletRequest getRequest() {
LOGGER.debug("getRequest()");
HttpServletRequest request = (HttpServletRequest)
getExternalContext().getRequest();
return request;
}
public void doInit() {
LOGGER.debug(getClass() + " doInit()");
}
public void doDestroy() {
LOGGER.debug(getClass() + " doDestroy()");
}
}
---------------------------------
Stay in the know. Pulse on the new Yahoo.com. Check it out.