Hi, I got start, but ran into a problem. In the code below the line
Object actionBean = context.getActionBean(); always gives DefaultViewActionBean - not my action bean. Can someone help? Thanks Chut --------------------------------------------------------- @Intercepts({LifecycleStage.ActionBeanResolution, LifecycleStage.EventHandling}) public class PageScopeInterceptor implements Interceptor { private static final String PAGE_SCOPE_KEY = "_pageScope"; public Resolution intercept(ExecutionContext context) throws Exception { Resolution resolution = context.proceed(); // Restores values from session. if (LifecycleStage.ActionBeanResolution.equals(context.getLifecycleStage())) { bindPageScopeFields(context); } if (LifecycleStage.EventHandling.equals(context.getLifecycleStage())) { serializePageScopeFields(context); } return resolution; } private void serializePageScopeFields(ExecutionContext context) throws IllegalArgumentException, IllegalAccessException, IOException { HashMap<String, Object> map = new HashMap<String, Object>(5); Object actionBean = context.getActionBean(); for (Field field : actionBean.getClass().getDeclaredFields()) { // check if field has annotation if (field.getAnnotation(PageScope.class) != null) { field.setAccessible(true); map.put(field.getName(), field.get(actionBean)); } } String _pageScope = toString(map); context.getActionBeanContext().getRequest().setAttribute(PAGE_SCOPE_KEY, _pageScope); } private void bindPageScopeFields(ExecutionContext context) throws IllegalArgumentException, IllegalAccessException, IOException, ClassNotFoundException { String pageScope = context.getActionBeanContext().getRequest().getParameter(PAGE_SCOPE_KEY); if (pageScope == null) return; @SuppressWarnings("unchecked") HashMap<String, Object> map = (HashMap<String, Object>) fromString(pageScope); Object actionBean = context.getActionBean(); for (Field field : actionBean.getClass().getDeclaredFields()) { // check if field has annotation if (field.getAnnotation(PageScope.class) != null) { if (map.get(field.getName()) != null) { field.setAccessible(true); field.set(actionBean, map.get(field.getName())); } } } } ------------------------------------------------------------------------------ Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users