/connect-web/src/main/java/org/osforce/connect/web/interceptor/WidgetCacheClearInterceptor.java

http://focus-sns.googlecode.com/ · Java · 30 lines · 18 code · 5 blank · 7 comment · 1 complexity · 49502ca3bb4a4ac9fde52efa4f94930e MD5 · raw file

  1. package org.osforce.connect.web.interceptor;
  2. import org.apache.commons.lang.StringUtils;
  3. import org.osforce.spring4me.web.interceptor.WidgetInterceptorAdapter;
  4. import org.osforce.spring4me.web.widget.core.HttpWidgetRequest;
  5. import org.osforce.spring4me.web.widget.core.HttpWidgetResponse;
  6. /**
  7. *
  8. * @author <a href="mailto:haozhonghu@hotmail.com">gavin</a>
  9. * @since 1.1.0
  10. * @create May 28, 2011 - 12:05:01 AM
  11. * <a href="http://www.opensourceforce.org">????</a>
  12. */
  13. public class WidgetCacheClearInterceptor extends WidgetInterceptorAdapter {
  14. public WidgetCacheClearInterceptor() {
  15. }
  16. @Override
  17. public void afterCompletionWidget(HttpWidgetRequest request,
  18. HttpWidgetResponse response, Object handler, Exception ex)
  19. throws Exception {
  20. if(request.getRequestURI().endsWith("-action")) {
  21. String widgetName = StringUtils.uncapitalize(handler.getClass().getSimpleName());
  22. request.getSession().setAttribute("clearCache", widgetName);
  23. }
  24. }
  25. }